line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tk::Chart;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#==================================================================
|
4
|
|
|
|
|
|
|
# $Author : Djibril Ousmanou $
|
5
|
|
|
|
|
|
|
# $Copyright : 2011 $
|
6
|
|
|
|
|
|
|
# $Update : 21/10/2011 22:26:55 $
|
7
|
|
|
|
|
|
|
# $AIM : Private functions for Tk::Chart modules $
|
8
|
|
|
|
|
|
|
#==================================================================
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
22745
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
12
|
1
|
|
|
1
|
|
6
|
use Carp;
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
85
|
|
13
|
1
|
|
|
1
|
|
682
|
use Tk::Chart::Utils qw / :DUMMIES /;
|
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
368
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
9
|
use vars qw($VERSION);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
16
|
|
|
|
|
|
|
$VERSION = '1.20';
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use Exporter;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
62
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @module_export = qw (
|
21
|
|
|
|
|
|
|
_treatparameters _initconfig _error
|
22
|
|
|
|
|
|
|
_checksizelegend_data _zoomcalcul _destroyballoon_bind
|
23
|
|
|
|
|
|
|
_createtype _getmarkertype _display_line
|
24
|
|
|
|
|
|
|
_box _title _xlabelposition
|
25
|
|
|
|
|
|
|
_ylabelposition _ytick _chartconstruction
|
26
|
|
|
|
|
|
|
_manage_minmaxvalues _display_xticks _display_yticks
|
27
|
|
|
|
|
|
|
_get_configspecs
|
28
|
|
|
|
|
|
|
);
|
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
5
|
use base qw/ Exporter /;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8509
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our @EXPORT_OK = @module_export;
|
33
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( DUMMIES => \@module_export );
|
34
|
|
|
|
|
|
|
my $DASH = q{.};
|
35
|
|
|
|
|
|
|
my ( $MIN_ANGLE, $MAX_ANGLE ) = ( 0, 360 );
|
36
|
|
|
|
|
|
|
my $BORDERWITH_PLUS = 15;
|
37
|
|
|
|
|
|
|
my $PERCENT = 100;
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _get_configspecs {
|
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
|
|
my $ref_config = _initconfig();
|
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my %configuration = (
|
44
|
|
|
|
|
|
|
-title => [ 'PASSIVE', 'Title', 'Title', undef ],
|
45
|
|
|
|
|
|
|
-titlecolor => [ 'PASSIVE', 'Titlecolor', 'TitleColor', 'black' ],
|
46
|
|
|
|
|
|
|
-titlefont => [ 'PASSIVE', 'Titlefont', 'TitleFont', $ref_config->{Font}{DefaultTitle} ],
|
47
|
|
|
|
|
|
|
-titleposition => [ 'PASSIVE', 'Titleposition', 'TitlePosition', 'center' ],
|
48
|
|
|
|
|
|
|
-titleheight => [ 'PASSIVE', 'Titleheight', 'TitleHeight', $ref_config->{Title}{Height} ],
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
-xlabel => [ 'PASSIVE', 'Xlabel', 'XLabel', undef ],
|
51
|
|
|
|
|
|
|
-xlabelcolor => [ 'PASSIVE', 'Xlabelcolor', 'XLabelColor', 'black' ],
|
52
|
|
|
|
|
|
|
-xlabelfont => [ 'PASSIVE', 'Xlabelfont', 'XLabelFont', $ref_config->{Font}{DefaultLabel} ],
|
53
|
|
|
|
|
|
|
-xlabelposition => [ 'PASSIVE', 'Xlabelposition', 'XLabelPosition', 'center' ],
|
54
|
|
|
|
|
|
|
-xlabelheight => [ 'PASSIVE', 'Xlabelheight', 'XLabelHeight', $ref_config->{Axis}{Xaxis}{xlabelHeight} ],
|
55
|
|
|
|
|
|
|
-xlabelskip => [ 'PASSIVE', 'Xlabelskip', 'XLabelSkip', 0 ],
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
-xvaluecolor => [ 'PASSIVE', 'Xvaluecolor', 'XValueColor', 'black' ],
|
58
|
|
|
|
|
|
|
-xvaluefont => [ 'PASSIVE', 'Xvaluefont', 'XValueFont', $ref_config->{Font}{DefaultXValues} ],
|
59
|
|
|
|
|
|
|
-xvaluesregex => [ 'PASSIVE', 'Xvaluesregex', 'XValuesRegex', qr/.+/ ],
|
60
|
|
|
|
|
|
|
-xvaluespace => [ 'PASSIVE', 'Xvaluespace', 'XValueSpace', $ref_config->{Axis}{Xaxis}{ScaleValuesHeight} ],
|
61
|
|
|
|
|
|
|
-xvaluevertical => [ 'PASSIVE', 'Xvaluevertical', 'XValueVertical', 0 ],
|
62
|
|
|
|
|
|
|
-xvalueview => [ 'PASSIVE', 'Xvalueview', 'XValueView', 1 ],
|
63
|
|
|
|
|
|
|
-yvaluefont => [ 'PASSIVE', 'Yvaluefont', 'YValueFont', $ref_config->{Font}{DefaultYValues} ],
|
64
|
|
|
|
|
|
|
-yvalueview => [ 'PASSIVE', 'Yvalueview', 'YValueView', 1 ],
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
-ylabel => [ 'PASSIVE', 'Ylabel', 'YLabel', undef ],
|
67
|
|
|
|
|
|
|
-ylabelcolor => [ 'PASSIVE', 'Ylabelcolor', 'YLabelColor', 'black' ],
|
68
|
|
|
|
|
|
|
-ylabelfont => [ 'PASSIVE', 'Ylabelfont', 'YLabelFont', $ref_config->{Font}{DefaultLabel} ],
|
69
|
|
|
|
|
|
|
-ylabelposition => [ 'PASSIVE', 'Ylabelposition', 'YLabelPosition', 'center' ],
|
70
|
|
|
|
|
|
|
-ylabelwidth => [ 'PASSIVE', 'Ylabelwidth', 'YLabelWidth', $ref_config->{Axis}{Yaxis}{ylabelWidth} ],
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
-yvaluecolor => [ 'PASSIVE', 'Yvaluecolor', 'YValueColor', 'black' ],
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
-labelscolor => [ 'PASSIVE', 'Labelscolor', 'LabelsColor', undef ],
|
75
|
|
|
|
|
|
|
-valuescolor => [ 'PASSIVE', 'Valuescolor', 'ValuesColor', undef ],
|
76
|
|
|
|
|
|
|
-textcolor => [ 'PASSIVE', 'Textcolor', 'TextColor', undef ],
|
77
|
|
|
|
|
|
|
-textfont => [ 'PASSIVE', 'Textfont', 'TextFont', undef ],
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
-axiscolor => [ 'PASSIVE', 'Axiscolor', 'AxisColor', 'black' ],
|
80
|
|
|
|
|
|
|
-boxaxis => [ 'PASSIVE', 'Boxaxis', 'BoxAxis', 0 ],
|
81
|
|
|
|
|
|
|
-noaxis => [ 'PASSIVE', 'Noaxis', 'NoAxis', 0 ],
|
82
|
|
|
|
|
|
|
-zeroaxisonly => [ 'PASSIVE', 'Zeroaxisonly', 'ZeroAxisOnly', 0 ],
|
83
|
|
|
|
|
|
|
-zeroaxis => [ 'PASSIVE', 'Zeroaxis', 'ZeroAxis', 0 ],
|
84
|
|
|
|
|
|
|
-longticks => [ 'PASSIVE', 'Longticks', 'LongTicks', 0 ],
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
-xlongticks => [ 'PASSIVE', 'XLongticks', 'XLongTicks', 0 ],
|
87
|
|
|
|
|
|
|
-ylongticks => [ 'PASSIVE', 'YLongticks', 'YLongTicks', 0 ],
|
88
|
|
|
|
|
|
|
-xlongtickscolor => [ 'PASSIVE', 'XLongtickscolor', 'XLongTicksColor', '#B3B3B3' ],
|
89
|
|
|
|
|
|
|
-ylongtickscolor => [ 'PASSIVE', 'YLongtickscolor', 'YLongTicksColor', '#B3B3B3' ],
|
90
|
|
|
|
|
|
|
-longtickscolor => [ 'PASSIVE', 'Longtickscolor', 'LongTicksColor', undef ],
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
-xtickheight => [ 'PASSIVE', 'Xtickheight', 'XTickHeight', $ref_config->{Axis}{Xaxis}{TickHeight} ],
|
93
|
|
|
|
|
|
|
-xtickview => [ 'PASSIVE', 'Xtickview', 'XTickView', 1 ],
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
-yminvalue => [ 'PASSIVE', 'Yminvalue', 'YMinValue', 0 ],
|
96
|
|
|
|
|
|
|
-ymaxvalue => [ 'PASSIVE', 'Ymaxvalue', 'YMaxValue', undef ],
|
97
|
|
|
|
|
|
|
-interval => [ 'PASSIVE', 'interval', 'Interval', 0 ],
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# image size
|
100
|
|
|
|
|
|
|
-width => [ 'SELF', 'width', 'Width', $ref_config->{Canvas}{Width} ],
|
101
|
|
|
|
|
|
|
-height => [ 'SELF', 'height', 'Height', $ref_config->{Canvas}{Height} ],
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
-yticknumber => [ 'PASSIVE', 'Yticknumber', 'YTickNumber', $ref_config->{Axis}{Yaxis}{TickNumber} ],
|
104
|
|
|
|
|
|
|
-ytickwidth => [ 'PASSIVE', 'Ytickwidth', 'YtickWidth', $ref_config->{Axis}{Yaxis}{TickWidth} ],
|
105
|
|
|
|
|
|
|
-ytickview => [ 'PASSIVE', 'Ytickview', 'YTickView', 1 ],
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
-alltickview => [ 'PASSIVE', 'Alltickview', 'AllTickView', 1 ],
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
-linewidth => [ 'PASSIVE', 'Linewidth', 'LineWidth', 1 ],
|
110
|
|
|
|
|
|
|
-colordata => [ 'PASSIVE', 'Colordata', 'ColorData', $ref_config->{Legend}{Colors} ],
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# verbose mode
|
113
|
|
|
|
|
|
|
-verbose => [ 'PASSIVE', 'verbose', 'Verbose', 1 ],
|
114
|
|
|
|
|
|
|
);
|
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return \%configuration;
|
117
|
|
|
|
|
|
|
}
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub _initconfig {
|
120
|
0
|
|
|
0
|
|
|
my $cw = shift;
|
121
|
0
|
|
|
|
|
|
my %configuration = (
|
122
|
|
|
|
|
|
|
'Axis' => {
|
123
|
|
|
|
|
|
|
Cx0 => undef,
|
124
|
|
|
|
|
|
|
Cx0 => undef,
|
125
|
|
|
|
|
|
|
CxMin => undef,
|
126
|
|
|
|
|
|
|
CxMax => undef,
|
127
|
|
|
|
|
|
|
CyMin => undef,
|
128
|
|
|
|
|
|
|
CyMax => undef,
|
129
|
|
|
|
|
|
|
Xaxis => {
|
130
|
|
|
|
|
|
|
Width => undef,
|
131
|
|
|
|
|
|
|
Height => undef,
|
132
|
|
|
|
|
|
|
xlabelHeight => 30,
|
133
|
|
|
|
|
|
|
ScaleValuesHeight => 30,
|
134
|
|
|
|
|
|
|
TickHeight => 5,
|
135
|
|
|
|
|
|
|
CxlabelX => undef,
|
136
|
|
|
|
|
|
|
CxlabelY => undef,
|
137
|
|
|
|
|
|
|
Idxlabel => undef,
|
138
|
|
|
|
|
|
|
IdxTick => undef,
|
139
|
|
|
|
|
|
|
TagAxis0 => 'Axe00',
|
140
|
|
|
|
|
|
|
},
|
141
|
|
|
|
|
|
|
Yaxis => {
|
142
|
|
|
|
|
|
|
ylabelWidth => 5,
|
143
|
|
|
|
|
|
|
ScaleValuesWidth => 60,
|
144
|
|
|
|
|
|
|
TickWidth => 5,
|
145
|
|
|
|
|
|
|
TickNumber => 4,
|
146
|
|
|
|
|
|
|
Width => undef,
|
147
|
|
|
|
|
|
|
Height => undef,
|
148
|
|
|
|
|
|
|
CylabelX => undef,
|
149
|
|
|
|
|
|
|
CylabelY => undef,
|
150
|
|
|
|
|
|
|
Idylabel => undef,
|
151
|
|
|
|
|
|
|
},
|
152
|
|
|
|
|
|
|
},
|
153
|
|
|
|
|
|
|
'Balloon' => {
|
154
|
|
|
|
|
|
|
Obj => undef,
|
155
|
|
|
|
|
|
|
Message => {},
|
156
|
|
|
|
|
|
|
State => 0,
|
157
|
|
|
|
|
|
|
ColorData => [ '#000000', '#CB89D3' ],
|
158
|
|
|
|
|
|
|
MorePixelSelected => 2,
|
159
|
|
|
|
|
|
|
Background => 'snow',
|
160
|
|
|
|
|
|
|
BalloonMsg => undef,
|
161
|
|
|
|
|
|
|
IdLegData => undef,
|
162
|
|
|
|
|
|
|
},
|
163
|
|
|
|
|
|
|
'Canvas' => {
|
164
|
|
|
|
|
|
|
Height => 400,
|
165
|
|
|
|
|
|
|
Width => 400,
|
166
|
|
|
|
|
|
|
HeightEmptySpace => 20,
|
167
|
|
|
|
|
|
|
WidthEmptySpace => 20,
|
168
|
|
|
|
|
|
|
YTickWidth => 2,
|
169
|
|
|
|
|
|
|
},
|
170
|
|
|
|
|
|
|
'Data' => {
|
171
|
|
|
|
|
|
|
RefXLegend => undef,
|
172
|
|
|
|
|
|
|
RefAllData => undef,
|
173
|
|
|
|
|
|
|
PlotDefined => undef,
|
174
|
|
|
|
|
|
|
MaxYValue => undef,
|
175
|
|
|
|
|
|
|
MinYValue => undef,
|
176
|
|
|
|
|
|
|
GetIdData => {},
|
177
|
|
|
|
|
|
|
SubstitutionValue => 0,
|
178
|
|
|
|
|
|
|
NumberRealData => undef,
|
179
|
|
|
|
|
|
|
RefDataToDisplay => undef,
|
180
|
|
|
|
|
|
|
RefOptionDataToDisplay => undef,
|
181
|
|
|
|
|
|
|
},
|
182
|
|
|
|
|
|
|
'Font' => {
|
183
|
|
|
|
|
|
|
Default => '{Times} 10 {normal}',
|
184
|
|
|
|
|
|
|
DefaultTitle => '{Times} 12 {bold}',
|
185
|
|
|
|
|
|
|
DefaultLabel => '{Times} 10 {bold}',
|
186
|
|
|
|
|
|
|
DefaultXValues => '{Times} 8 {normal}',
|
187
|
|
|
|
|
|
|
DefaultYValues => '{Times} 8 {normal}',
|
188
|
|
|
|
|
|
|
DefaultLegend => '{Times} 8 {normal}',
|
189
|
|
|
|
|
|
|
DefaultLegendTitle => '{Times} 8 {bold}',
|
190
|
|
|
|
|
|
|
DefaultBarValues => '{Times} 8 {normal}',
|
191
|
|
|
|
|
|
|
},
|
192
|
|
|
|
|
|
|
'Legend' => {
|
193
|
|
|
|
|
|
|
HeightTitle => 30,
|
194
|
|
|
|
|
|
|
HLine => 20,
|
195
|
|
|
|
|
|
|
WCube => 10,
|
196
|
|
|
|
|
|
|
HCube => 10,
|
197
|
|
|
|
|
|
|
SpaceBeforeCube => 5,
|
198
|
|
|
|
|
|
|
SpaceAfterCube => 5,
|
199
|
|
|
|
|
|
|
WidthText => 250,
|
200
|
|
|
|
|
|
|
NbrLegPerLine => undef,
|
201
|
|
|
|
|
|
|
'-width' => undef,
|
202
|
|
|
|
|
|
|
Height => 0,
|
203
|
|
|
|
|
|
|
Width => undef,
|
204
|
|
|
|
|
|
|
LengthOneLegend => undef,
|
205
|
|
|
|
|
|
|
DataLegend => undef,
|
206
|
|
|
|
|
|
|
LengthTextMax => undef,
|
207
|
|
|
|
|
|
|
GetIdLeg => {},
|
208
|
|
|
|
|
|
|
title => undef,
|
209
|
|
|
|
|
|
|
titlefont => '{Times} 12 {bold}',
|
210
|
|
|
|
|
|
|
titlecolors => 'black',
|
211
|
|
|
|
|
|
|
textcolor => 'black',
|
212
|
|
|
|
|
|
|
legendcolor => 'black',
|
213
|
|
|
|
|
|
|
Colors => [
|
214
|
|
|
|
|
|
|
'red', 'green', 'blue', 'yellow', 'purple', 'cyan', '#996600', '#99A6CC',
|
215
|
|
|
|
|
|
|
'#669933', '#929292', '#006600', '#FFE100', '#00A6FF', '#009060', '#B000E0', '#A08000',
|
216
|
|
|
|
|
|
|
'orange', 'brown', 'black', '#FFCCFF', '#99CCFF', '#FF00CC', '#FF8000', '#006090',
|
217
|
|
|
|
|
|
|
],
|
218
|
|
|
|
|
|
|
NbrLegend => 0,
|
219
|
|
|
|
|
|
|
box => 0,
|
220
|
|
|
|
|
|
|
},
|
221
|
|
|
|
|
|
|
'TAGS' => {
|
222
|
|
|
|
|
|
|
AllTagsChart => '_AllTagsChart',
|
223
|
|
|
|
|
|
|
AllAXIS => '_AllAXISTag',
|
224
|
|
|
|
|
|
|
yAxis => '_yAxisTag',
|
225
|
|
|
|
|
|
|
xAxis => '_xAxisTag',
|
226
|
|
|
|
|
|
|
'xAxis0' => '_0AxisTag',
|
227
|
|
|
|
|
|
|
BoxAxis => '_BoxAxisTag',
|
228
|
|
|
|
|
|
|
xTick => '_xTickTag',
|
229
|
|
|
|
|
|
|
yTick => '_yTickTag',
|
230
|
|
|
|
|
|
|
AllTick => '_AllTickTag',
|
231
|
|
|
|
|
|
|
'xValue0' => '_xValue0Tag',
|
232
|
|
|
|
|
|
|
xValues => '_xValuesTag',
|
233
|
|
|
|
|
|
|
yValues => '_yValuesTag',
|
234
|
|
|
|
|
|
|
AllValues => '_AllValuesTag',
|
235
|
|
|
|
|
|
|
TitleLegend => '_TitleLegendTag',
|
236
|
|
|
|
|
|
|
BoxLegend => '_BoxLegendTag',
|
237
|
|
|
|
|
|
|
AllData => '_AllDataTag',
|
238
|
|
|
|
|
|
|
AllPie => '_AllPieTag',
|
239
|
|
|
|
|
|
|
Area => '_AreaTag',
|
240
|
|
|
|
|
|
|
Pie => '_PieTag',
|
241
|
|
|
|
|
|
|
PointLine => '_PointLineTag',
|
242
|
|
|
|
|
|
|
Line => '_LineTag',
|
243
|
|
|
|
|
|
|
Point => '_PointTag',
|
244
|
|
|
|
|
|
|
Bar => '_BarTag',
|
245
|
|
|
|
|
|
|
Mixed => '_MixedTag',
|
246
|
|
|
|
|
|
|
Legend => '_LegendTag',
|
247
|
|
|
|
|
|
|
DashLines => '_DashLineTag',
|
248
|
|
|
|
|
|
|
AllBars => '_AllBars',
|
249
|
|
|
|
|
|
|
BarValues => '_BarValuesTag',
|
250
|
|
|
|
|
|
|
Boxplot => '_BoxplotTag',
|
251
|
|
|
|
|
|
|
},
|
252
|
|
|
|
|
|
|
'Title' => {
|
253
|
|
|
|
|
|
|
Ctitrex => undef,
|
254
|
|
|
|
|
|
|
Ctitrey => undef,
|
255
|
|
|
|
|
|
|
IdTitre => undef,
|
256
|
|
|
|
|
|
|
'-width' => undef,
|
257
|
|
|
|
|
|
|
Width => undef,
|
258
|
|
|
|
|
|
|
Height => 40,
|
259
|
|
|
|
|
|
|
},
|
260
|
|
|
|
|
|
|
'Zoom' => {
|
261
|
|
|
|
|
|
|
CurrentX => 100,
|
262
|
|
|
|
|
|
|
CurrentY => 100,
|
263
|
|
|
|
|
|
|
},
|
264
|
|
|
|
|
|
|
'Mixed' => { DisplayOrder => [qw/ areas bars lines dashlines points /], },
|
265
|
|
|
|
|
|
|
);
|
266
|
|
|
|
|
|
|
|
267
|
0
|
|
|
|
|
|
return \%configuration;
|
268
|
|
|
|
|
|
|
}
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub _treatparameters {
|
271
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
|
|
|
my @integer_option = qw /
|
274
|
|
|
|
|
|
|
-xlabelheight -xlabelskip -xvaluespace -ylabelwidth
|
275
|
|
|
|
|
|
|
-boxaxis -noaxis -zeroaxisonly -xtickheight
|
276
|
|
|
|
|
|
|
-xtickview -yticknumber -ytickwidth -linewidth
|
277
|
|
|
|
|
|
|
-alltickview -xvaluevertical -titleheight -gridview
|
278
|
|
|
|
|
|
|
-ytickview -overwrite -cumulate -spacingbar
|
279
|
|
|
|
|
|
|
-showvalues -startangle -viewsection -zeroaxis
|
280
|
|
|
|
|
|
|
-longticks -markersize -pointline
|
281
|
|
|
|
|
|
|
-smoothline -spline -bezier
|
282
|
|
|
|
|
|
|
-interval -xlongticks -ylongticks -setlegend
|
283
|
|
|
|
|
|
|
-piesize -cumulatepercent
|
284
|
|
|
|
|
|
|
/;
|
285
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
|
foreach my $option_name (@integer_option) {
|
287
|
0
|
|
|
|
|
|
my $data = $cw->cget($option_name);
|
288
|
0
|
0
|
0
|
|
|
|
if ( ( defined $data ) and ( !_isainteger($data) ) ) {
|
289
|
0
|
|
|
|
|
|
$cw->_error( "Can't set $option_name to '$data', $data' isn't numeric", 1 );
|
290
|
0
|
|
|
|
|
|
return;
|
291
|
|
|
|
|
|
|
}
|
292
|
|
|
|
|
|
|
}
|
293
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
|
my $xvaluesregex = $cw->cget( -xvaluesregex );
|
295
|
0
|
0
|
0
|
|
|
|
if ( ( defined $xvaluesregex ) and ( ref $xvaluesregex ne 'Regexp' ) ) {
|
296
|
0
|
|
|
|
|
|
$cw->_error(
|
297
|
|
|
|
|
|
|
"Can't set -xvaluesregex to '$xvaluesregex', $xvaluesregex' is not a regex expression\nEx : -xvaluesregex => qr/my regex/;",
|
298
|
|
|
|
|
|
|
1
|
299
|
|
|
|
|
|
|
);
|
300
|
0
|
|
|
|
|
|
return;
|
301
|
|
|
|
|
|
|
}
|
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
|
my $gradient = $cw->cget( -gradient );
|
304
|
0
|
0
|
0
|
|
|
|
if ( ( defined $gradient ) and ( ref $gradient ne 'HASH' ) ) {
|
305
|
0
|
|
|
|
|
|
$cw->_error( "Can't set -gradient to '$gradient', " . "$gradient' is not a hash reference expression\n",
|
306
|
|
|
|
|
|
|
1 );
|
307
|
0
|
|
|
|
|
|
return;
|
308
|
|
|
|
|
|
|
}
|
309
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
my $colors = $cw->cget( -colordata );
|
311
|
0
|
0
|
0
|
|
|
|
if ( ( defined $colors ) and ( ref $colors ne 'ARRAY' ) ) {
|
312
|
0
|
|
|
|
|
|
$cw->_error(
|
313
|
|
|
|
|
|
|
"Can't set -colordata to '$colors', '$colors' is not an array reference\nEx : -colordata => ['blue','#2400FF',...]",
|
314
|
|
|
|
|
|
|
1
|
315
|
|
|
|
|
|
|
);
|
316
|
0
|
|
|
|
|
|
return;
|
317
|
|
|
|
|
|
|
}
|
318
|
0
|
|
|
|
|
|
my $markers = $cw->cget( -markers );
|
319
|
0
|
0
|
0
|
|
|
|
if ( ( defined $markers ) and ( ref $markers ne 'ARRAY' ) ) {
|
320
|
0
|
|
|
|
|
|
$cw->_error(
|
321
|
|
|
|
|
|
|
"Can't set -markers to '$markers', $markers' is not an array reference\nEx : -markers => [5,8,2]", 1 );
|
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
return;
|
324
|
|
|
|
|
|
|
}
|
325
|
0
|
|
|
|
|
|
my $type_mixed = $cw->cget( -typemixed );
|
326
|
0
|
0
|
0
|
|
|
|
if ( ( defined $type_mixed ) and ( ref $type_mixed ne 'ARRAY' ) ) {
|
327
|
0
|
|
|
|
|
|
$cw->_error(
|
328
|
|
|
|
|
|
|
"Can't set -typemixed to '$type_mixed', $type_mixed' is not an array reference\nEx : -typemixed => ['bars','lines',...]",
|
329
|
|
|
|
|
|
|
1
|
330
|
|
|
|
|
|
|
);
|
331
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
return;
|
333
|
|
|
|
|
|
|
}
|
334
|
|
|
|
|
|
|
|
335
|
0
|
0
|
|
|
|
|
if ( my $xtickheight = $cw->cget( -xtickheight ) ) {
|
336
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{TickHeight} = $xtickheight;
|
337
|
|
|
|
|
|
|
}
|
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
# -smoothline deprecated, use -bezier
|
340
|
0
|
0
|
|
|
|
|
if ( my $smoothline = $cw->cget( -smoothline ) ) {
|
341
|
0
|
|
|
|
|
|
$cw->configure( -bezier => $smoothline );
|
342
|
|
|
|
|
|
|
}
|
343
|
|
|
|
|
|
|
|
344
|
0
|
0
|
|
|
|
|
if ( my $xvaluespace = $cw->cget( -xvaluespace ) ) {
|
345
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{ScaleValuesHeight} = $xvaluespace;
|
346
|
|
|
|
|
|
|
}
|
347
|
|
|
|
|
|
|
|
348
|
0
|
0
|
0
|
|
|
|
if ( my $noaxis = $cw->cget( -noaxis ) and $cw->cget( -noaxis ) == 1 ) {
|
349
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{ScaleValuesHeight} = 0;
|
350
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{ScaleValuesWidth} = 0;
|
351
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{TickWidth} = 0;
|
352
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{TickHeight} = 0;
|
353
|
|
|
|
|
|
|
}
|
354
|
|
|
|
|
|
|
|
355
|
0
|
0
|
|
|
|
|
if ( my $title = $cw->cget( -title ) ) {
|
356
|
0
|
0
|
|
|
|
|
if ( my $titleheight = $cw->cget( -titleheight ) ) {
|
357
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Height} = $titleheight;
|
358
|
|
|
|
|
|
|
}
|
359
|
|
|
|
|
|
|
}
|
360
|
|
|
|
|
|
|
else {
|
361
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Height} = 0;
|
362
|
|
|
|
|
|
|
}
|
363
|
|
|
|
|
|
|
|
364
|
0
|
0
|
|
|
|
|
if ( my $xlabel = $cw->cget( -xlabel ) ) {
|
365
|
0
|
0
|
|
|
|
|
if ( my $xlabelheight = $cw->cget( -xlabelheight ) ) {
|
366
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{xlabelHeight} = $xlabelheight;
|
367
|
|
|
|
|
|
|
}
|
368
|
|
|
|
|
|
|
}
|
369
|
|
|
|
|
|
|
else {
|
370
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{xlabelHeight} = 0;
|
371
|
|
|
|
|
|
|
}
|
372
|
|
|
|
|
|
|
|
373
|
0
|
0
|
|
|
|
|
if ( my $ylabel = $cw->cget( -ylabel ) ) {
|
374
|
0
|
0
|
|
|
|
|
if ( my $ylabel_width = $cw->cget( -ylabelWidth ) ) {
|
375
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{ylabelWidth} = $ylabel_width;
|
376
|
|
|
|
|
|
|
}
|
377
|
|
|
|
|
|
|
}
|
378
|
|
|
|
|
|
|
else {
|
379
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{ylabelWidth} = 0;
|
380
|
|
|
|
|
|
|
}
|
381
|
|
|
|
|
|
|
|
382
|
0
|
0
|
|
|
|
|
if ( my $ytickwidth = $cw->cget( -ytickwidth ) ) {
|
383
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{TickWidth} = $ytickwidth;
|
384
|
|
|
|
|
|
|
}
|
385
|
|
|
|
|
|
|
|
386
|
0
|
0
|
|
|
|
|
if ( my $valuescolor = $cw->cget( -valuescolor ) ) {
|
387
|
0
|
|
|
|
|
|
$cw->configure( -xvaluecolor => $valuescolor );
|
388
|
0
|
|
|
|
|
|
$cw->configure( -yvaluecolor => $valuescolor );
|
389
|
|
|
|
|
|
|
}
|
390
|
|
|
|
|
|
|
|
391
|
0
|
0
|
|
|
|
|
if ( my $textcolor = $cw->cget( -textcolor ) ) {
|
|
|
0
|
|
|
|
|
|
392
|
0
|
|
|
|
|
|
$cw->configure( -titlecolor => $textcolor );
|
393
|
0
|
|
|
|
|
|
$cw->configure( -xlabelcolor => $textcolor );
|
394
|
0
|
|
|
|
|
|
$cw->configure( -ylabelcolor => $textcolor );
|
395
|
|
|
|
|
|
|
}
|
396
|
|
|
|
|
|
|
elsif ( my $labelscolor = $cw->cget( -labelscolor ) ) {
|
397
|
0
|
|
|
|
|
|
$cw->configure( -xlabelcolor => $labelscolor );
|
398
|
0
|
|
|
|
|
|
$cw->configure( -ylabelcolor => $labelscolor );
|
399
|
|
|
|
|
|
|
}
|
400
|
|
|
|
|
|
|
|
401
|
0
|
0
|
|
|
|
|
if ( my $textfont = $cw->cget( -textfont ) ) {
|
402
|
0
|
|
|
|
|
|
$cw->configure( -titlefont => $textfont );
|
403
|
0
|
|
|
|
|
|
$cw->configure( -xlabelfont => $textfont );
|
404
|
0
|
|
|
|
|
|
$cw->configure( -ylabelfont => $textfont );
|
405
|
|
|
|
|
|
|
}
|
406
|
0
|
0
|
|
|
|
|
if ( my $startangle = $cw->cget( -startangle ) ) {
|
407
|
0
|
0
|
0
|
|
|
|
if ( $startangle < $MIN_ANGLE or $startangle > $MAX_ANGLE ) {
|
408
|
0
|
|
|
|
|
|
$cw->configure( -startangle => 0 );
|
409
|
|
|
|
|
|
|
}
|
410
|
|
|
|
|
|
|
}
|
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=for borderwidth:
|
413
|
|
|
|
|
|
|
If user call -borderwidth option, the graph will be trunc.
|
414
|
|
|
|
|
|
|
Then we will add HeightEmptySpace and WidthEmptySpace.
|
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=cut
|
417
|
|
|
|
|
|
|
|
418
|
0
|
0
|
|
|
|
|
if ( my $borderwidth = $cw->cget( -borderwidth ) ) {
|
419
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Canvas}{HeightEmptySpace} = $borderwidth + $BORDERWITH_PLUS;
|
420
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Canvas}{WidthEmptySpace} = $borderwidth + $BORDERWITH_PLUS;
|
421
|
|
|
|
|
|
|
}
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
#update=
|
424
|
0
|
|
|
|
|
|
my $yminvalue = $cw->cget( -yminvalue );
|
425
|
0
|
0
|
0
|
|
|
|
if ( ( defined $yminvalue ) and ( !_isanumber($yminvalue) ) ) {
|
426
|
0
|
|
|
|
|
|
$cw->_error( "-yminvalue option must be a number or real number ($yminvalue)", 1 );
|
427
|
0
|
|
|
|
|
|
return;
|
428
|
|
|
|
|
|
|
}
|
429
|
0
|
|
|
|
|
|
my $ymaxvalue = $cw->cget( -ymaxvalue );
|
430
|
0
|
0
|
0
|
|
|
|
if ( ( defined $ymaxvalue ) and ( !_isanumber($ymaxvalue) ) ) {
|
431
|
0
|
|
|
|
|
|
$cw->_error( '-ymaxvalue option must be a number or real number', 1 );
|
432
|
0
|
|
|
|
|
|
return;
|
433
|
|
|
|
|
|
|
}
|
434
|
|
|
|
|
|
|
|
435
|
0
|
0
|
0
|
|
|
|
if ( defined $yminvalue and defined $ymaxvalue ) {
|
436
|
0
|
0
|
|
|
|
|
if ( $ymaxvalue <= $yminvalue ) {
|
437
|
0
|
|
|
|
|
|
$cw->_error( '-ymaxvalue must be greater than -yminvalue option', 1 );
|
438
|
0
|
|
|
|
|
|
return;
|
439
|
|
|
|
|
|
|
}
|
440
|
|
|
|
|
|
|
}
|
441
|
|
|
|
|
|
|
|
442
|
0
|
|
|
|
|
|
return 1;
|
443
|
|
|
|
|
|
|
}
|
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
sub _checksizelegend_data {
|
446
|
0
|
|
|
0
|
|
|
my ( $cw, $ref_data, $ref_legend ) = @_;
|
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
# Check legend size
|
449
|
0
|
0
|
|
|
|
|
if ( not defined $ref_legend ) {
|
450
|
0
|
|
|
|
|
|
$cw->_error('legend not defined');
|
451
|
0
|
|
|
|
|
|
return;
|
452
|
|
|
|
|
|
|
}
|
453
|
0
|
|
|
|
|
|
my $size_legend = scalar @{$ref_legend};
|
|
0
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
# Check size between legend and data
|
456
|
0
|
|
|
|
|
|
my $size_data = scalar @{$ref_data} - 1;
|
|
0
|
|
|
|
|
|
|
457
|
0
|
0
|
|
|
|
|
if ( $size_legend != $size_data ) {
|
458
|
0
|
|
|
|
|
|
$cw->_error('Legend and array size data are different');
|
459
|
0
|
|
|
|
|
|
return;
|
460
|
|
|
|
|
|
|
}
|
461
|
|
|
|
|
|
|
|
462
|
0
|
|
|
|
|
|
return 1;
|
463
|
|
|
|
|
|
|
}
|
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
sub _zoomcalcul {
|
466
|
0
|
|
|
0
|
|
|
my ( $cw, $zoomx, $zoomy ) = @_;
|
467
|
|
|
|
|
|
|
|
468
|
0
|
0
|
0
|
|
|
|
if (
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
469
|
|
|
|
|
|
|
!( ( defined $zoomx and _isanumber($zoomx) and $zoomx > 0 )
|
470
|
|
|
|
|
|
|
or ( defined $zoomy and _isanumber($zoomy) and $zoomy > 0 )
|
471
|
|
|
|
|
|
|
)
|
472
|
|
|
|
|
|
|
)
|
473
|
|
|
|
|
|
|
{
|
474
|
0
|
|
|
|
|
|
$cw->_error( 'zoom value must be defined, numeric and great than 0', 1 );
|
475
|
0
|
|
|
|
|
|
return;
|
476
|
|
|
|
|
|
|
}
|
477
|
|
|
|
|
|
|
|
478
|
0
|
|
|
|
|
|
my $current_width = $cw->{RefChart}->{Canvas}{Width};
|
479
|
0
|
|
|
|
|
|
my $current_height = $cw->{RefChart}->{Canvas}{Height};
|
480
|
|
|
|
|
|
|
|
481
|
0
|
|
|
|
|
|
my ( $new_width, $new_height );
|
482
|
0
|
|
|
|
|
|
my $cent_percent_width = ( $PERCENT / $cw->{RefChart}->{Zoom}{CurrentX} ) * $current_width;
|
483
|
0
|
|
|
|
|
|
my $cent_percent_height = ( $PERCENT / $cw->{RefChart}->{Zoom}{CurrentY} ) * $current_height;
|
484
|
0
|
0
|
|
|
|
|
if ( defined $zoomx ) { $new_width = ( $zoomx / $PERCENT ) * $cent_percent_width; }
|
|
0
|
|
|
|
|
|
|
485
|
0
|
0
|
|
|
|
|
if ( defined $zoomy ) { $new_height = ( $zoomy / $PERCENT ) * $cent_percent_height; }
|
|
0
|
|
|
|
|
|
|
486
|
0
|
0
|
|
|
|
|
if ( defined $zoomx ) { $cw->{RefChart}->{Zoom}{CurrentX} = $zoomx; }
|
|
0
|
|
|
|
|
|
|
487
|
0
|
0
|
|
|
|
|
if ( defined $zoomy ) { $cw->{RefChart}->{Zoom}{CurrentY} = $zoomy; }
|
|
0
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
|
489
|
0
|
|
|
|
|
|
return ( $new_width, $new_height );
|
490
|
|
|
|
|
|
|
}
|
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
sub _destroyballoon_bind {
|
493
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
# balloon defined and user want to stop it
|
496
|
0
|
0
|
0
|
|
|
|
if ( $cw->{RefChart}->{Balloon}{Obj}
|
497
|
|
|
|
|
|
|
and Tk::Exists $cw->{RefChart}->{Balloon}{Obj} )
|
498
|
|
|
|
|
|
|
{
|
499
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Balloon}{Obj}->configure( -state => 'none' );
|
500
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Balloon}{Obj}->detach($cw);
|
501
|
0
|
|
|
|
|
|
undef $cw->{RefChart}->{Balloon}{Obj};
|
502
|
|
|
|
|
|
|
}
|
503
|
|
|
|
|
|
|
|
504
|
0
|
|
|
|
|
|
return;
|
505
|
|
|
|
|
|
|
}
|
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub _error {
|
508
|
0
|
|
|
0
|
|
|
my ( $cw, $error_message, $croak ) = @_;
|
509
|
|
|
|
|
|
|
|
510
|
0
|
|
|
|
|
|
my $verbose = $cw->cget( -verbose );
|
511
|
0
|
0
|
0
|
|
|
|
if ( defined $croak and $croak == 1 ) {
|
512
|
0
|
|
|
|
|
|
croak "[BE CARREFUL] : $error_message\n";
|
513
|
|
|
|
|
|
|
}
|
514
|
|
|
|
|
|
|
else {
|
515
|
0
|
0
|
0
|
|
|
|
carp "[WARNING] : $error_message\n" if ( defined $verbose and $verbose == 1 );
|
516
|
|
|
|
|
|
|
}
|
517
|
|
|
|
|
|
|
|
518
|
0
|
|
|
|
|
|
return;
|
519
|
|
|
|
|
|
|
}
|
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
sub _getmarkertype {
|
522
|
0
|
|
|
0
|
|
|
my ( $cw, $number ) = @_;
|
523
|
0
|
|
|
|
|
|
my %marker_type = (
|
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
# Num Type Filled
|
526
|
|
|
|
|
|
|
'1' => [ 'square', '1' ],
|
527
|
|
|
|
|
|
|
'2' => [ 'square', '0' ],
|
528
|
|
|
|
|
|
|
'3' => [ 'horizontal cross', '1' ],
|
529
|
|
|
|
|
|
|
'4' => [ 'diagonal cross', '1' ],
|
530
|
|
|
|
|
|
|
'5' => [ 'diamond', '1' ],
|
531
|
|
|
|
|
|
|
'6' => [ 'diamond', '0' ],
|
532
|
|
|
|
|
|
|
'7' => [ 'circle', '1' ],
|
533
|
|
|
|
|
|
|
'8' => [ 'circle', '0' ],
|
534
|
|
|
|
|
|
|
'9' => [ 'horizontal line', '1' ],
|
535
|
|
|
|
|
|
|
'10' => [ 'vertical line', '1' ],
|
536
|
|
|
|
|
|
|
);
|
537
|
|
|
|
|
|
|
|
538
|
0
|
0
|
|
|
|
|
if ( !$marker_type{$number} ) { return; }
|
|
0
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
|
540
|
0
|
|
|
|
|
|
return $marker_type{$number};
|
541
|
|
|
|
|
|
|
}
|
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=for _createtype
|
544
|
|
|
|
|
|
|
Calculate different points coord to create a rectangle, circle,
|
545
|
|
|
|
|
|
|
verticale or horizontal line, a cross, a plus and a diamond
|
546
|
|
|
|
|
|
|
from a point coord.
|
547
|
|
|
|
|
|
|
Arg : Reference of hash
|
548
|
|
|
|
|
|
|
{
|
549
|
|
|
|
|
|
|
x => value,
|
550
|
|
|
|
|
|
|
y => value,
|
551
|
|
|
|
|
|
|
pixel => value,
|
552
|
|
|
|
|
|
|
type => string, (circle, cross, plus, diamond, rectangle, Vline, Hline )
|
553
|
|
|
|
|
|
|
option => Hash reference ( {-fill => xxx, -outline => yy, ...} )
|
554
|
|
|
|
|
|
|
}
|
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=cut
|
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
sub _createtype {
|
559
|
0
|
|
|
0
|
|
|
my ( $cw, %ref_coord ) = @_;
|
560
|
|
|
|
|
|
|
|
561
|
0
|
0
|
0
|
|
|
|
if ( $ref_coord{type} eq 'circle' or $ref_coord{type} eq 'square' ) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
562
|
0
|
|
|
|
|
|
my $x1 = $ref_coord{x} - ( $ref_coord{pixel} / 2 );
|
563
|
0
|
|
|
|
|
|
my $y1 = $ref_coord{y} + ( $ref_coord{pixel} / 2 );
|
564
|
0
|
|
|
|
|
|
my $x2 = $ref_coord{x} + ( $ref_coord{pixel} / 2 );
|
565
|
0
|
|
|
|
|
|
my $y2 = $ref_coord{y} - ( $ref_coord{pixel} / 2 );
|
566
|
|
|
|
|
|
|
|
567
|
0
|
0
|
|
|
|
|
if ( $ref_coord{type} eq 'circle' ) {
|
568
|
0
|
|
|
|
|
|
$cw->createOval( $x1, $y1, $x2, $y2, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
}
|
570
|
|
|
|
|
|
|
else {
|
571
|
0
|
|
|
|
|
|
$cw->createRectangle( $x1, $y1, $x2, $y2, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
}
|
573
|
|
|
|
|
|
|
}
|
574
|
|
|
|
|
|
|
elsif ( $ref_coord{type} eq 'horizontal cross' ) {
|
575
|
0
|
|
|
|
|
|
my $x1 = $ref_coord{x};
|
576
|
0
|
|
|
|
|
|
my $y1 = $ref_coord{y} - ( $ref_coord{pixel} / 2 );
|
577
|
0
|
|
|
|
|
|
my $x2 = $x1;
|
578
|
0
|
|
|
|
|
|
my $y2 = $ref_coord{y} + ( $ref_coord{pixel} / 2 );
|
579
|
0
|
|
|
|
|
|
my $x3 = $ref_coord{x} - ( $ref_coord{pixel} / 2 );
|
580
|
0
|
|
|
|
|
|
my $y3 = $ref_coord{y};
|
581
|
0
|
|
|
|
|
|
my $x4 = $ref_coord{x} + ( $ref_coord{pixel} / 2 );
|
582
|
0
|
|
|
|
|
|
my $y4 = $y3;
|
583
|
0
|
|
|
|
|
|
$cw->createLine( $x1, $y1, $x2, $y2, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
584
|
0
|
|
|
|
|
|
$cw->createLine( $x3, $y3, $x4, $y4, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
}
|
586
|
|
|
|
|
|
|
elsif ( $ref_coord{type} eq 'diagonal cross' ) {
|
587
|
0
|
|
|
|
|
|
my $x1 = $ref_coord{x} - ( $ref_coord{pixel} / 2 );
|
588
|
0
|
|
|
|
|
|
my $y1 = $ref_coord{y} + ( $ref_coord{pixel} / 2 );
|
589
|
0
|
|
|
|
|
|
my $x2 = $ref_coord{x} + ( $ref_coord{pixel} / 2 );
|
590
|
0
|
|
|
|
|
|
my $y2 = $ref_coord{y} - ( $ref_coord{pixel} / 2 );
|
591
|
0
|
|
|
|
|
|
my $x3 = $x1;
|
592
|
0
|
|
|
|
|
|
my $y3 = $y2;
|
593
|
0
|
|
|
|
|
|
my $x4 = $x2;
|
594
|
0
|
|
|
|
|
|
my $y4 = $y1;
|
595
|
0
|
|
|
|
|
|
$cw->createLine( $x1, $y1, $x2, $y2, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
596
|
0
|
|
|
|
|
|
$cw->createLine( $x3, $y3, $x4, $y4, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
}
|
598
|
|
|
|
|
|
|
elsif ( $ref_coord{type} eq 'diamond' ) {
|
599
|
0
|
|
|
|
|
|
my $x1 = $ref_coord{x} - ( $ref_coord{pixel} / 2 );
|
600
|
0
|
|
|
|
|
|
my $y1 = $ref_coord{y};
|
601
|
0
|
|
|
|
|
|
my $x2 = $ref_coord{x};
|
602
|
0
|
|
|
|
|
|
my $y2 = $ref_coord{y} + ( $ref_coord{pixel} / 2 );
|
603
|
0
|
|
|
|
|
|
my $x3 = $ref_coord{x} + ( $ref_coord{pixel} / 2 );
|
604
|
0
|
|
|
|
|
|
my $y3 = $ref_coord{y};
|
605
|
0
|
|
|
|
|
|
my $x4 = $ref_coord{x};
|
606
|
0
|
|
|
|
|
|
my $y4 = $ref_coord{y} - ( $ref_coord{pixel} / 2 );
|
607
|
0
|
|
|
|
|
|
$cw->createPolygon( $x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
}
|
609
|
|
|
|
|
|
|
elsif ( $ref_coord{type} eq 'vertical line' ) {
|
610
|
0
|
|
|
|
|
|
my $x1 = $ref_coord{x};
|
611
|
0
|
|
|
|
|
|
my $y1 = $ref_coord{y} - ( $ref_coord{pixel} / 2 );
|
612
|
0
|
|
|
|
|
|
my $x2 = $ref_coord{x};
|
613
|
0
|
|
|
|
|
|
my $y2 = $ref_coord{y} + ( $ref_coord{pixel} / 2 );
|
614
|
0
|
|
|
|
|
|
$cw->createLine( $x1, $y1, $x2, $y2, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
}
|
616
|
|
|
|
|
|
|
elsif ( $ref_coord{type} eq 'horizontal line' ) {
|
617
|
0
|
|
|
|
|
|
my $x1 = $ref_coord{x} - ( $ref_coord{pixel} / 2 );
|
618
|
0
|
|
|
|
|
|
my $y1 = $ref_coord{y};
|
619
|
0
|
|
|
|
|
|
my $x2 = $ref_coord{x} + ( $ref_coord{pixel} / 2 );
|
620
|
0
|
|
|
|
|
|
my $y2 = $ref_coord{y};
|
621
|
0
|
|
|
|
|
|
$cw->createLine( $x1, $y1, $x2, $y2, %{ $ref_coord{option} } );
|
|
0
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
}
|
623
|
|
|
|
|
|
|
else {
|
624
|
0
|
|
|
|
|
|
return;
|
625
|
|
|
|
|
|
|
}
|
626
|
|
|
|
|
|
|
|
627
|
0
|
|
|
|
|
|
return 1;
|
628
|
|
|
|
|
|
|
}
|
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=for _display_line
|
631
|
|
|
|
|
|
|
Dispay point
|
632
|
|
|
|
|
|
|
Arg : Reference of hash
|
633
|
|
|
|
|
|
|
{
|
634
|
|
|
|
|
|
|
x => value,
|
635
|
|
|
|
|
|
|
y => value,
|
636
|
|
|
|
|
|
|
pixel => value,
|
637
|
|
|
|
|
|
|
type => string, (circle, cross, plus, diamond, rectangle, Vline, Hline )
|
638
|
|
|
|
|
|
|
option => Hash reference ( {-fill => xxx, -outline => yy, ...} )
|
639
|
|
|
|
|
|
|
}
|
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=cut
|
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
# $cw->_display_line($ref_points, $line_number);
|
644
|
|
|
|
|
|
|
sub _display_line {
|
645
|
0
|
|
|
0
|
|
|
my ( $cw, $ref_points, $line_number ) = @_;
|
646
|
|
|
|
|
|
|
|
647
|
0
|
|
|
|
|
|
my $ref_data_to_display = $cw->{RefChart}->{Data}{RefDataToDisplay};
|
648
|
0
|
0
|
0
|
|
|
|
if ( !( defined $ref_data_to_display and defined $ref_data_to_display->[$line_number] ) ) { return; }
|
|
0
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
|
650
|
0
|
|
|
|
|
|
my %options;
|
651
|
0
|
|
|
|
|
|
my $font = $cw->{RefChart}->{Data}{RefOptionDataToDisplay}{'-font'};
|
652
|
0
|
|
|
|
|
|
my $color = $cw->{RefChart}->{Data}{RefOptionDataToDisplay}{'-foreground'};
|
653
|
0
|
0
|
|
|
|
|
if ( defined $font ) { $options{'-font'} = $font; }
|
|
0
|
|
|
|
|
|
|
654
|
0
|
0
|
|
|
|
|
if ( defined $color ) { $options{'-fill'} = $color; }
|
|
0
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
|
656
|
0
|
|
|
|
|
|
my $indice_point = 0;
|
657
|
|
|
|
|
|
|
|
658
|
0
|
|
|
|
|
|
DISPLAY:
|
659
|
0
|
|
|
|
|
|
foreach my $value ( @{ $ref_data_to_display->[$line_number] } ) {
|
660
|
0
|
0
|
|
|
|
|
if ( defined $value ) {
|
661
|
0
|
|
|
|
|
|
my $x = $ref_points->[$indice_point];
|
662
|
0
|
|
|
|
|
|
$indice_point++;
|
663
|
0
|
|
|
|
|
|
my $y = $ref_points->[$indice_point] - 10;
|
664
|
0
|
|
|
|
|
|
$cw->createText(
|
665
|
|
|
|
|
|
|
$x, $y,
|
666
|
|
|
|
|
|
|
-text => $value,
|
667
|
|
|
|
|
|
|
%options,
|
668
|
|
|
|
|
|
|
);
|
669
|
0
|
|
|
|
|
|
$indice_point++;
|
670
|
0
|
0
|
|
|
|
|
last DISPLAY if ( not defined $ref_points->[$indice_point] );
|
671
|
0
|
|
|
|
|
|
next DISPLAY;
|
672
|
|
|
|
|
|
|
}
|
673
|
0
|
|
|
|
|
|
$indice_point += 2;
|
674
|
|
|
|
|
|
|
}
|
675
|
|
|
|
|
|
|
|
676
|
0
|
|
|
|
|
|
return;
|
677
|
|
|
|
|
|
|
}
|
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
sub _box {
|
680
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
681
|
|
|
|
|
|
|
|
682
|
0
|
|
|
|
|
|
my $axiscolor = $cw->cget( -axiscolor );
|
683
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -boxaxis ) == 0 ) {
|
684
|
0
|
|
|
|
|
|
return;
|
685
|
|
|
|
|
|
|
}
|
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
# close axis
|
688
|
|
|
|
|
|
|
# X axis 2
|
689
|
|
|
|
|
|
|
$cw->createLine(
|
690
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CxMin},
|
691
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMax},
|
692
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CxMax},
|
693
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMax},
|
694
|
|
|
|
|
|
|
-tags => [
|
695
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{BoxAxis}, $cw->{RefChart}->{TAGS}{AllAXIS},
|
696
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
697
|
|
|
|
|
|
|
],
|
698
|
|
|
|
|
|
|
-fill => $axiscolor,
|
699
|
|
|
|
|
|
|
);
|
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
# Y axis 2
|
702
|
0
|
|
|
|
|
|
$cw->createLine(
|
703
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CxMax},
|
704
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMin},
|
705
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CxMax},
|
706
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMax},
|
707
|
|
|
|
|
|
|
-tags => [
|
708
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{BoxAxis}, $cw->{RefChart}->{TAGS}{AllAXIS},
|
709
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
710
|
|
|
|
|
|
|
],
|
711
|
|
|
|
|
|
|
-fill => $axiscolor,
|
712
|
|
|
|
|
|
|
);
|
713
|
|
|
|
|
|
|
|
714
|
0
|
|
|
|
|
|
return;
|
715
|
|
|
|
|
|
|
}
|
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
sub _display_xticks {
|
718
|
0
|
|
|
0
|
|
|
my ( $cw, $x_tickx1, $x_ticky1, $x_tickx2, $x_ticky2 ) = @_;
|
719
|
|
|
|
|
|
|
|
720
|
0
|
|
|
|
|
|
my $longticks = $cw->cget( -longticks );
|
721
|
0
|
|
|
|
|
|
my $xlongticks = $cw->cget( -xlongticks );
|
722
|
0
|
|
|
|
|
|
my $xlongtickscolor = $cw->cget( -xlongtickscolor );
|
723
|
0
|
|
|
|
|
|
my $longtickscolor = $cw->cget( -longtickscolor );
|
724
|
0
|
|
|
|
|
|
my $axiscolor = $cw->cget( -axiscolor );
|
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
# Only short xticks
|
727
|
0
|
|
|
|
|
|
$cw->createLine(
|
728
|
|
|
|
|
|
|
$x_tickx1,
|
729
|
|
|
|
|
|
|
$x_ticky1,
|
730
|
|
|
|
|
|
|
$x_tickx2,
|
731
|
|
|
|
|
|
|
$x_ticky2,
|
732
|
|
|
|
|
|
|
-tags => [
|
733
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{xTick}, $cw->{RefChart}->{TAGS}{AllTick},
|
734
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
735
|
|
|
|
|
|
|
],
|
736
|
|
|
|
|
|
|
-fill => $axiscolor,
|
737
|
|
|
|
|
|
|
);
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
# Long xTicks
|
740
|
0
|
0
|
0
|
|
|
|
if ( ( defined $longticks and $longticks == 1 ) or ( defined $xlongticks and $xlongticks == 1 ) ) {
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
741
|
0
|
|
|
|
|
|
$x_ticky1 = $cw->{RefChart}->{Axis}{CyMax};
|
742
|
0
|
|
|
|
|
|
$x_ticky2 = $cw->{RefChart}->{Axis}{CyMin};
|
743
|
0
|
|
0
|
|
|
|
$cw->createLine(
|
744
|
|
|
|
|
|
|
$x_tickx1,
|
745
|
|
|
|
|
|
|
$x_ticky1,
|
746
|
|
|
|
|
|
|
$x_tickx2,
|
747
|
|
|
|
|
|
|
$x_ticky2,
|
748
|
|
|
|
|
|
|
-tags => [
|
749
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{xTick}, $cw->{RefChart}->{TAGS}{AllTick},
|
750
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
751
|
|
|
|
|
|
|
],
|
752
|
|
|
|
|
|
|
-fill => $longtickscolor || $xlongtickscolor,
|
753
|
|
|
|
|
|
|
-dash => $DASH,
|
754
|
|
|
|
|
|
|
);
|
755
|
|
|
|
|
|
|
}
|
756
|
|
|
|
|
|
|
|
757
|
0
|
|
|
|
|
|
return 1;
|
758
|
|
|
|
|
|
|
}
|
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
sub _display_yticks {
|
761
|
0
|
|
|
0
|
|
|
my ( $cw, $y_tickx1, $y_ticky1, $y_tickx2, $y_ticky2 ) = @_;
|
762
|
|
|
|
|
|
|
|
763
|
0
|
|
|
|
|
|
my $longticks = $cw->cget( -longticks );
|
764
|
0
|
|
|
|
|
|
my $ylongticks = $cw->cget( -ylongticks );
|
765
|
0
|
|
|
|
|
|
my $ylongtickscolor = $cw->cget( -ylongtickscolor );
|
766
|
0
|
|
|
|
|
|
my $longtickscolor = $cw->cget( -longtickscolor );
|
767
|
0
|
|
|
|
|
|
my $axiscolor = $cw->cget( -axiscolor );
|
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
# Only short yticks
|
770
|
0
|
|
|
|
|
|
$cw->createLine(
|
771
|
|
|
|
|
|
|
$y_tickx1,
|
772
|
|
|
|
|
|
|
$y_ticky1,
|
773
|
|
|
|
|
|
|
$y_tickx2,
|
774
|
|
|
|
|
|
|
$y_ticky2,
|
775
|
|
|
|
|
|
|
-tags => [
|
776
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{yTick}, $cw->{RefChart}->{TAGS}{AllTick},
|
777
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
778
|
|
|
|
|
|
|
],
|
779
|
|
|
|
|
|
|
-fill => $axiscolor,
|
780
|
|
|
|
|
|
|
);
|
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
# Long yTicks
|
783
|
0
|
0
|
0
|
|
|
|
if ( ( defined $longticks and $longticks == 1 ) or ( defined $ylongticks and $ylongticks == 1 ) ) {
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
784
|
0
|
|
|
|
|
|
$y_tickx1 = $cw->{RefChart}->{Axis}{CxMin};
|
785
|
0
|
|
|
|
|
|
$y_tickx2 = $cw->{RefChart}->{Axis}{CxMax};
|
786
|
0
|
|
0
|
|
|
|
$cw->createLine(
|
787
|
|
|
|
|
|
|
$y_tickx1,
|
788
|
|
|
|
|
|
|
$y_ticky1,
|
789
|
|
|
|
|
|
|
$y_tickx2,
|
790
|
|
|
|
|
|
|
$y_ticky2,
|
791
|
|
|
|
|
|
|
-tags => [
|
792
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{yTick}, $cw->{RefChart}->{TAGS}{AllTick},
|
793
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
794
|
|
|
|
|
|
|
],
|
795
|
|
|
|
|
|
|
-fill => $longtickscolor || $ylongtickscolor,
|
796
|
|
|
|
|
|
|
-dash => $DASH,
|
797
|
|
|
|
|
|
|
);
|
798
|
|
|
|
|
|
|
}
|
799
|
|
|
|
|
|
|
|
800
|
0
|
|
|
|
|
|
return 1;
|
801
|
|
|
|
|
|
|
}
|
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
sub _ytick {
|
804
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
805
|
|
|
|
|
|
|
|
806
|
0
|
|
|
|
|
|
my $yminvalue = $cw->cget( -yminvalue );
|
807
|
0
|
|
|
|
|
|
my $longticks = $cw->cget( -longticks );
|
808
|
0
|
|
|
|
|
|
my $yvaluefont = $cw->cget( -yvaluefont );
|
809
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{TickNumber} = $cw->cget( -yticknumber );
|
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
# space between y ticks
|
812
|
0
|
|
|
|
|
|
my $space = $cw->{RefChart}->{Axis}{Yaxis}{Height} / $cw->{RefChart}->{Axis}{Yaxis}{TickNumber};
|
813
|
0
|
|
|
|
|
|
my $unit_value = ( $cw->{RefChart}->{Data}{MaxYValue} - $cw->{RefChart}->{Data}{MinYValue} )
|
814
|
|
|
|
|
|
|
/ $cw->{RefChart}->{Axis}{Yaxis}{TickNumber};
|
815
|
|
|
|
|
|
|
|
816
|
0
|
|
|
|
|
|
for my $tick_number ( 1 .. $cw->{RefChart}->{Axis}{Yaxis}{TickNumber} ) {
|
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
# Display y ticks
|
819
|
0
|
|
|
|
|
|
my $y_tickx1 = $cw->{RefChart}->{Axis}{Cx0};
|
820
|
0
|
|
|
|
|
|
my $y_ticky1 = $cw->{RefChart}->{Axis}{CyMin} - ( $tick_number * $space );
|
821
|
0
|
|
|
|
|
|
my $y_tickx2 = $cw->{RefChart}->{Axis}{Cx0} - $cw->{RefChart}->{Axis}{Yaxis}{TickWidth};
|
822
|
0
|
|
|
|
|
|
my $y_ticky2 = $cw->{RefChart}->{Axis}{CyMin} - ( $tick_number * $space );
|
823
|
|
|
|
|
|
|
|
824
|
0
|
|
|
|
|
|
my $y_valuex = $cw->{RefChart}->{Axis}{Cx0}
|
825
|
|
|
|
|
|
|
- ( $cw->{RefChart}->{Axis}{Yaxis}{TickWidth} + $cw->{RefChart}->{Axis}{Yaxis}{ScaleValuesWidth} / 2 );
|
826
|
0
|
|
|
|
|
|
my $y_valuey = $y_ticky1;
|
827
|
0
|
|
|
|
|
|
my $value = $unit_value * $tick_number + $cw->{RefChart}->{Data}{MinYValue};
|
828
|
0
|
0
|
|
|
|
|
next if ( $value == 0 );
|
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
# round value if to long
|
831
|
0
|
|
|
|
|
|
$value = _roundvalue($value);
|
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
# Display yticks short or long
|
834
|
0
|
|
|
|
|
|
$cw->_display_yticks( $y_tickx1, $y_ticky1, $y_tickx2, $y_ticky2 );
|
835
|
|
|
|
|
|
|
|
836
|
0
|
|
|
|
|
|
$cw->createText(
|
837
|
|
|
|
|
|
|
$y_valuex,
|
838
|
|
|
|
|
|
|
$y_valuey,
|
839
|
|
|
|
|
|
|
-text => $value,
|
840
|
|
|
|
|
|
|
-fill => $cw->cget( -yvaluecolor ),
|
841
|
|
|
|
|
|
|
-font => $yvaluefont,
|
842
|
|
|
|
|
|
|
-tags => [
|
843
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{yValues}, $cw->{RefChart}->{TAGS}{AllValues},
|
844
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
845
|
|
|
|
|
|
|
],
|
846
|
|
|
|
|
|
|
);
|
847
|
|
|
|
|
|
|
}
|
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
# Display 0 value or not
|
850
|
0
|
0
|
0
|
|
|
|
if (
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
851
|
|
|
|
|
|
|
!( $cw->{RefChart}->{Data}{MinYValue} == 0
|
852
|
|
|
|
|
|
|
or ( defined $yminvalue and $yminvalue > 0 )
|
853
|
|
|
|
|
|
|
or ( $cw->{RefChart}->{Data}{MinYValue} > 0 )
|
854
|
|
|
|
|
|
|
)
|
855
|
|
|
|
|
|
|
)
|
856
|
|
|
|
|
|
|
{
|
857
|
0
|
|
|
|
|
|
$cw->createText(
|
858
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Cx0} - ( $cw->{RefChart}->{Axis}{Yaxis}{TickWidth} ),
|
859
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Cy0},
|
860
|
|
|
|
|
|
|
-text => 0,
|
861
|
|
|
|
|
|
|
-font => $yvaluefont,
|
862
|
|
|
|
|
|
|
-tags => [
|
863
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{xValue0}, $cw->{RefChart}->{TAGS}{AllValues},
|
864
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
865
|
|
|
|
|
|
|
],
|
866
|
|
|
|
|
|
|
);
|
867
|
|
|
|
|
|
|
}
|
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
# Display the minimale value
|
870
|
|
|
|
|
|
|
$cw->createText(
|
871
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CxMin}
|
872
|
|
|
|
|
|
|
- ( $cw->{RefChart}->{Axis}{Yaxis}{TickWidth} + $cw->{RefChart}->{Axis}{Yaxis}{ScaleValuesWidth} / 2 ),
|
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMin},
|
875
|
|
|
|
|
|
|
-text => _roundvalue( $cw->{RefChart}->{Data}{MinYValue} ),
|
876
|
|
|
|
|
|
|
-fill => $cw->cget( -yvaluecolor ),
|
877
|
|
|
|
|
|
|
-font => $yvaluefont,
|
878
|
|
|
|
|
|
|
-tags => [
|
879
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{yValues}, $cw->{RefChart}->{TAGS}{AllValues},
|
880
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
881
|
|
|
|
|
|
|
],
|
882
|
|
|
|
|
|
|
);
|
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
# Long tick
|
885
|
0
|
0
|
0
|
|
|
|
if ( ( not defined $longticks ) or ( $longticks != 1 ) ) {
|
886
|
0
|
|
|
|
|
|
$cw->createLine(
|
887
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Cx0},
|
888
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMin} - $space,
|
889
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Cx0} - $cw->{RefChart}->{Axis}{Yaxis}{TickWidth},
|
890
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{CyMin} - $space,
|
891
|
|
|
|
|
|
|
-tags => [
|
892
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{yTick}, $cw->{RefChart}->{TAGS}{AllTick},
|
893
|
|
|
|
|
|
|
$cw->{RefChart}->{TAGS}{AllTagsChart},
|
894
|
|
|
|
|
|
|
],
|
895
|
|
|
|
|
|
|
);
|
896
|
|
|
|
|
|
|
}
|
897
|
|
|
|
|
|
|
|
898
|
0
|
|
|
|
|
|
return;
|
899
|
|
|
|
|
|
|
}
|
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
sub _title {
|
902
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
903
|
|
|
|
|
|
|
|
904
|
0
|
|
|
|
|
|
my $title = $cw->cget( -title );
|
905
|
0
|
|
|
|
|
|
my $title_color = $cw->cget( -titlecolor );
|
906
|
0
|
|
|
|
|
|
my $title_font = $cw->cget( -titlefont );
|
907
|
0
|
|
|
|
|
|
my $titleposition = $cw->cget( -titleposition );
|
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
# Title verification
|
910
|
0
|
0
|
|
|
|
|
if ( !$title ) { return; }
|
|
0
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
# Space before the title
|
913
|
0
|
|
|
|
|
|
my $width_empty_before_title
|
914
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{WidthEmptySpace}
|
915
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{ylabelWidth}
|
916
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{ScaleValuesWidth}
|
917
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{TickWidth};
|
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
# Coordinates title
|
920
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrex}
|
921
|
|
|
|
|
|
|
= ( $cw->{RefChart}->{Axis}{Xaxis}{Width} / 2 ) + $width_empty_before_title;
|
922
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrey}
|
923
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{HeightEmptySpace} + ( $cw->{RefChart}->{Title}{Height} / 2 );
|
924
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
# -width to createText
|
926
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{'-width'} = $cw->{RefChart}->{Axis}{Xaxis}{Width};
|
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
# display title
|
929
|
0
|
|
|
|
|
|
my $anchor;
|
930
|
0
|
0
|
|
|
|
|
if ( $titleposition eq 'left' ) {
|
|
|
0
|
|
|
|
|
|
931
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrex} = $width_empty_before_title;
|
932
|
0
|
|
|
|
|
|
$anchor = 'nw';
|
933
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{'-width'} = 0;
|
934
|
|
|
|
|
|
|
}
|
935
|
|
|
|
|
|
|
elsif ( $titleposition eq 'right' ) {
|
936
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrex} = $width_empty_before_title + $cw->{RefChart}->{Axis}{Xaxis}{Width};
|
937
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{'-width'} = 0;
|
938
|
0
|
|
|
|
|
|
$anchor = 'ne';
|
939
|
|
|
|
|
|
|
}
|
940
|
|
|
|
|
|
|
else {
|
941
|
0
|
|
|
|
|
|
$anchor = 'center';
|
942
|
|
|
|
|
|
|
}
|
943
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{IdTitre} = $cw->createText(
|
944
|
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrex},
|
945
|
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrey},
|
946
|
|
|
|
|
|
|
-text => $title,
|
947
|
|
|
|
|
|
|
-width => $cw->{RefChart}->{Title}{'-width'},
|
948
|
|
|
|
|
|
|
-anchor => $anchor,
|
949
|
|
|
|
|
|
|
-tags => [ $cw->{RefChart}->{TAGS}{AllTagsChart}, ],
|
950
|
|
|
|
|
|
|
);
|
951
|
0
|
0
|
0
|
|
|
|
if ( $anchor eq 'left' and $anchor eq 'right' ) { return; }
|
|
0
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
# get title information
|
954
|
0
|
|
|
|
|
|
my ($height);
|
955
|
0
|
|
|
|
|
|
( $cw->{RefChart}->{Title}{Ctitrex},
|
956
|
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrey},
|
957
|
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Width}, $height
|
958
|
|
|
|
|
|
|
) = $cw->bbox( $cw->{RefChart}->{Title}{IdTitre} );
|
959
|
|
|
|
|
|
|
|
960
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Title}{Ctitrey} < $cw->{RefChart}->{Canvas}{HeightEmptySpace} ) {
|
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
# cut title
|
963
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{Title}{IdTitre} );
|
964
|
|
|
|
|
|
|
|
965
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrex} = $width_empty_before_title;
|
966
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrey}
|
967
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{HeightEmptySpace} + ( $cw->{RefChart}->{Title}{Height} / 2 );
|
968
|
|
|
|
|
|
|
|
969
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{'-width'} = 0;
|
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
# display title
|
972
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{IdTitre} = $cw->createText(
|
973
|
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrex},
|
974
|
|
|
|
|
|
|
$cw->{RefChart}->{Title}{Ctitrey},
|
975
|
|
|
|
|
|
|
-text => $title,
|
976
|
|
|
|
|
|
|
-width => $cw->{RefChart}->{Title}{'-width'},
|
977
|
|
|
|
|
|
|
-anchor => 'nw',
|
978
|
|
|
|
|
|
|
-tags => [ $cw->{RefChart}->{TAGS}{AllTagsChart}, ],
|
979
|
|
|
|
|
|
|
);
|
980
|
|
|
|
|
|
|
}
|
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
$cw->itemconfigure(
|
983
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Title}{IdTitre},
|
984
|
|
|
|
|
|
|
-font => $title_font,
|
985
|
|
|
|
|
|
|
-fill => $title_color,
|
986
|
|
|
|
|
|
|
);
|
987
|
0
|
|
|
|
|
|
return;
|
988
|
|
|
|
|
|
|
}
|
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
sub _xlabelposition {
|
991
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
992
|
|
|
|
|
|
|
|
993
|
0
|
|
|
|
|
|
my $xlabel = $cw->cget( -xlabel );
|
994
|
|
|
|
|
|
|
|
995
|
|
|
|
|
|
|
# no x_label
|
996
|
0
|
0
|
|
|
|
|
if ( not defined $xlabel ) { return; }
|
|
0
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
# coordinate (CxlabelX, CxlabelY)
|
999
|
0
|
|
|
|
|
|
my $before_xlabel_x
|
1000
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{WidthEmptySpace}
|
1001
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{ylabelWidth}
|
1002
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{ScaleValuesWidth}
|
1003
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{TickWidth};
|
1004
|
0
|
|
|
|
|
|
my $before_xlabel_y
|
1005
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{HeightEmptySpace}
|
1006
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Title}{Height}
|
1007
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Yaxis}{Height}
|
1008
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Xaxis}{TickHeight}
|
1009
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Axis}{Xaxis}{ScaleValuesHeight};
|
1010
|
|
|
|
|
|
|
|
1011
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelX} = $before_xlabel_x + ( $cw->{RefChart}->{Axis}{Xaxis}{Width} / 2 );
|
1012
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelY}
|
1013
|
|
|
|
|
|
|
= $before_xlabel_y + ( $cw->{RefChart}->{Axis}{Xaxis}{xlabelHeight} / 2 );
|
1014
|
|
|
|
|
|
|
|
1015
|
|
|
|
|
|
|
# display xlabel
|
1016
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{Idxlabel} = $cw->createText(
|
1017
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelX},
|
1018
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelY},
|
1019
|
|
|
|
|
|
|
-text => $xlabel,
|
1020
|
|
|
|
|
|
|
-width => $cw->{RefChart}->{Axis}{Xaxis}{Width},
|
1021
|
|
|
|
|
|
|
-tags => [ $cw->{RefChart}->{TAGS}{AllTagsChart}, ],
|
1022
|
|
|
|
|
|
|
);
|
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
# get info ylabel xlabel
|
1025
|
0
|
|
|
|
|
|
my ( $width, $height );
|
1026
|
0
|
|
|
|
|
|
( $cw->{RefChart}->{Axis}{Xaxis}{CxlabelX}, $cw->{RefChart}->{Axis}{Xaxis}{CxlabelY}, $width, $height )
|
1027
|
|
|
|
|
|
|
= $cw->bbox( $cw->{RefChart}->{Axis}{Xaxis}{Idxlabel} );
|
1028
|
|
|
|
|
|
|
|
1029
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Axis}{Xaxis}{CxlabelY} < $before_xlabel_y ) {
|
1030
|
|
|
|
|
|
|
|
1031
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{Axis}{Xaxis}{Idxlabel} );
|
1032
|
|
|
|
|
|
|
|
1033
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelX} = $before_xlabel_x;
|
1034
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelY}
|
1035
|
|
|
|
|
|
|
= $before_xlabel_y + ( $cw->{RefChart}->{Axis}{Xaxis}{xlabelHeight} / 2 );
|
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
# display xlabel
|
1038
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{Idxlabel} = $cw->createText(
|
1039
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelX},
|
1040
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{CxlabelY},
|
1041
|
|
|
|
|
|
|
-text => $xlabel,
|
1042
|
|
|
|
|
|
|
-width => 0,
|
1043
|
|
|
|
|
|
|
-anchor => 'nw',
|
1044
|
|
|
|
|
|
|
-tags => [ $cw->{RefChart}->{TAGS}{AllTagsChart}, ],
|
1045
|
|
|
|
|
|
|
);
|
1046
|
|
|
|
|
|
|
}
|
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
$cw->itemconfigure(
|
1049
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Xaxis}{Idxlabel},
|
1050
|
|
|
|
|
|
|
-font => $cw->cget( -xlabelfont ),
|
1051
|
|
|
|
|
|
|
-fill => $cw->cget( -xlabelcolor ),
|
1052
|
|
|
|
|
|
|
);
|
1053
|
|
|
|
|
|
|
|
1054
|
0
|
|
|
|
|
|
return;
|
1055
|
|
|
|
|
|
|
}
|
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
sub _ylabelposition {
|
1058
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
1059
|
|
|
|
|
|
|
|
1060
|
0
|
|
|
|
|
|
my $ylabel = $cw->cget( -ylabel );
|
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
# no y_label
|
1063
|
0
|
0
|
|
|
|
|
if ( not defined $ylabel ) {
|
1064
|
0
|
|
|
|
|
|
return;
|
1065
|
|
|
|
|
|
|
}
|
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
# coordinate (CylabelX, CylabelY)
|
1068
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{CylabelX}
|
1069
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{WidthEmptySpace} + ( $cw->{RefChart}->{Axis}{Yaxis}{ylabelWidth} / 2 );
|
1070
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{CylabelY}
|
1071
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{HeightEmptySpace}
|
1072
|
|
|
|
|
|
|
+ $cw->{RefChart}->{Title}{Height}
|
1073
|
|
|
|
|
|
|
+ ( $cw->{RefChart}->{Axis}{Yaxis}{Height} / 2 );
|
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
# display ylabel
|
1076
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{Idylabel} = $cw->createText(
|
1077
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{CylabelX},
|
1078
|
|
|
|
|
|
|
$cw->{RefChart}->{Axis}{Yaxis}{CylabelY},
|
1079
|
|
|
|
|
|
|
-text => $ylabel,
|
1080
|
|
|
|
|
|
|
-font => $cw->cget( -ylabelfont ),
|
1081
|
|
|
|
|
|
|
-width => $cw->{RefChart}->{Axis}{Yaxis}{ylabelWidth},
|
1082
|
|
|
|
|
|
|
-fill => $cw->cget( -ylabelcolor ),
|
1083
|
|
|
|
|
|
|
-tags => [ $cw->{RefChart}->{TAGS}{AllTagsChart}, ],
|
1084
|
|
|
|
|
|
|
);
|
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
# get info ylabel
|
1087
|
0
|
|
|
|
|
|
my ( $width, $height );
|
1088
|
0
|
|
|
|
|
|
( $cw->{RefChart}->{Axis}{Yaxis}{CylabelX}, $cw->{RefChart}->{Axis}{Yaxis}{CylabelY}, $width, $height )
|
1089
|
|
|
|
|
|
|
= $cw->bbox( $cw->{RefChart}->{Axis}{Yaxis}{Idylabel} );
|
1090
|
|
|
|
|
|
|
|
1091
|
0
|
|
|
|
|
|
return;
|
1092
|
|
|
|
|
|
|
}
|
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
sub _manage_minmaxvalues {
|
1095
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
1096
|
|
|
|
|
|
|
|
1097
|
|
|
|
|
|
|
# Bars : Cumulate percent => min = 0 and max = 100
|
1098
|
0
|
|
|
|
|
|
my $cumulatepercent = $cw->cget( -cumulatepercent );
|
1099
|
0
|
0
|
0
|
|
|
|
if ( defined $cumulatepercent and $cumulatepercent == 1 ) {
|
1100
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MinYValue} = 0;
|
1101
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MaxYValue} = 100;
|
1102
|
0
|
|
|
|
|
|
return 1;
|
1103
|
|
|
|
|
|
|
}
|
1104
|
|
|
|
|
|
|
|
1105
|
0
|
|
|
|
|
|
my $cumulate = $cw->cget( -cumulate );
|
1106
|
0
|
|
|
|
|
|
my $yticknumber = $cw->cget( -yticknumber );
|
1107
|
0
|
|
|
|
|
|
my $yminvalue = $cw->cget( -yminvalue );
|
1108
|
0
|
|
|
|
|
|
my $ymaxvalue = $cw->cget( -ymaxvalue );
|
1109
|
0
|
|
|
|
|
|
my $interval = $cw->cget( -interval );
|
1110
|
|
|
|
|
|
|
|
1111
|
0
|
0
|
0
|
|
|
|
if ( defined $yminvalue and defined $ymaxvalue ) {
|
1112
|
0
|
0
|
0
|
|
|
|
if (
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
1113
|
|
|
|
|
|
|
!(( $ymaxvalue >= $cw->{RefChart}->{Data}{MaxYValue}
|
1114
|
|
|
|
|
|
|
and $yminvalue <= $cw->{RefChart}->{Data}{MinYValue}
|
1115
|
|
|
|
|
|
|
)
|
1116
|
|
|
|
|
|
|
or ( defined $interval and $interval == 1 )
|
1117
|
|
|
|
|
|
|
)
|
1118
|
|
|
|
|
|
|
)
|
1119
|
|
|
|
|
|
|
{
|
1120
|
0
|
|
|
|
|
|
$cw->_error('-yminvalue and -ymaxvalue do not include all data');
|
1121
|
|
|
|
|
|
|
}
|
1122
|
|
|
|
|
|
|
}
|
1123
|
|
|
|
|
|
|
|
1124
|
0
|
0
|
0
|
|
|
|
if ( defined $cumulate and $cumulate == 1 and $cw->{RefChart}->{Data}{MinYValue} > 0 ) {
|
|
|
|
0
|
|
|
|
|
1125
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MinYValue} = 0;
|
1126
|
|
|
|
|
|
|
}
|
1127
|
|
|
|
|
|
|
|
1128
|
0
|
0
|
0
|
|
|
|
if ( !( defined $interval and $interval == 1 ) ) {
|
1129
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Data}{MinYValue} > 0 ) {
|
1130
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MinYValue} = 0;
|
1131
|
|
|
|
|
|
|
}
|
1132
|
0
|
|
|
|
|
|
while ( ( $cw->{RefChart}->{Data}{MaxYValue} / $yticknumber ) % 5 != 0 ) {
|
1133
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MaxYValue} = int( $cw->{RefChart}->{Data}{MaxYValue} + 1 );
|
1134
|
|
|
|
|
|
|
}
|
1135
|
|
|
|
|
|
|
|
1136
|
0
|
0
|
0
|
|
|
|
if ( defined $yminvalue and $yminvalue != 0 ) {
|
1137
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MinYValue} = $yminvalue;
|
1138
|
|
|
|
|
|
|
}
|
1139
|
0
|
0
|
0
|
|
|
|
if ( defined $ymaxvalue and $ymaxvalue != 0 ) {
|
1140
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Data}{MaxYValue} = $ymaxvalue;
|
1141
|
|
|
|
|
|
|
}
|
1142
|
|
|
|
|
|
|
}
|
1143
|
|
|
|
|
|
|
|
1144
|
0
|
|
|
|
|
|
return 1;
|
1145
|
|
|
|
|
|
|
}
|
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
sub _chartconstruction {
|
1148
|
0
|
|
|
0
|
|
|
my ($cw) = @_;
|
1149
|
|
|
|
|
|
|
|
1150
|
0
|
0
|
|
|
|
|
if ( not defined $cw->{RefChart}->{Data}{PlotDefined} ) {
|
1151
|
0
|
|
|
|
|
|
return;
|
1152
|
|
|
|
|
|
|
}
|
1153
|
|
|
|
|
|
|
|
1154
|
0
|
|
|
|
|
|
$cw->clearchart();
|
1155
|
0
|
|
|
|
|
|
$cw->_treatparameters();
|
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
# For background gradient color
|
1158
|
0
|
|
|
|
|
|
$cw->set_gradientcolor;
|
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
# Height and Width canvas
|
1161
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Canvas}{Width} = $cw->width;
|
1162
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Canvas}{Height} = $cw->height;
|
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
# Pie graph
|
1165
|
0
|
0
|
|
|
|
|
if ( $cw->class eq 'Pie' ) {
|
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
# Width Pie
|
1168
|
0
|
|
|
|
|
|
$cw->{RefChart}->{Pie}{Width}
|
1169
|
|
|
|
|
|
|
= $cw->{RefChart}->{Canvas}{Width} - ( 2 * $cw->{RefChart}->{Canvas}{WidthEmptySpace} );
|
1170
|
|
|
|
|
|
|
|
1171
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Data}{RefAllData} ) {
|
1172
|
0
|
|
|
|
|
|
$cw->_titlepie;
|
1173
|
0
|
|
|
|
|
|
$cw->_viewdata;
|
1174
|
0
|
|
|
|
|
|
$cw->_viewlegend();
|
1175
|
|
|
|
|
|
|
}
|
1176
|
0
|
|
|
|
|
|
return;
|
1177
|
|
|
|
|
|
|
}
|
1178
|
|
|
|
|
|
|
|
1179
|
0
|
|
|
|
|
|
$cw->_axis();
|
1180
|
0
|
|
|
|
|
|
$cw->_box();
|
1181
|
0
|
|
|
|
|
|
$cw->_ylabelposition();
|
1182
|
0
|
|
|
|
|
|
$cw->_xlabelposition();
|
1183
|
0
|
|
|
|
|
|
$cw->_title();
|
1184
|
|
|
|
|
|
|
|
1185
|
0
|
0
|
|
|
|
|
if ( $cw->class eq 'Lines' ) {
|
1186
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -pointline ) == 1 ) {
|
1187
|
0
|
|
|
|
|
|
$cw->_viewdatapoints();
|
1188
|
|
|
|
|
|
|
}
|
1189
|
|
|
|
|
|
|
else {
|
1190
|
0
|
|
|
|
|
|
$cw->_viewdatalines();
|
1191
|
|
|
|
|
|
|
}
|
1192
|
|
|
|
|
|
|
}
|
1193
|
|
|
|
|
|
|
else {
|
1194
|
0
|
|
|
|
|
|
$cw->_viewdata();
|
1195
|
|
|
|
|
|
|
}
|
1196
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
#
|
1198
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -noaxis ) != 1 ) {
|
1199
|
0
|
|
|
|
|
|
$cw->_xtick();
|
1200
|
0
|
|
|
|
|
|
$cw->_ytick();
|
1201
|
|
|
|
|
|
|
}
|
1202
|
|
|
|
|
|
|
|
1203
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Legend}{NbrLegend} > 0 ) {
|
1204
|
0
|
|
|
|
|
|
$cw->_viewlegend();
|
1205
|
0
|
|
|
|
|
|
$cw->_balloon();
|
1206
|
|
|
|
|
|
|
}
|
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
# If Y value < 0, don't display O x-axis
|
1209
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Data}{MaxYValue} < 0 ) {
|
1210
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xAxis0} );
|
1211
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xValue0} );
|
1212
|
|
|
|
|
|
|
}
|
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
# Axis
|
1215
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -noaxis ) == 1 ) {
|
1216
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{AllAXIS} );
|
1217
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{AllTick} );
|
1218
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{AllValues} );
|
1219
|
|
|
|
|
|
|
}
|
1220
|
0
|
0
|
0
|
|
|
|
if ( $cw->cget( -zeroaxisonly ) == 1
|
|
|
|
0
|
|
|
|
|
1221
|
|
|
|
|
|
|
and $cw->{RefChart}->{Data}{MaxYValue} > 0
|
1222
|
|
|
|
|
|
|
and $cw->{RefChart}->{Data}{MinYValue} < 0 )
|
1223
|
|
|
|
|
|
|
{
|
1224
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xAxis} );
|
1225
|
|
|
|
|
|
|
}
|
1226
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -zeroaxis ) == 1 ) {
|
1227
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xAxis0} );
|
1228
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xTick} );
|
1229
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xValues} );
|
1230
|
|
|
|
|
|
|
}
|
1231
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -xvalueview ) == 0 ) {
|
1232
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xValues} );
|
1233
|
|
|
|
|
|
|
}
|
1234
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -yvalueview ) == 0 ) {
|
1235
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{yValues} );
|
1236
|
|
|
|
|
|
|
}
|
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
# ticks
|
1239
|
0
|
|
|
|
|
|
my $alltickview = $cw->cget( -alltickview );
|
1240
|
0
|
0
|
|
|
|
|
if ( defined $alltickview ) {
|
1241
|
0
|
0
|
|
|
|
|
if ( $alltickview == 0 ) {
|
1242
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{AllTick} );
|
1243
|
|
|
|
|
|
|
}
|
1244
|
|
|
|
|
|
|
else {
|
1245
|
0
|
|
|
|
|
|
$cw->configure( -ytickview => 1 );
|
1246
|
0
|
|
|
|
|
|
$cw->configure( -xtickview => 1 );
|
1247
|
|
|
|
|
|
|
}
|
1248
|
|
|
|
|
|
|
}
|
1249
|
|
|
|
|
|
|
else {
|
1250
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -xtickview ) == 0 ) {
|
1251
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{xTick} );
|
1252
|
|
|
|
|
|
|
}
|
1253
|
0
|
0
|
|
|
|
|
if ( $cw->cget( -ytickview ) == 0 ) {
|
1254
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{yTick} );
|
1255
|
|
|
|
|
|
|
}
|
1256
|
|
|
|
|
|
|
}
|
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
# Legend
|
1259
|
0
|
0
|
|
|
|
|
if ( $cw->{RefChart}->{Legend}{box} == 0 ) {
|
1260
|
0
|
|
|
|
|
|
$cw->delete( $cw->{RefChart}->{TAGS}{BoxLegend} );
|
1261
|
|
|
|
|
|
|
}
|
1262
|
|
|
|
|
|
|
|
1263
|
0
|
0
|
|
|
|
|
if ( $cw->class eq 'Mixed' ) {
|
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
# Order displaying data
|
1266
|
0
|
|
|
|
|
|
$cw->display_order;
|
1267
|
|
|
|
|
|
|
}
|
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
# Ticks always in background
|
1270
|
0
|
|
|
|
|
|
$cw->raise( $cw->{RefChart}->{TAGS}{AllData}, $cw->{RefChart}->{TAGS}{AllTick} );
|
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
# values displayed above the bars must be display over the bars
|
1273
|
0
|
|
|
|
|
|
my $showvalues = $cw->cget( -showvalues );
|
1274
|
0
|
0
|
0
|
|
|
|
if ( defined $showvalues and $showvalues == 1 ) {
|
1275
|
0
|
|
|
|
|
|
$cw->raise( $cw->{RefChart}->{TAGS}{BarValues}, $cw->{RefChart}->{TAGS}{AllBars} );
|
1276
|
|
|
|
|
|
|
}
|
1277
|
0
|
|
|
|
|
|
return 1;
|
1278
|
|
|
|
|
|
|
}
|
1279
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
1;
|
1281
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
__END__
|