line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1412
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
21
|
use GD::Graph::mixed; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 'save.pl'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
print STDERR "Processing sample71\n"; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my @data = ( |
8
|
|
|
|
|
|
|
["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], |
9
|
|
|
|
|
|
|
[ 1, 2, 5, 6, 3, 1.5, -1, -3, -4], |
10
|
|
|
|
|
|
|
[ -4, -3, 1, 1, -3, -1.5, -2, -1, 0], |
11
|
|
|
|
|
|
|
[ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3], |
12
|
|
|
|
|
|
|
[ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4], |
13
|
|
|
|
|
|
|
[ -0.1, 2, 5, 4, -3, 2.5, 3.2, 4, -4], |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
my ($width, $height) = (500, 400); |
16
|
|
|
|
|
|
|
my $my_graph = new GD::Graph::mixed($width, $height); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$my_graph->set( |
19
|
|
|
|
|
|
|
types => [ qw( lines bars points area linespoints ) ], |
20
|
|
|
|
|
|
|
default_type => 'points', |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$my_graph->set( |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
x_label => 'X Label', |
26
|
|
|
|
|
|
|
y_label => 'Y label', |
27
|
|
|
|
|
|
|
title => 'Mixed Type and TTF', |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
y_max_value => 10, |
30
|
|
|
|
|
|
|
y_min_value => -5, |
31
|
|
|
|
|
|
|
y_tick_number => 3, |
32
|
|
|
|
|
|
|
y_label_skip => 1, |
33
|
|
|
|
|
|
|
x_plot_values => 1, |
34
|
|
|
|
|
|
|
y_plot_values => 1, |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
long_ticks => 1, |
37
|
|
|
|
|
|
|
x_ticks => 0, |
38
|
|
|
|
|
|
|
x_labels_vertical => 1, |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
legend_marker_width => 24, |
41
|
|
|
|
|
|
|
line_width => 3, |
42
|
|
|
|
|
|
|
marker_size => 5, |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
bar_spacing => 6, |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
legend_placement => 'RC', |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
transparent => 0, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$my_graph->set_title_font('../Dustismo_Sans.ttf', 18); |
52
|
|
|
|
|
|
|
$my_graph->set_x_label_font('../Dustismo_Sans.ttf', 10); |
53
|
|
|
|
|
|
|
$my_graph->set_y_label_font('../Dustismo_Sans.ttf', 10); |
54
|
|
|
|
|
|
|
$my_graph->set_x_axis_font('../Dustismo_Sans.ttf', 8); |
55
|
|
|
|
|
|
|
$my_graph->set_y_axis_font('../Dustismo_Sans.ttf', 8); |
56
|
|
|
|
|
|
|
$my_graph->set_legend_font('../Dustismo_Sans.ttf', 9); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$my_graph->set_legend( qw( one two three four five six ) ); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Put some background text in, but only if we have TTF support |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
if ($my_graph->can_do_ttf) |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
my $gd = $my_graph->gd; |
65
|
|
|
|
|
|
|
my $white = $gd->colorAllocate(255,255,255); |
66
|
|
|
|
|
|
|
my $pink = $gd->colorAllocate(255,240,240); |
67
|
|
|
|
|
|
|
my $gdta; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$gdta = GD::Text::Align->new($gd, |
70
|
|
|
|
|
|
|
text => 'GD::Graph', |
71
|
|
|
|
|
|
|
font => '../Dustismo_Sans.ttf', |
72
|
|
|
|
|
|
|
ptsize => 72, |
73
|
|
|
|
|
|
|
colour => $pink, |
74
|
|
|
|
|
|
|
valign => 'center', |
75
|
|
|
|
|
|
|
halign => 'center', |
76
|
|
|
|
|
|
|
) or warn $gdta->error; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$gdta->draw($width/2, $height/2, atan2($height, $width)); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$my_graph->plot(\@data); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Use a hotspot to draw some extra text on the chart |
84
|
|
|
|
|
|
|
# XXX This doesn't work nicely. Need a nicer way to get the maximum. |
85
|
|
|
|
|
|
|
if (1) { |
86
|
|
|
|
|
|
|
my $gd = $my_graph->gd; |
87
|
|
|
|
|
|
|
my $red = $gd->colorResolve(255,0,0); |
88
|
|
|
|
|
|
|
my @l = $my_graph->get_hotspot(1, 3); |
89
|
|
|
|
|
|
|
my ($x, $y) = ( ($l[1] + $l[3])/2, ($l[2] + $l[4])/2 ); |
90
|
|
|
|
|
|
|
my $gdta; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$gdta = GD::Text::Align->new($gd, |
93
|
|
|
|
|
|
|
text => 'maximum', |
94
|
|
|
|
|
|
|
font => ['../Dustismo_Sans.ttf', GD::Font->Small], |
95
|
|
|
|
|
|
|
ptsize => 12, |
96
|
|
|
|
|
|
|
colour => $red, |
97
|
|
|
|
|
|
|
valign => 'bottom', |
98
|
|
|
|
|
|
|
halign => 'center', |
99
|
|
|
|
|
|
|
) or warn $gdta->error; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$gdta->draw($x, $y + 2); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
save_chart($my_graph, 'sample71'); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |