line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Imager::Graph::StackedColumn; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Imager::Graph::StackedColumn - a tool for drawing stacked column charts on Imager images |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Imager::Graph::StackedColumn; |
10
|
|
|
|
|
|
|
use Imager::Font; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $font = Imager::Font->new(file => '/path/to/font.ttf') || die "Error: $!"; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $graph = Imager::Graph::StackedColumn->new(); |
15
|
|
|
|
|
|
|
$graph->set_image_width(900); |
16
|
|
|
|
|
|
|
$graph->set_image_height(600); |
17
|
|
|
|
|
|
|
$graph->set_font($font); |
18
|
|
|
|
|
|
|
$graph->use_automatic_axis(); |
19
|
|
|
|
|
|
|
$graph->show_legend(); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my @data = (1, 2, 3, 5, 7, 11); |
22
|
|
|
|
|
|
|
my @data2 = (1, 1, 1, 2, 2, 2); |
23
|
|
|
|
|
|
|
my @labels = qw(one two three five seven eleven); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$graph->add_data_series(\@data, 'Primes'); |
26
|
|
|
|
|
|
|
$graph->add_data_series(\@data2, 'Numbers'); |
27
|
|
|
|
|
|
|
$graph->set_labels(\@labels); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $img = $graph->draw() || die $graph->error; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$img->write(file => 'columns.png'); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
|
993
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
36
|
1
|
|
|
1
|
|
6
|
use vars qw(@ISA); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
37
|
1
|
|
|
1
|
|
680
|
use Imager::Graph::Vertical; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
71
|
|
38
|
|
|
|
|
|
|
@ISA = qw(Imager::Graph::Vertical); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _get_default_series_type { |
41
|
3
|
|
|
3
|
|
27
|
return 'stacked_column'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|