rgraph-rails 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +0 -1
- data/README.md +3 -3
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/javascripts/RGraph.bar.js +239 -3764
- data/vendor/assets/javascripts/RGraph.bipolar.js +115 -1986
- data/vendor/assets/javascripts/RGraph.common.annotate.js +35 -399
- data/vendor/assets/javascripts/RGraph.common.context.js +30 -600
- data/vendor/assets/javascripts/RGraph.common.core.js +403 -5187
- data/vendor/assets/javascripts/RGraph.common.csv.js +19 -275
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +35 -454
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +84 -1189
- data/vendor/assets/javascripts/RGraph.common.effects.js +90 -1548
- data/vendor/assets/javascripts/RGraph.common.key.js +54 -755
- data/vendor/assets/javascripts/RGraph.common.resizing.js +37 -567
- data/vendor/assets/javascripts/RGraph.common.sheets.js +29 -356
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +32 -614
- data/vendor/assets/javascripts/RGraph.common.zoom.js +14 -223
- data/vendor/assets/javascripts/RGraph.cornergauge.js +71 -0
- data/vendor/assets/javascripts/RGraph.drawing.background.js +35 -620
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +35 -576
- data/vendor/assets/javascripts/RGraph.drawing.image.js +52 -807
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +41 -717
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +37 -668
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +36 -563
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +40 -608
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +35 -597
- data/vendor/assets/javascripts/RGraph.drawing.text.js +34 -642
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +50 -809
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +51 -856
- data/vendor/assets/javascripts/RGraph.fuel.js +58 -964
- data/vendor/assets/javascripts/RGraph.funnel.js +55 -984
- data/vendor/assets/javascripts/RGraph.gantt.js +75 -1241
- data/vendor/assets/javascripts/RGraph.gauge.js +87 -1397
- data/vendor/assets/javascripts/RGraph.hbar.js +143 -2376
- data/vendor/assets/javascripts/RGraph.hprogress.js +80 -1397
- data/vendor/assets/javascripts/RGraph.line.js +241 -4162
- data/vendor/assets/javascripts/RGraph.meter.js +74 -1278
- metadata +3 -30
- data/vendor/assets/images/bg.png +0 -0
- data/vendor/assets/images/bullet.png +0 -0
- data/vendor/assets/images/facebook-large.png +0 -0
- data/vendor/assets/images/google-plus-large.png +0 -0
- data/vendor/assets/images/logo.png +0 -0
- data/vendor/assets/images/meter-image-sd-needle.png +0 -0
- data/vendor/assets/images/meter-image-sd.png +0 -0
- data/vendor/assets/images/meter-sketch-needle.png +0 -0
- data/vendor/assets/images/meter-sketch.png +0 -0
- data/vendor/assets/images/odometer-background.png +0 -0
- data/vendor/assets/images/rgraph.jpg +0 -0
- data/vendor/assets/images/title.png +0 -0
- data/vendor/assets/images/twitter-large.png +0 -0
- data/vendor/assets/javascripts/RGraph.modaldialog.js +0 -301
- data/vendor/assets/javascripts/RGraph.odo.js +0 -1265
- data/vendor/assets/javascripts/RGraph.pie.js +0 -2272
- data/vendor/assets/javascripts/RGraph.radar.js +0 -1847
- data/vendor/assets/javascripts/RGraph.rose.js +0 -1877
- data/vendor/assets/javascripts/RGraph.rscatter.js +0 -1425
- data/vendor/assets/javascripts/RGraph.scatter.js +0 -2970
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +0 -1015
- data/vendor/assets/javascripts/RGraph.thermometer.js +0 -1129
- data/vendor/assets/javascripts/RGraph.vprogress.js +0 -1452
- data/vendor/assets/javascripts/RGraph.waterfall.js +0 -1252
- data/vendor/assets/javascripts/financial-data.js +0 -1067
- data/vendor/assets/stylesheets/ModalDialog.css +0 -90
- data/vendor/assets/stylesheets/animations.css +0 -3347
- data/vendor/assets/stylesheets/website.css +0 -446
@@ -1,810 +1,51 @@
|
|
1
|
-
// version: 2016-06-04
|
2
|
-
/**
|
3
|
-
* o--------------------------------------------------------------------------------o
|
4
|
-
* | This file is part of the RGraph package - you can learn more at: |
|
5
|
-
* | |
|
6
|
-
* | http://www.rgraph.net |
|
7
|
-
* | |
|
8
|
-
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
|
-
* | v2.0 license and a commercial license which means that you're not bound by |
|
10
|
-
* | the terms of the GPL. The commercial license is just 99 GBP and you can |
|
11
|
-
* | read about it here: |
|
12
|
-
* | http://www.rgraph.net/license |
|
13
|
-
* o--------------------------------------------------------------------------------o
|
14
|
-
*/
|
15
1
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
/**
|
67
|
-
* This defines the type of this shape
|
68
|
-
*/
|
69
|
-
this.type = 'drawing.xaxis';
|
70
|
-
|
71
|
-
|
72
|
-
/**
|
73
|
-
* This facilitates easy object identification, and should always be true
|
74
|
-
*/
|
75
|
-
this.isRGraph = true;
|
76
|
-
|
77
|
-
|
78
|
-
/**
|
79
|
-
* This adds a uid to the object that you can use for identification purposes
|
80
|
-
*/
|
81
|
-
this.uid = RGraph.CreateUID();
|
82
|
-
|
83
|
-
|
84
|
-
/**
|
85
|
-
* This adds a UID to the canvas for identification purposes
|
86
|
-
*/
|
87
|
-
this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.CreateUID();
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Some example background properties
|
94
|
-
*/
|
95
|
-
this.properties =
|
96
|
-
{
|
97
|
-
'chart.gutter.left': 25,
|
98
|
-
'chart.gutter.right': 25,
|
99
|
-
'chart.labels': null,
|
100
|
-
'chart.labels.position': 'section',
|
101
|
-
'chart.colors': ['black'],
|
102
|
-
'chart.title.color': null, // Defaults to same as chart.colors
|
103
|
-
'chart.text.color': null, // Defaults to same as chart.colors
|
104
|
-
'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
105
|
-
'chart.text.size': 12,
|
106
|
-
'chart.text.accessible': true,
|
107
|
-
'chart.text.accessible.overflow':'visible',
|
108
|
-
'chart.text.accessible.pointerevents': false,
|
109
|
-
'chart.align': 'bottom',
|
110
|
-
'chart.numlabels': 5,
|
111
|
-
'chart.scale.visible': true,
|
112
|
-
'chart.scale.formatter': null,
|
113
|
-
'chart.scale.decimals': 0,
|
114
|
-
'chart.scale.point': '.',
|
115
|
-
'chart.scale.thousand': ',',
|
116
|
-
'chart.scale.invert': false,
|
117
|
-
'chart.scale.zerostart': true,
|
118
|
-
'chart.units.pre': '',
|
119
|
-
'chart.units.post': '',
|
120
|
-
'chart.title': '',
|
121
|
-
'chart.numticks': null,
|
122
|
-
'chart.hmargin': 0,
|
123
|
-
'chart.linewidth': 1,
|
124
|
-
'chart.noendtick.left': false,
|
125
|
-
'chart.noendtick.right': false,
|
126
|
-
'chart.noxaxis': false,
|
127
|
-
'chart.max': null,
|
128
|
-
'chart.min': 0,
|
129
|
-
'chart.tooltips': null,
|
130
|
-
'chart.tooltips.effect': 'fade',
|
131
|
-
'chart.tooltips.css.class':'RGraph_tooltip',
|
132
|
-
'chart.tooltips.event': 'onclick',
|
133
|
-
'chart.events.click': null,
|
134
|
-
'chart.events.mousemove': null,
|
135
|
-
'chart.xaxispos': 'bottom',
|
136
|
-
'chart.yaxispos': 'left',
|
137
|
-
'chart.clearto': 'rgba(0,0,0,0)'
|
138
|
-
}
|
139
|
-
|
140
|
-
/**
|
141
|
-
* A simple check that the browser has canvas support
|
142
|
-
*/
|
143
|
-
if (!this.canvas) {
|
144
|
-
alert('[DRAWING.XAXIS] No canvas support');
|
145
|
-
return;
|
146
|
-
}
|
147
|
-
|
148
|
-
/**
|
149
|
-
* Create the dollar object so that functions can be added to them
|
150
|
-
*/
|
151
|
-
this.$0 = {};
|
152
|
-
|
153
|
-
|
154
|
-
/**
|
155
|
-
* Translate half a pixel for antialiasing purposes - but only if it hasn't beeen
|
156
|
-
* done already
|
157
|
-
*/
|
158
|
-
if (!this.canvas.__rgraph_aa_translated__) {
|
159
|
-
this.context.translate(0.5,0.5);
|
160
|
-
|
161
|
-
this.canvas.__rgraph_aa_translated__ = true;
|
162
|
-
}
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
// Short variable names
|
168
|
-
var RG = RGraph,
|
169
|
-
ca = this.canvas,
|
170
|
-
co = ca.getContext('2d'),
|
171
|
-
prop = this.properties,
|
172
|
-
pa2 = RG.path2,
|
173
|
-
win = window,
|
174
|
-
doc = document,
|
175
|
-
ma = Math
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
/**
|
180
|
-
* "Decorate" the object with the generic effects if the effects library has been included
|
181
|
-
*/
|
182
|
-
if (RG.Effects && typeof RG.Effects.decorate === 'function') {
|
183
|
-
RG.Effects.decorate(this);
|
184
|
-
}
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
/**
|
190
|
-
* A setter method for setting graph properties. It can be used like this: obj.Set('chart.strokestyle', '#666');
|
191
|
-
*
|
192
|
-
* @param name string The name of the property to set
|
193
|
-
* @param value mixed The value of the property
|
194
|
-
*/
|
195
|
-
this.set =
|
196
|
-
this.Set = function (name)
|
197
|
-
{
|
198
|
-
var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
|
199
|
-
|
200
|
-
/**
|
201
|
-
* the number of arguments is only one and it's an
|
202
|
-
* object - parse it for configuration data and return.
|
203
|
-
*/
|
204
|
-
if (arguments.length === 1 && typeof name === 'object') {
|
205
|
-
RG.parseObjectStyleConfig(this, name);
|
206
|
-
return this;
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
/**
|
212
|
-
* This should be done first - prepend the property name with "chart." if necessary
|
213
|
-
*/
|
214
|
-
if (name.substr(0,6) != 'chart.') {
|
215
|
-
name = 'chart.' + name;
|
216
|
-
}
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
// Convert uppercase letters to dot+lower case letter
|
222
|
-
while(name.match(/([A-Z])/)) {
|
223
|
-
name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
|
224
|
-
}
|
225
|
-
|
226
|
-
/**
|
227
|
-
* Make the tickmarks align if labels are specified
|
228
|
-
*/
|
229
|
-
if (name == 'chart.labels' && !prop['chart.numxticks']) {
|
230
|
-
prop['chart.numxticks'] = value.length;
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
prop[name] = value;
|
239
|
-
|
240
|
-
return this;
|
241
|
-
};
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
/**
|
247
|
-
* A getter method for retrieving graph properties. It can be used like this: obj.Get('chart.strokestyle');
|
248
|
-
*
|
249
|
-
* @param name string The name of the property to get
|
250
|
-
*/
|
251
|
-
this.get =
|
252
|
-
this.Get = function (name)
|
253
|
-
{
|
254
|
-
/**
|
255
|
-
* This should be done first - prepend the property name with "chart." if necessary
|
256
|
-
*/
|
257
|
-
if (name.substr(0,6) != 'chart.') {
|
258
|
-
name = 'chart.' + name;
|
259
|
-
}
|
260
|
-
|
261
|
-
// Convert uppercase letters to dot+lower case letter
|
262
|
-
name = name.replace(/([A-Z])/g, function (str)
|
263
|
-
{
|
264
|
-
return '.' + String(RegExp.$1).toLowerCase()
|
265
|
-
});
|
266
|
-
|
267
|
-
return prop[name.toLowerCase()];
|
268
|
-
};
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
/**
|
274
|
-
* Draws the rectangle
|
275
|
-
*/
|
276
|
-
this.draw =
|
277
|
-
this.Draw = function ()
|
278
|
-
{
|
279
|
-
/**
|
280
|
-
* Fire the onbeforedraw event
|
281
|
-
*/
|
282
|
-
RG.FireCustomEvent(this, 'onbeforedraw');
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
/**
|
287
|
-
* Stop this growing uncntrollably
|
288
|
-
*/
|
289
|
-
this.coordsText = [];
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
/**
|
295
|
-
* Some defaults
|
296
|
-
*/
|
297
|
-
this.gutterLeft = prop['chart.gutter.left'];
|
298
|
-
this.gutterRight = prop['chart.gutter.right'];
|
299
|
-
if (!prop['chart.text.color']) prop['chart.text.color'] = prop['chart.colors'][0];
|
300
|
-
if (!prop['chart.title.color']) prop['chart.title.color'] = prop['chart.colors'][0];
|
301
|
-
|
302
|
-
/**
|
303
|
-
* Parse the colors. This allows for simple gradient syntax
|
304
|
-
*/
|
305
|
-
if (!this.colorsParsed) {
|
306
|
-
|
307
|
-
this.parseColors();
|
308
|
-
|
309
|
-
// Don't want to do this again
|
310
|
-
this.colorsParsed = true;
|
311
|
-
}
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
// DRAW X AXIS HERE
|
316
|
-
this.DrawXAxis();
|
317
|
-
|
318
|
-
|
319
|
-
/**
|
320
|
-
* This installs the event listeners
|
321
|
-
*/
|
322
|
-
RG.InstallEventListeners(this);
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
/**
|
327
|
-
* Fire the onfirstdraw event
|
328
|
-
*/
|
329
|
-
if (this.firstDraw) {
|
330
|
-
RG.fireCustomEvent(this, 'onfirstdraw');
|
331
|
-
this.firstDraw = false;
|
332
|
-
this.firstDrawFunc();
|
333
|
-
}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
/**
|
339
|
-
* Fire the ondraw event
|
340
|
-
*/
|
341
|
-
RG.FireCustomEvent(this, 'ondraw');
|
342
|
-
|
343
|
-
return this;
|
344
|
-
};
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
/**
|
349
|
-
* Used in chaining. Runs a function there and then - not waiting for
|
350
|
-
* the events to fire (eg the onbeforedraw event)
|
351
|
-
*
|
352
|
-
* @param function func The function to execute
|
353
|
-
*/
|
354
|
-
this.exec = function (func)
|
355
|
-
{
|
356
|
-
func(this);
|
357
|
-
|
358
|
-
return this;
|
359
|
-
};
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
/**
|
365
|
-
* The getObjectByXY() worker method
|
366
|
-
*/
|
367
|
-
this.getObjectByXY = function (e)
|
368
|
-
{
|
369
|
-
if (this.getShape(e)) {
|
370
|
-
return this;
|
371
|
-
}
|
372
|
-
};
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
/**
|
378
|
-
* Not used by the class during creating the graph, but is used by event handlers
|
379
|
-
* to get the coordinates (if any) of the selected shape
|
380
|
-
*
|
381
|
-
* @param object e The event object
|
382
|
-
*/
|
383
|
-
this.getShape = function (e)
|
384
|
-
{
|
385
|
-
var mouseXY = RG.getMouseXY(e);
|
386
|
-
var mouseX = mouseXY[0];
|
387
|
-
var mouseY = mouseXY[1];
|
388
|
-
|
389
|
-
if ( mouseX >= this.gutterLeft
|
390
|
-
&& mouseX <= (ca.width - this.gutterRight)
|
391
|
-
&& mouseY >= this.y - (prop['chart.align'] == 'top' ? (prop['chart.text.size'] * 1.5) + 5 : 0)
|
392
|
-
&& mouseY <= (this.y + (prop['chart.align'] == 'top' ? 0 : (prop['chart.text.size'] * 1.5) + 5))
|
393
|
-
) {
|
394
|
-
|
395
|
-
var x = this.gutterLeft;
|
396
|
-
var y = this.y;
|
397
|
-
var w = ca.width - this.gutterLeft - this.gutterRight;
|
398
|
-
var h = 15;
|
399
|
-
|
400
|
-
return {
|
401
|
-
0: this, 1: x, 2: y, 3: w, 4: h, 5: 0,
|
402
|
-
'object': this, 'x': x, 'y': y, 'width': w, 'height': h, 'index': 0, 'tooltip': prop['chart.tooltips'] ? prop['chart.tooltips'][0] : null
|
403
|
-
};
|
404
|
-
}
|
405
|
-
|
406
|
-
return null;
|
407
|
-
};
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
/**
|
413
|
-
* This function positions a tooltip when it is displayed
|
414
|
-
*
|
415
|
-
* @param obj object The chart object
|
416
|
-
* @param int x The X coordinate specified for the tooltip
|
417
|
-
* @param int y The Y coordinate specified for the tooltip
|
418
|
-
* @param objec tooltip The tooltips DIV element
|
419
|
-
*/
|
420
|
-
this.positionTooltip = function (obj, x, y, tooltip, idx)
|
421
|
-
{
|
422
|
-
var coordX = obj.gutterLeft;
|
423
|
-
var coordY = obj.y;
|
424
|
-
var coordW = ca.width - obj.gutterLeft - obj.gutterRight;
|
425
|
-
var coordH = prop['chart.text.size'] * 1.5;
|
426
|
-
var canvasXY = RG.getCanvasXY(ca);
|
427
|
-
var mouseXY = RG.getMouseXY(window.event);
|
428
|
-
var width = tooltip.offsetWidth;
|
429
|
-
var height = tooltip.offsetHeight;
|
430
|
-
|
431
|
-
|
432
|
-
// Set the top position
|
433
|
-
tooltip.style.left = 0;
|
434
|
-
tooltip.style.top = window.event.pageY - height - 5 + 'px';
|
435
|
-
|
436
|
-
// By default any overflow is hidden
|
437
|
-
tooltip.style.overflow = '';
|
438
|
-
|
439
|
-
// Reposition the tooltip if at the edges:
|
440
|
-
|
441
|
-
// LEFT edge
|
442
|
-
if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
|
443
|
-
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
|
444
|
-
|
445
|
-
// RIGHT edge
|
446
|
-
} else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
|
447
|
-
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
|
448
|
-
|
449
|
-
// Default positioning - CENTERED
|
450
|
-
} else {
|
451
|
-
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
|
452
|
-
}
|
453
|
-
};
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
/**
|
459
|
-
* Each object type has its own Highlight() function which highlights the appropriate shape
|
460
|
-
*
|
461
|
-
* @param object shape The shape to highlight
|
462
|
-
*/
|
463
|
-
this.highlight =
|
464
|
-
this.Highlight = function (shape)
|
465
|
-
{
|
466
|
-
if (typeof prop['chart.highlight.style'] === 'function') {
|
467
|
-
(prop['chart.highlight.style'])(shape);
|
468
|
-
}
|
469
|
-
};
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
/**
|
475
|
-
* This allows for easy specification of gradients
|
476
|
-
*/
|
477
|
-
this.parseColors = function ()
|
478
|
-
{
|
479
|
-
|
480
|
-
// Save the original colors so that they can be restored when the canvas is reset
|
481
|
-
if (this.original_colors.length === 0) {
|
482
|
-
this.original_colors['chart.colors'] = RG.array_clone(prop['chart.colors']);
|
483
|
-
}
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
/**
|
489
|
-
* Parse various properties for colors
|
490
|
-
*/
|
491
|
-
//this.properties['chart.title.color'] = this.parseSingleColorForGradient(this.properties['chart.title.color']);
|
492
|
-
//this.properties['chart.text.color'] = this.parseSingleColorForGradient(this.properties['chart.text.color']);
|
493
|
-
prop['chart.colors'][0] = this.parseSingleColorForGradient(prop['chart.colors'][0]);
|
494
|
-
};
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
/**
|
500
|
-
* Use this function to reset the object to the post-constructor state. Eg reset colors if
|
501
|
-
* need be etc
|
502
|
-
*/
|
503
|
-
this.reset = function ()
|
504
|
-
{
|
505
|
-
};
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
/**
|
511
|
-
* This parses a single color value
|
512
|
-
*/
|
513
|
-
this.parseSingleColorForGradient = function (color)
|
514
|
-
{
|
515
|
-
if (!color) {
|
516
|
-
return color;
|
517
|
-
}
|
518
|
-
|
519
|
-
if (typeof color === 'string' && color.match(/^gradient\((.*)\)$/i)) {
|
520
|
-
|
521
|
-
var parts = RegExp.$1.split(':');
|
522
|
-
|
523
|
-
// Create the gradient
|
524
|
-
var grad = co.createLinearGradient(prop['chart.gutter.left'],0,ca.width - prop['chart.gutter.right'],0);
|
525
|
-
|
526
|
-
var diff = 1 / (parts.length - 1);
|
527
|
-
|
528
|
-
grad.addColorStop(0, RG.trim(parts[0]));
|
529
|
-
|
530
|
-
for (var j=1,len=parts.length; j<len; ++j) {
|
531
|
-
grad.addColorStop(j * diff, RG.trim(parts[j]));
|
532
|
-
}
|
533
|
-
}
|
534
|
-
|
535
|
-
return grad ? grad : color;
|
536
|
-
};
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
/**
|
542
|
-
* The function that draws the X axis
|
543
|
-
*/
|
544
|
-
this.drawXAxis =
|
545
|
-
this.DrawXAxis = function ()
|
546
|
-
{
|
547
|
-
var gutterLeft = prop['chart.gutter.left'],
|
548
|
-
gutterRight = prop['chart.gutter.right'],
|
549
|
-
x = this.gutterLeft,
|
550
|
-
y = this.y,
|
551
|
-
min = +prop['chart.min'],
|
552
|
-
max = +prop['chart.max'],
|
553
|
-
labels = prop['chart.labels'],
|
554
|
-
labels_position = prop['chart.labels.position'],
|
555
|
-
color = prop['chart.colors'][0],
|
556
|
-
title_color = prop['chart.title.color'],
|
557
|
-
label_color = prop['chart.text.color'],
|
558
|
-
width = ca.width - this.gutterLeft - this.gutterRight,
|
559
|
-
font = prop['chart.text.font'],
|
560
|
-
size = prop['chart.text.size'],
|
561
|
-
align = prop['chart.align'],
|
562
|
-
numlabels = prop['chart.numlabels'],
|
563
|
-
formatter = prop['chart.scale.formatter'],
|
564
|
-
decimals = Number(prop['chart.scale.decimals']),
|
565
|
-
invert = prop['chart.scale.invert'],
|
566
|
-
scale_visible = prop['chart.scale.visible'],
|
567
|
-
units_pre = prop['chart.units.pre'],
|
568
|
-
units_post = prop['chart.units.post'],
|
569
|
-
title = prop['chart.title']
|
570
|
-
numticks = prop['chart.numticks'],
|
571
|
-
hmargin = prop['chart.hmargin'],
|
572
|
-
linewidth = prop['chart.linewidth'],
|
573
|
-
noleftendtick = prop['chart.noendtick.left'],
|
574
|
-
norightendtick = prop['chart.noendtick.right'],
|
575
|
-
noxaxis = prop['chart.noxaxis'],
|
576
|
-
xaxispos = prop['chart.xaxispos'],
|
577
|
-
yaxispos = prop['chart.yaxispos']
|
578
|
-
|
579
|
-
|
580
|
-
if (RG.is_null(numticks)) {
|
581
|
-
if (labels && labels.length) {
|
582
|
-
numticks = labels.length;
|
583
|
-
} else if (!labels && max != 0) {
|
584
|
-
numticks = 10;
|
585
|
-
} else {
|
586
|
-
numticks = numlabels;
|
587
|
-
}
|
588
|
-
}
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
/**
|
593
|
-
* Set the linewidth
|
594
|
-
*/
|
595
|
-
co.lineWidth = linewidth + 0.001;
|
596
|
-
|
597
|
-
/**
|
598
|
-
* Set the color
|
599
|
-
*/
|
600
|
-
co.strokeStyle = color;
|
601
|
-
|
602
|
-
if (!noxaxis) {
|
603
|
-
/**
|
604
|
-
* Draw the main horizontal line
|
605
|
-
*/
|
606
|
-
pa2(co, ['b','m',x, Math.round(y),'l',x + width, Math.round(y),'s',co.strokeStyle]);
|
607
|
-
|
608
|
-
/**
|
609
|
-
* Draw the axis tickmarks
|
610
|
-
*/
|
611
|
-
co.beginPath();
|
612
|
-
for (var i=(noleftendtick ? 1 : 0); i<=(numticks - (norightendtick ? 1 : 0)); ++i) {
|
613
|
-
co.moveTo(Math.round(x + ((width / numticks) * i)), xaxispos == 'center' ? (align == 'bottom' ? y - 3 : y + 3) : y);
|
614
|
-
co.lineTo(Math.round(x + ((width / numticks) * i)), y + (align == 'bottom' ? 3 : -3));
|
615
|
-
}
|
616
|
-
co.stroke();
|
617
|
-
}
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
/**
|
622
|
-
* Draw the labels
|
623
|
-
*/
|
624
|
-
co.fillStyle = label_color;
|
625
|
-
|
626
|
-
if (labels) {
|
627
|
-
/**
|
628
|
-
* Draw the labels
|
629
|
-
*/
|
630
|
-
numlabels = labels.length;
|
631
|
-
var h = 0;
|
632
|
-
var l = 0;
|
633
|
-
var single_line = RG.MeasureText('Mg', false, font, size);
|
634
|
-
|
635
|
-
// Measure the maximum height
|
636
|
-
for (var i=0,len=labels.length; i<len; ++i) {
|
637
|
-
var dimensions = RG.MeasureText(labels[i], false, font, size);
|
638
|
-
var h = Math.max(h, dimensions[1]);
|
639
|
-
var l = Math.max(l, labels[i].split('\r\n').length);
|
640
|
-
}
|
641
|
-
|
642
|
-
|
643
|
-
for (var i=0,len=labels.length; i<len; ++i) {
|
644
|
-
RG.Text2(this,{'font': font,
|
645
|
-
'size': size,
|
646
|
-
'x': labels_position == 'edge' ? ((((width - hmargin - hmargin) / (labels.length - 1)) * i) + gutterLeft + hmargin) : ((((width - hmargin - hmargin) / labels.length) * i) + ((width / labels.length) / 2) + gutterLeft + hmargin),
|
647
|
-
'y':align == 'bottom' ? y + 3 : y - 3 - h + single_line[1],
|
648
|
-
'text':String(labels[i]),
|
649
|
-
'valign': align == 'bottom' ? 'top' : 'bottom',
|
650
|
-
'halign':'center',
|
651
|
-
'tag': 'labels'
|
652
|
-
});
|
653
|
-
}
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
/**
|
660
|
-
* No specific labels - draw a scale
|
661
|
-
*/
|
662
|
-
} else if (scale_visible){
|
663
|
-
|
664
|
-
if (max === null) {
|
665
|
-
alert('[DRAWING.XAXIS] If not specifying axis.labels you must specify axis.max!');
|
666
|
-
}
|
667
|
-
|
668
|
-
// yaxispos
|
669
|
-
if (yaxispos == 'center') {
|
670
|
-
width /= 2;
|
671
|
-
var additionalX = width;
|
672
|
-
} else {
|
673
|
-
var additionalX = 0;
|
674
|
-
}
|
675
|
-
|
676
|
-
for (var i=0; i<=numlabels; ++i) {
|
677
|
-
|
678
|
-
// Don't show zero if the chart.scale.zerostart option is false
|
679
|
-
if (i == 0 && !prop['chart.scale.zerostart']) {
|
680
|
-
continue;
|
681
|
-
}
|
682
|
-
|
683
|
-
var original = (((max - min) / numlabels) * i) + min;
|
684
|
-
var hmargin = prop['chart.hmargin'];
|
685
|
-
|
686
|
-
var text = String(typeof(formatter) == 'function' ? formatter(this, original) : RG.number_format(this, original.toFixed(decimals), units_pre, units_post));
|
687
|
-
|
688
|
-
if (invert) {
|
689
|
-
var x = ((width - hmargin - ((width - hmargin - hmargin) / numlabels) * i)) + gutterLeft + additionalX;
|
690
|
-
} else {
|
691
|
-
var x = (((width - hmargin - hmargin) / numlabels) * i) + gutterLeft + hmargin + additionalX;
|
692
|
-
}
|
693
|
-
|
694
|
-
RG.Text2(this,{'font': font,
|
695
|
-
'size': size,
|
696
|
-
'x': x,
|
697
|
-
'y': align == 'bottom' ? y + 3 : y - 3,
|
698
|
-
'text':text,
|
699
|
-
'valign':align == 'bottom' ? 'top' : 'bottom',
|
700
|
-
'halign':'center',
|
701
|
-
'tag': 'scale'
|
702
|
-
});
|
703
|
-
}
|
704
|
-
|
705
|
-
/**
|
706
|
-
* If the Y axis is in the center - this draws the left half of the labels
|
707
|
-
*/
|
708
|
-
if (yaxispos == 'center') {
|
709
|
-
for (var i=0; i<numlabels; ++i) {
|
710
|
-
|
711
|
-
var original = (((max - min) / numlabels) * (numlabels - i)) + min;
|
712
|
-
var hmargin = prop['chart.hmargin'];
|
713
|
-
|
714
|
-
var text = String(typeof(formatter) == 'function' ? formatter(this, original) : RG.number_format(this, original.toFixed(decimals), units_pre, units_post));
|
715
|
-
|
716
|
-
if (invert) {
|
717
|
-
var x = ((width - hmargin - ((width - hmargin - hmargin) / numlabels) * i)) + gutterLeft;
|
718
|
-
} else {
|
719
|
-
var x = (((width - hmargin - hmargin) / numlabels) * i) + gutterLeft + hmargin;
|
720
|
-
}
|
721
|
-
|
722
|
-
RG.Text2(this, {'font':font,
|
723
|
-
'size':size,
|
724
|
-
'x':x,
|
725
|
-
'y':align == 'bottom' ? y + size + 2 : y - size - 2,'text':'-' + text,
|
726
|
-
'valign':'center',
|
727
|
-
'halign':'center',
|
728
|
-
'tag': 'scale'
|
729
|
-
});
|
730
|
-
}
|
731
|
-
}
|
732
|
-
}
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
/**
|
737
|
-
* Draw the title for the axes
|
738
|
-
*/
|
739
|
-
if (title) {
|
740
|
-
|
741
|
-
var dimensions = RG.MeasureText(title, false, font, size + 2);
|
742
|
-
|
743
|
-
co.fillStyle = title_color
|
744
|
-
RG.Text2(this,{'font': font,
|
745
|
-
'size': size + 2,
|
746
|
-
'x': (ca.width - this.gutterLeft - this.gutterRight) / 2 + this.gutterLeft,
|
747
|
-
'y': align == 'bottom' ? y + dimensions[1] + 10 : y - dimensions[1] - 10,
|
748
|
-
'text': title,
|
749
|
-
'valign': 'center',
|
750
|
-
'halign':'center',
|
751
|
-
'tag': 'title'
|
752
|
-
});
|
753
|
-
}
|
754
|
-
};
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
/**
|
760
|
-
* Using a function to add events makes it easier to facilitate method chaining
|
761
|
-
*
|
762
|
-
* @param string type The type of even to add
|
763
|
-
* @param function func
|
764
|
-
*/
|
765
|
-
this.on = function (type, func)
|
766
|
-
{
|
767
|
-
if (type.substr(0,2) !== 'on') {
|
768
|
-
type = 'on' + type;
|
769
|
-
}
|
770
|
-
|
771
|
-
this[type] = func;
|
772
|
-
|
773
|
-
return this;
|
774
|
-
};
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
/**
|
780
|
-
* This function runs once only
|
781
|
-
* (put at the end of the file (before any effects))
|
782
|
-
*/
|
783
|
-
this.firstDrawFunc = function ()
|
784
|
-
{
|
785
|
-
};
|
786
|
-
|
787
|
-
|
788
|
-
RG.att(ca);
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
/**
|
796
|
-
* Objects are now always registered so that the chart is redrawn if need be.
|
797
|
-
*/
|
798
|
-
RG.Register(this);
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
/**
|
804
|
-
* This is the 'end' of the constructor so if the first argument
|
805
|
-
* contains configuration data - handle that.
|
806
|
-
*/
|
807
|
-
if (parseConfObjectForOptions) {
|
808
|
-
RG.parseObjectStyleConfig(this, conf.options);
|
809
|
-
}
|
810
|
-
};
|
2
|
+
RGraph=window.RGraph||{isRGraph:true};RGraph.Drawing=RGraph.Drawing||{};RGraph.Drawing.XAxis=function(conf)
|
3
|
+
{if(typeof conf==='object'&&typeof conf.y==='number'&&typeof conf.id==='string'){var id=conf.id
|
4
|
+
var y=conf.y;var parseConfObjectForOptions=true;}else{var id=conf;var y=arguments[1];}
|
5
|
+
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.y=y;this.coords=[];this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.type='drawing.xaxis';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.gutter.left':25,'chart.gutter.right':25,'chart.labels':null,'chart.labels.position':'section','chart.colors':['black'],'chart.title.color':null,'chart.text.color':null,'chart.text.font':'Segoe UI, Arial, Verdana, sans-serif','chart.text.size':12,'chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':true,'chart.align':'bottom','chart.numlabels':5,'chart.scale.visible':true,'chart.scale.formatter':null,'chart.scale.decimals':0,'chart.scale.point':'.','chart.scale.thousand':',','chart.scale.invert':false,'chart.scale.zerostart':true,'chart.units.pre':'','chart.units.post':'','chart.title':'','chart.numticks':null,'chart.hmargin':0,'chart.linewidth':1,'chart.noendtick.left':false,'chart.noendtick.right':false,'chart.noxaxis':false,'chart.max':null,'chart.min':0,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.events.click':null,'chart.events.mousemove':null,'chart.xaxispos':'bottom','chart.yaxispos':'left','chart.clearto':'rgba(0,0,0,0)'}
|
6
|
+
if(!this.canvas){alert('[DRAWING.XAXIS] No canvas support');return;}
|
7
|
+
this.$0={};if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
8
|
+
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
9
|
+
if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
|
10
|
+
this.set=this.Set=function(name)
|
11
|
+
{var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
|
12
|
+
if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
13
|
+
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
14
|
+
if(name=='chart.labels'&&!prop['chart.numxticks']){prop['chart.numxticks']=value.length;}
|
15
|
+
prop[name]=value;return this;};this.get=this.Get=function(name)
|
16
|
+
{if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
17
|
+
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
18
|
+
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
19
|
+
{RG.FireCustomEvent(this,'onbeforedraw');this.coordsText=[];this.gutterLeft=prop['chart.gutter.left'];this.gutterRight=prop['chart.gutter.right'];if(!prop['chart.text.color'])prop['chart.text.color']=prop['chart.colors'][0];if(!prop['chart.title.color'])prop['chart.title.color']=prop['chart.colors'][0];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
20
|
+
this.DrawXAxis();RG.InstallEventListeners(this);if(this.firstDraw){RG.fireCustomEvent(this,'onfirstdraw');this.firstDraw=false;this.firstDrawFunc();}
|
21
|
+
RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
22
|
+
{func(this);return this;};this.getObjectByXY=function(e)
|
23
|
+
{if(this.getShape(e)){return this;}};this.getShape=function(e)
|
24
|
+
{var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];if(mouseX>=this.gutterLeft&&mouseX<=(ca.width-this.gutterRight)&&mouseY>=this.y-(prop['chart.align']=='top'?(prop['chart.text.size']*1.5)+5:0)&&mouseY<=(this.y+(prop['chart.align']=='top'?0:(prop['chart.text.size']*1.5)+5))){var x=this.gutterLeft;var y=this.y;var w=ca.width-this.gutterLeft-this.gutterRight;var h=15;return{0:this,1:x,2:y,3:w,4:h,5:0,'object':this,'x':x,'y':y,'width':w,'height':h,'index':0,'tooltip':prop['chart.tooltips']?prop['chart.tooltips'][0]:null};}
|
25
|
+
return null;};this.highlight=this.Highlight=function(shape)
|
26
|
+
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}};this.parseColors=function()
|
27
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.array_clone(prop['chart.colors']);}
|
28
|
+
prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);};this.reset=function()
|
29
|
+
{};this.parseSingleColorForGradient=function(color)
|
30
|
+
{if(!color){return color;}
|
31
|
+
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(prop['chart.gutter.left'],0,ca.width-prop['chart.gutter.right'],0);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
|
32
|
+
return grad?grad:color;};this.drawXAxis=this.DrawXAxis=function()
|
33
|
+
{var gutterLeft=prop['chart.gutter.left'],gutterRight=prop['chart.gutter.right'],x=this.gutterLeft,y=this.y,min=+prop['chart.min'],max=+prop['chart.max'],labels=prop['chart.labels'],labels_position=prop['chart.labels.position'],color=prop['chart.colors'][0],title_color=prop['chart.title.color'],label_color=prop['chart.text.color'],width=ca.width-this.gutterLeft-this.gutterRight,font=prop['chart.text.font'],size=prop['chart.text.size'],align=prop['chart.align'],numlabels=prop['chart.numlabels'],formatter=prop['chart.scale.formatter'],decimals=Number(prop['chart.scale.decimals']),invert=prop['chart.scale.invert'],scale_visible=prop['chart.scale.visible'],units_pre=prop['chart.units.pre'],units_post=prop['chart.units.post'],title=prop['chart.title']
|
34
|
+
numticks=prop['chart.numticks'],hmargin=prop['chart.hmargin'],linewidth=prop['chart.linewidth'],noleftendtick=prop['chart.noendtick.left'],norightendtick=prop['chart.noendtick.right'],noxaxis=prop['chart.noxaxis'],xaxispos=prop['chart.xaxispos'],yaxispos=prop['chart.yaxispos']
|
35
|
+
if(RG.is_null(numticks)){if(labels&&labels.length){numticks=labels.length;}else if(!labels&&max!=0){numticks=10;}else{numticks=numlabels;}}
|
36
|
+
co.lineWidth=linewidth+0.001;co.strokeStyle=color;if(!noxaxis){pa2(co,['b','m',x,ma.round(y),'l',x+width,ma.round(y),'s',co.strokeStyle]);co.beginPath();for(var i=(noleftendtick?1:0);i<=(numticks-(norightendtick?1:0));++i){co.moveTo(ma.round(x+((width/numticks)*i)),xaxispos=='center'?(align=='bottom'?y-3:y+3):y);co.lineTo(ma.round(x+((width/numticks)*i)),y+(align=='bottom'?3:-3));}
|
37
|
+
co.stroke();}
|
38
|
+
co.fillStyle=label_color;if(labels){numlabels=labels.length;var h=0;var l=0;var single_line=RG.MeasureText('Mg',false,font,size);for(var i=0,len=labels.length;i<len;++i){var dimensions=RG.MeasureText(labels[i],false,font,size);var h=ma.max(h,dimensions[1]);var l=ma.max(l,labels[i].split('\r\n').length);}
|
39
|
+
for(var i=0,len=labels.length;i<len;++i){RG.text2(this,{'font':font,'size':size,'x':labels_position=='edge'?((((width-hmargin-hmargin)/(labels.length-1))*i)+gutterLeft+hmargin):((((width-hmargin-hmargin)/labels.length)*i)+((width/labels.length)/2)+gutterLeft+hmargin),'y':align=='bottom'?y+3:y-3-h+single_line[1],'text':String(labels[i]),'valign':align=='bottom'?'top':'bottom','halign':'center','tag':'labels'});}}else if(scale_visible){if(max===null){alert('[DRAWING.XAXIS] If not specifying axis.labels you must specify axis.max!');}
|
40
|
+
if(yaxispos=='center'){width/=2;var additionalX=width;}else{var additionalX=0;}
|
41
|
+
for(var i=0;i<=numlabels;++i){if(i==0&&!prop['chart.scale.zerostart']){continue;}
|
42
|
+
var original=(((max-min)/numlabels)*i)+min;var hmargin=prop['chart.hmargin'];var text=String(typeof(formatter)=='function'?formatter(this,original):RG.numberFormat(this,original.toFixed(original===0?0:decimals),units_pre,units_post));if(invert){var x=((width-hmargin-((width-hmargin-hmargin)/numlabels)*i))+gutterLeft+additionalX;}else{var x=(((width-hmargin-hmargin)/numlabels)*i)+gutterLeft+hmargin+additionalX;}
|
43
|
+
RG.Text2(this,{'font':font,'size':size,'x':x,'y':align=='bottom'?y+3:y-3,'text':text,'valign':align=='bottom'?'top':'bottom','halign':'center','tag':'scale'});}
|
44
|
+
if(yaxispos=='center'){for(var i=0;i<numlabels;++i){var original=(((max-min)/numlabels)*(numlabels-i))+min;var hmargin=prop['chart.hmargin'];var text=String(typeof(formatter)=='function'?formatter(this,original):RG.number_format(this,original.toFixed(decimals),units_pre,units_post));if(invert){var x=((width-hmargin-((width-hmargin-hmargin)/numlabels)*i))+gutterLeft;}else{var x=(((width-hmargin-hmargin)/numlabels)*i)+gutterLeft+hmargin;}
|
45
|
+
RG.text2(this,{'font':font,'size':size,'x':x,'y':align=='bottom'?y+size+2:y-size-2,'text':'-'+text,'valign':'center','halign':'center','tag':'scale'});}}}
|
46
|
+
if(title){var dimensions=RG.MeasureText(title,false,font,size+2);co.fillStyle=title_color
|
47
|
+
RG.Text2(this,{'font':font,'size':size+2,'x':(ca.width-this.gutterLeft-this.gutterRight)/2+this.gutterLeft,'y':align=='bottom'?y+dimensions[1]+10:y-dimensions[1]-10,'text':title,'valign':'center','halign':'center','tag':'title'});}};this.on=function(type,func)
|
48
|
+
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
49
|
+
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
50
|
+
return this;};this.firstDrawFunc=function()
|
51
|
+
{};RG.att(ca);RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|