File: composite_f.t

package info (click to toggle)
libchart-perl 2.4.10ds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,900 kB
  • ctags: 245
  • sloc: perl: 11,697; makefile: 6
file content (43 lines) | stat: -rw-r--r-- 966 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
#!/usr/bin/perl -w

use Chart::Composite;
use strict;

print "1..1\n";

my $g = Chart::Composite->new;

$g->add_dataset( 1,   2,   3,   7,   5,   6 );
$g->add_dataset( 0.1, 0.2, 0.3, 0.2, 0.4, 0.1 );
$g->add_dataset( 0.3, 0.5, 0.2, 0.6, 0.7, 0.4 );
$g->add_dataset( 10,  11,  6,   7,   7,   8 );

$g->set(
    'title'          => 'Composite Chart',
    'composite_info' => [ [ 'Bars', [ 1, 2 ] ], [ 'LinesPoints', [3] ] ]
);
$g->set( 'include_zero'              => 'true' );
$g->set( 'legend'                    => 'top' );
$g->set( 'legend_example_height'     => 'true', );
$g->set( 'legend_example_height0..1' => '10' );
$g->set( 'legend_example_height2'    => '3' );
$g->set( 'f_y_tick'                  => \&multiply );
$g->set( 'f_x_tick'                  => \&int_quadrat );
$g->png("samples/composite_f.png");

print "ok 1\n";

exit(0);

sub multiply
{
    my $y = shift;

    return ( $y * 10 );
}

sub int_quadrat
{
    my $x = shift;
    return $x * $x;
}