File: linespoints_2.t

package info (click to toggle)
libchart-perl 2.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 15,356 kB
  • ctags: 140
  • sloc: perl: 6,573; makefile: 40
file content (44 lines) | stat: -rwxr-xr-x 812 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Chart::LinesPoints;
use strict;

print "1..1\n";

my (@data, @data2, @labels, %hash, $g, $hits);

# create an array of labels
for (0..30) {
  push (@labels, $_);
}

# create two arrays of data
for (0..30) {
  #first array
  $hits = 2 * $_ ;
  if ( $_ % 2 == 0) {
    $hits = $_ ;
  }
  push (@data, $hits);

  #second array
  $hits = 40 - $_ + 10*cos ($_);
  push (@data2, $hits);
}

$g = Chart::LinesPoints->new(600,300);
$g->add_dataset(@labels);
$g->add_dataset(@data);
$g->add_dataset(@data2);

%hash =(  'title' => 'Lines with Points Demo',
          'y_axes' => 'both',
          'legend' => 'none',
          'precision' => 0,
          'xy_plot' => 'true',
          );

$g->set ( %hash);
$g->png ("samples/linespoints_2.png");
print "ok 1\n";

exit (0);