line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#========================================================================== |
2
|
|
|
|
|
|
|
# Copyright (c) 1995-1998 Martien Verbruggen |
3
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Name: |
6
|
|
|
|
|
|
|
# GD::Graph::mixed.pm |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# $Id: mixed.pm,v 1.13 2007/04/26 03:16:09 ben Exp $ |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
#========================================================================== |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package GD::Graph::mixed; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
($GD::Graph::mixed::VERSION) = '$Revision: 1.13 $' =~ /\s([\d.]+)/; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
5774
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
66
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
740
|
use GD::Graph::axestype; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use GD::Graph::lines; |
20
|
|
|
|
|
|
|
use GD::Graph::points; |
21
|
|
|
|
|
|
|
use GD::Graph::linespoints; |
22
|
|
|
|
|
|
|
use GD::Graph::bars; |
23
|
|
|
|
|
|
|
use GD::Graph::area; |
24
|
|
|
|
|
|
|
use Carp; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Even though multiple inheritance is not really a good idea, I will |
27
|
|
|
|
|
|
|
# do it here, because I need the functionality of the markers and the |
28
|
|
|
|
|
|
|
# line types We'll include axestype as the first one, to make sure |
29
|
|
|
|
|
|
|
# that's where we look first for methods. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
@GD::Graph::mixed::ISA = qw( |
32
|
|
|
|
|
|
|
GD::Graph::axestype |
33
|
|
|
|
|
|
|
GD::Graph::bars |
34
|
|
|
|
|
|
|
GD::Graph::lines |
35
|
|
|
|
|
|
|
GD::Graph::points |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub initialise |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
$self->SUPER::initialise(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub correct_width |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
return $self->{correct_width} if defined $self->{correct_width}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
for my $type ($self->{default_type}, @{$self->{types}}) |
51
|
|
|
|
|
|
|
{ |
52
|
|
|
|
|
|
|
return 1 if $type eq 'bars'; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub draw_data_set |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
my $self = shift; |
59
|
|
|
|
|
|
|
my $ds = $_[0]; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $rc; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $type = $self->types($ds); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Try to execute the draw_data_set function in the package |
66
|
|
|
|
|
|
|
# specified by type |
67
|
|
|
|
|
|
|
$rc = eval '$self->GD::Graph::'.$type.'::draw_data_set(@_)'; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# If we fail, we try it in the package specified by the |
70
|
|
|
|
|
|
|
# default_type, and warn the user |
71
|
|
|
|
|
|
|
if ($@) |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
carp "Set $ds, unknown type $type, assuming $self->{default_type}"; |
74
|
|
|
|
|
|
|
#carp "Error message: $@"; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$rc = eval '$self->GD::Graph::'. |
77
|
|
|
|
|
|
|
$self->{default_type}.'::draw_data_set(@_)'; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# If even that fails, we bail out |
81
|
|
|
|
|
|
|
croak "Set $ds: unknown default type $self->{default_type}" if $@; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
return $rc; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub draw_legend_marker |
87
|
|
|
|
|
|
|
{ |
88
|
|
|
|
|
|
|
my $self = shift; |
89
|
|
|
|
|
|
|
my $ds = $_[0]; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $type = $self->types($ds); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
eval '$self->GD::Graph::'.$type.'::draw_legend_marker(@_)'; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
eval '$self->GD::Graph::'. |
96
|
|
|
|
|
|
|
$self->{default_type}.'::draw_legend_marker(@_)' if $@; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# undocumented as can be: returns the type-list (with the default |
100
|
|
|
|
|
|
|
# inserted as appropriate), or the type associated with a particular |
101
|
|
|
|
|
|
|
# (1-indexed) dataset number (undef if there is no such dataset). The |
102
|
|
|
|
|
|
|
# range check means that this cannot be called when there is no |
103
|
|
|
|
|
|
|
# GD::Graph::Data object in $self->{_data}. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub types |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
my $self = shift; |
108
|
|
|
|
|
|
|
if ( defined $_[0] ) { |
109
|
|
|
|
|
|
|
$_[0] > 0 && $_[0] <= $self->{_data}->num_sets |
110
|
|
|
|
|
|
|
? $self->{types}->[$_[0] - 1] || $self->{default_type} |
111
|
|
|
|
|
|
|
: undef |
112
|
|
|
|
|
|
|
} else { |
113
|
|
|
|
|
|
|
map { $self->{types}->[$_ - 1] || $self->{default_type} } |
114
|
|
|
|
|
|
|
1 .. $self->{_data}->num_sets; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
"Just another true value"; |