summaryrefslogtreecommitdiff
path: root/t/mapcomp.t
blob: c48ef5de6653ee1db080fbcad7ccb81d72da2777 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl -w

BEGIN { unshift @INC, 'lib', '../lib'}
use strict;
use Chart::Composite;
use File::Temp 0.19;
my $samples = File::Temp->newdir();

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

#
my $Graph = new Chart::Composite( 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 )
    {
        if ( defined( $imagemap_data->[$ds]->[$pt] ) )
        {
            my @i = @{ $imagemap_data->[$ds]->[$pt] };    # **
            print "Dataset:$ds - Point: $pt  ----  VALUES: @i \n";
        }
    }
}

print "ok\n";

exit 0;