| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package GD::Graph::splined; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
($GD::Graph::splined::VERSION) = '$Revision: 0.01 $' =~ /\s([\d.]+)/; |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
25802
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
37
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
463
|
use GD::Graph::axestype; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use GD::Graph::area; # v1.16 |
|
10
|
|
|
|
|
|
|
use GD::Polyline; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@GD::Graph::splined::ISA = qw( |
|
13
|
|
|
|
|
|
|
GD::Graph::axestype |
|
14
|
|
|
|
|
|
|
GD::Graph::area |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# PRIVATE |
|
18
|
|
|
|
|
|
|
sub draw_data_set { |
|
19
|
|
|
|
|
|
|
my $self = shift; # object reference |
|
20
|
|
|
|
|
|
|
my $ds = shift; # number of the data set |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my @values = $self->{_data}->y_values($ds) or |
|
23
|
|
|
|
|
|
|
return $self->_set_error("Impossible illegal data set: $ds", |
|
24
|
|
|
|
|
|
|
$self->{_data}->error); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Select a data colour |
|
27
|
|
|
|
|
|
|
my $dsci = $self->set_clr($self->pick_data_clr($ds)); |
|
28
|
|
|
|
|
|
|
my $brci = $self->set_clr($self->pick_border_clr($ds)); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Create a new polygon |
|
31
|
|
|
|
|
|
|
my $poly = GD::Polyline->new(); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my @bottom; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Add the data points |
|
36
|
|
|
|
|
|
|
for (my $i = 0; $i < @values; $i++) { |
|
37
|
|
|
|
|
|
|
my $value = $values[$i]; |
|
38
|
|
|
|
|
|
|
next unless defined $value; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $bottom = $self->_get_bottom($ds, $i); |
|
41
|
|
|
|
|
|
|
$value = $self->{_data}->get_y_cumulative($ds, $i) |
|
42
|
|
|
|
|
|
|
if ($self->{overwrite} == 2); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my ($x, $y) = $self->val_to_pixel($i + 1, $value, $ds); |
|
45
|
|
|
|
|
|
|
$poly->addPt($x, $y); |
|
46
|
|
|
|
|
|
|
# Need to keep track of this stuff for hotspots, and because |
|
47
|
|
|
|
|
|
|
# it's the only reliable way of closing the polygon, without |
|
48
|
|
|
|
|
|
|
# making odd assumptions. |
|
49
|
|
|
|
|
|
|
push @bottom, [$x, $bottom]; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Hotspot stuff |
|
52
|
|
|
|
|
|
|
# XXX needs fixing. Not used at the moment. |
|
53
|
|
|
|
|
|
|
next unless defined $self->{_hotspots}->[$ds]->[$i]; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
if ($i == 0) { |
|
56
|
|
|
|
|
|
|
$self->{_hotspots}->[$ds]->[$i] = ["poly", |
|
57
|
|
|
|
|
|
|
$x, $y, |
|
58
|
|
|
|
|
|
|
$x , $bottom, |
|
59
|
|
|
|
|
|
|
$x - 1, $bottom, |
|
60
|
|
|
|
|
|
|
$x - 1, $y, |
|
61
|
|
|
|
|
|
|
$x, $y]; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
else { |
|
64
|
|
|
|
|
|
|
$self->{_hotspots}->[$ds]->[$i] = ["poly", |
|
65
|
|
|
|
|
|
|
$poly->getPt($i), |
|
66
|
|
|
|
|
|
|
@{$bottom[$i]}, |
|
67
|
|
|
|
|
|
|
@{$bottom[$i-1]}, |
|
68
|
|
|
|
|
|
|
$poly->getPt($i-1), |
|
69
|
|
|
|
|
|
|
$poly->getPt($i)]; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $spline = $poly->addControlPoints->toSpline; |
|
74
|
|
|
|
|
|
|
$self->{graph}->polydraw($spline,$dsci); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Draw the accent lines |
|
77
|
|
|
|
|
|
|
if (defined $brci and |
|
78
|
|
|
|
|
|
|
($self->{right} - $self->{left})/@values > $self->{accent_treshold} |
|
79
|
|
|
|
|
|
|
) { |
|
80
|
|
|
|
|
|
|
for (my $i = 1; $i < @values - 1; $i++) { |
|
81
|
|
|
|
|
|
|
my $value = $values[$i]; |
|
82
|
|
|
|
|
|
|
## XXX Why don't I need this line? |
|
83
|
|
|
|
|
|
|
##next unless defined $value; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my ($x, $y) = $poly->getPt($i); |
|
86
|
|
|
|
|
|
|
my $bottom = $bottom[$i]->[1]; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$self->{graph}->dashedLine($x, $y, $x, $bottom, $brci); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
return $ds |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
'End of module'; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |