File: linespoints_2.t

package info (click to toggle)
libchart-perl 2.4.10ds1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,900 kB
  • sloc: perl: 11,697; makefile: 6
file content (51 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (4)
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
45
46
47
48
49
50
51
#!/usr/bin/perl -w

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);