File: mapcomp.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 (57 lines) | stat: -rw-r--r-- 1,834 bytes parent folder | download | duplicates (3)
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
use strict;
use Chart::Composite;

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;