File: mapbars.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 (60 lines) | stat: -rw-r--r-- 1,531 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
52
53
54
55
56
57
58
59
60
use strict;
use Chart::Bars;

my $png_name = 'samples/mapbars.png';
my @legend_keys = ( "Actual ", "Goal" );

my $Graph = new Chart::Bars( 600, 400 );

print "1..1\n";

$Graph->add_dataset(
    "Oct 01", "Nov 01", "Dec 01", "Jan 02", "Feb 02", "Mar
02"
);
$Graph->add_dataset( 95.1, 84.4, 90.2, 94.4, 93.8, 95.5 );
$Graph->add_dataset( 93.0, 83.0, 94.0, 94.0, 94.0, 94.0 );

$Graph->set(
    composite_info => [ [ 'Bars', [1] ], [ 'Lines', [2] ] ],
    colors => {
        dataset0 => 'green',
        dataset1 => 'red'
    },
    title_font         => GD::Font->Giant,
    label_font         => GD::Font->Small,
    legend_font        => GD::Font->Large,
    tick_label_font    => GD::Font->Large,
    grid_lines         => 'true',
    graph_border       => 0,
    imagemap           => 'true',
    legend             => 'bottom',
    legend_labels      => \@legend_keys,
    max_val            => 100,
    min_val            => 80,
    png_border         => 4,
    same_y_axes        => 'true',
    spaced_bars        => 'true',
    title              => "Yield 2004",
    text_space         => 5,
    transparent        => 'true',
    x_ticks            => 'vertical',
    integer_ticks_only => 'true',
    skip_int_ticks     => 5,
);

$Graph->png("$png_name");

my $imagemap_data = $Graph->imagemap_dump();

foreach my $ds ( 1 .. 1 )
{
    foreach my $pt ( 0 .. 5 )
    {
        my @i = @{ $imagemap_data->[$ds]->[$pt] };    # **
        print "Dataset:$ds - Point: $pt  ----  VALUES: @i \n";
    }
}
print "ok 1\n";

exit 0;