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,455 +1,36 @@
|
|
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 starts at just 99 GBP and |
|
11
|
-
* | you can read about it here: |
|
12
|
-
* | |
|
13
|
-
* | http://www.rgraph.net/license |
|
14
|
-
* o--------------------------------------------------------------------------------o
|
15
|
-
*/
|
16
1
|
|
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
|
-
// Handle undefined - change it to an empty string
|
54
|
-
if ((typeof(text) != 'string' && typeof(text) != 'number') || text == 'undefined') {
|
55
|
-
return;
|
56
|
-
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
/**
|
62
|
-
* This accommodates multi-line text
|
63
|
-
*/
|
64
|
-
if (typeof(text) == 'string' && text.match(/\r\n/)) {
|
65
|
-
|
66
|
-
var dimensions = RGraph.MeasureText('M', args[11], font, size);
|
67
|
-
|
68
|
-
/**
|
69
|
-
* Measure the text (width and height)
|
70
|
-
*/
|
71
|
-
|
72
|
-
var arr = text.split('\r\n');
|
73
|
-
|
74
|
-
/**
|
75
|
-
* Adjust the Y position
|
76
|
-
*/
|
77
|
-
|
78
|
-
// This adjusts the initial y position
|
79
|
-
if (args[6] && args[6] == 'center') y = (y - (dimensions[1] * ((arr.length - 1) / 2)));
|
80
|
-
|
81
|
-
for (var i=1; i<arr.length; ++i) {
|
82
|
-
|
83
|
-
RGraph.Text(context,
|
84
|
-
font,
|
85
|
-
size,
|
86
|
-
args[9] == -90 ? (x + (size * 1.5)) : x,
|
87
|
-
y + (dimensions[1] * i),
|
88
|
-
arr[i],
|
89
|
-
args[6] ? args[6] : null,
|
90
|
-
args[7],
|
91
|
-
args[8],
|
92
|
-
args[9],
|
93
|
-
args[10],
|
94
|
-
args[11],
|
95
|
-
args[12]);
|
96
|
-
}
|
97
|
-
|
98
|
-
// Update text to just be the first line
|
99
|
-
text = arr[0];
|
100
|
-
}
|
101
|
-
|
102
|
-
|
103
|
-
// Accommodate MSIE
|
104
|
-
if (document.all && RGraph.ISOLD) {
|
105
|
-
y += 2;
|
106
|
-
}
|
107
|
-
|
108
|
-
|
109
|
-
context.font = (args[11] ? 'Bold ': '') + size + 'pt ' + font;
|
110
|
-
|
111
|
-
var i;
|
112
|
-
var origX = x;
|
113
|
-
var origY = y;
|
114
|
-
var originalFillStyle = context.fillStyle;
|
115
|
-
var originalLineWidth = context.lineWidth;
|
116
|
-
|
117
|
-
// Need these now the angle can be specified, ie defaults for the former two args
|
118
|
-
if (typeof(args[6]) == 'undefined') args[6] = 'bottom'; // Vertical alignment. Default to bottom/baseline
|
119
|
-
if (typeof(args[7]) == 'undefined') args[7] = 'left'; // Horizontal alignment. Default to left
|
120
|
-
if (typeof(args[8]) == 'undefined') args[8] = null; // Show a bounding box. Useful for positioning during development. Defaults to false
|
121
|
-
if (typeof(args[9]) == 'undefined') args[9] = 0; // Angle (IN DEGREES) that the text should be drawn at. 0 is middle right, and it goes clockwise
|
122
|
-
|
123
|
-
// The alignment is recorded here for purposes of Opera compatibility
|
124
|
-
if (navigator.userAgent.indexOf('Opera') != -1) {
|
125
|
-
context.canvas.__rgraph_valign__ = args[6];
|
126
|
-
context.canvas.__rgraph_halign__ = args[7];
|
127
|
-
}
|
128
|
-
|
129
|
-
// First, translate to x/y coords
|
130
|
-
context.save();
|
131
|
-
|
132
|
-
context.canvas.__rgraph_originalx__ = x;
|
133
|
-
context.canvas.__rgraph_originaly__ = y;
|
134
|
-
|
135
|
-
context.translate(x, y);
|
136
|
-
x = 0;
|
137
|
-
y = 0;
|
138
|
-
|
139
|
-
// Rotate the canvas if need be
|
140
|
-
if (args[9]) {
|
141
|
-
context.rotate(args[9] / (180 / RGraph.PI));
|
142
|
-
}
|
143
|
-
|
144
|
-
|
145
|
-
// Vertical alignment - defaults to bottom
|
146
|
-
if (args[6]) {
|
147
|
-
|
148
|
-
var vAlign = args[6];
|
149
|
-
|
150
|
-
if (vAlign == 'center') {
|
151
|
-
context.textBaseline = 'middle';
|
152
|
-
} else if (vAlign == 'top') {
|
153
|
-
context.textBaseline = 'top';
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
|
158
|
-
// Hoeizontal alignment - defaults to left
|
159
|
-
if (args[7]) {
|
160
|
-
|
161
|
-
var hAlign = args[7];
|
162
|
-
var width = context.measureText(text).width;
|
163
|
-
|
164
|
-
if (hAlign) {
|
165
|
-
if (hAlign == 'center') {
|
166
|
-
context.textAlign = 'center';
|
167
|
-
} else if (hAlign == 'right') {
|
168
|
-
context.textAlign = 'right';
|
169
|
-
}
|
170
|
-
}
|
171
|
-
}
|
172
|
-
|
173
|
-
|
174
|
-
context.fillStyle = originalFillStyle;
|
175
|
-
|
176
|
-
/**
|
177
|
-
* Draw a bounding box if requested
|
178
|
-
*/
|
179
|
-
context.save();
|
180
|
-
context.fillText(text,0,0);
|
181
|
-
context.lineWidth = 1;
|
182
|
-
|
183
|
-
var width = context.measureText(text).width;
|
184
|
-
var width_offset = (hAlign == 'center' ? (width / 2) : (hAlign == 'right' ? width : 0));
|
185
|
-
var height = size * 1.5; // !!!
|
186
|
-
var height_offset = (vAlign == 'center' ? (height / 2) : (vAlign == 'top' ? height : 0));
|
187
|
-
var ieOffset = RGraph.ISOLD ? 2 : 0;
|
188
|
-
|
189
|
-
if (args[8]) {
|
190
|
-
|
191
|
-
context.strokeRect(-3 - width_offset,
|
192
|
-
0 - 3 - height - ieOffset + height_offset,
|
193
|
-
width + 6,
|
194
|
-
height + 6);
|
195
|
-
/**
|
196
|
-
* If requested, draw a background for the text
|
197
|
-
*/
|
198
|
-
if (args[10]) {
|
199
|
-
context.fillStyle = args[10];
|
200
|
-
context.fillRect(-3 - width_offset,
|
201
|
-
0 - 3 - height - ieOffset + height_offset,
|
202
|
-
width + 6,
|
203
|
-
height + 6);
|
204
|
-
}
|
205
|
-
|
206
|
-
|
207
|
-
context.fillStyle = originalFillStyle;
|
208
|
-
|
209
|
-
|
210
|
-
/**
|
211
|
-
* Do the actual drawing of the text
|
212
|
-
*/
|
213
|
-
context.fillText(text,0,0);
|
214
|
-
}
|
215
|
-
context.restore();
|
216
|
-
|
217
|
-
// Reset the lineWidth
|
218
|
-
context.lineWidth = originalLineWidth;
|
219
|
-
|
220
|
-
context.restore();
|
221
|
-
};
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
/**
|
227
|
-
* This function returns the mouse position in relation to the canvas
|
228
|
-
*
|
229
|
-
* @param object e The event object.
|
230
|
-
*/
|
231
|
-
RG.getMouseXY = function (e)
|
232
|
-
{
|
233
|
-
var el = (RGraph.ISOLD ? event.srcElement : e.target);
|
234
|
-
var x;
|
235
|
-
var y;
|
236
|
-
|
237
|
-
// ???
|
238
|
-
var paddingLeft = el.style.paddingLeft ? parseInt(el.style.paddingLeft) : 0;
|
239
|
-
var paddingTop = el.style.paddingTop ? parseInt(el.style.paddingTop) : 0;
|
240
|
-
var borderLeft = el.style.borderLeftWidth ? parseInt(el.style.borderLeftWidth) : 0;
|
241
|
-
var borderTop = el.style.borderTopWidth ? parseInt(el.style.borderTopWidth) : 0;
|
242
|
-
|
243
|
-
if (RGraph.ISIE8) e = event;
|
244
|
-
|
245
|
-
// Browser with offsetX and offsetY
|
246
|
-
if (typeof(e.offsetX) == 'number' && typeof(e.offsetY) == 'number') {
|
247
|
-
x = e.offsetX;
|
248
|
-
y = e.offsetY;
|
249
|
-
|
250
|
-
// FF and other
|
251
|
-
} else {
|
252
|
-
x = 0;
|
253
|
-
y = 0;
|
254
|
-
|
255
|
-
while (el != document.body && el) {
|
256
|
-
x += el.offsetLeft;
|
257
|
-
y += el.offsetTop;
|
258
|
-
|
259
|
-
el = el.offsetParent;
|
260
|
-
}
|
261
|
-
|
262
|
-
x = e.pageX - x;
|
263
|
-
y = e.pageY - y;
|
264
|
-
}
|
265
|
-
|
266
|
-
return [x, y];
|
267
|
-
};
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
/**
|
273
|
-
* This function attempts to "fill in" missing functions from the canvas
|
274
|
-
* context object. Only two at the moment - measureText() nd fillText().
|
275
|
-
*
|
276
|
-
* @param object context The canvas 2D context
|
277
|
-
*/
|
278
|
-
RG.oldBrowserCompat =
|
279
|
-
RG.OldBrowserCompat = function (co)
|
280
|
-
{
|
281
|
-
if (!co) {
|
282
|
-
return;
|
283
|
-
}
|
284
|
-
|
285
|
-
if (!co.measureText) {
|
286
|
-
|
287
|
-
// This emulates the measureText() function
|
288
|
-
co.measureText = function (text)
|
289
|
-
{
|
290
|
-
var textObj = document.createElement('DIV');
|
291
|
-
textObj.innerHTML = text;
|
292
|
-
textObj.style.position = 'absolute';
|
293
|
-
textObj.style.top = '-100px';
|
294
|
-
textObj.style.left = 0;
|
295
|
-
document.body.appendChild(textObj);
|
296
|
-
|
297
|
-
var width = {width: textObj.offsetWidth};
|
298
|
-
|
299
|
-
textObj.style.display = 'none';
|
300
|
-
|
301
|
-
return width;
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
|
-
if (!co.fillText) {
|
306
|
-
// This emulates the fillText() method
|
307
|
-
co.fillText = function (text, targetX, targetY)
|
308
|
-
{
|
309
|
-
return false;
|
310
|
-
}
|
311
|
-
}
|
312
|
-
|
313
|
-
// If IE8, add addEventListener()
|
314
|
-
if (!co.canvas.addEventListener) {
|
315
|
-
window.addEventListener = function (ev, func, bubble)
|
316
|
-
{
|
317
|
-
return this.attachEvent('on' + ev, func);
|
318
|
-
}
|
319
|
-
|
320
|
-
co.canvas.addEventListener = function (ev, func, bubble)
|
321
|
-
{
|
322
|
-
return this.attachEvent('on' + ev, func);
|
323
|
-
}
|
324
|
-
}
|
325
|
-
};
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
/**
|
331
|
-
* Similar to the jQuery each() function - this lets you iterate easily over an array. The 'this' variable is set]
|
332
|
-
* to the array in the callback function.
|
333
|
-
*
|
334
|
-
* @param array arr The array
|
335
|
-
* @param function func The function to call
|
336
|
-
* @param object Optionally you can specify the object that the "this" variable is set to
|
337
|
-
*/
|
338
|
-
RG.each = function (arr, func)
|
339
|
-
{
|
340
|
-
for(var i=0, len=arr.length; i<len; i+=1) {
|
341
|
-
|
342
|
-
if (typeof arguments[2] !== 'undefined') {
|
343
|
-
var ret = func.call(arguments[2], i, arr[i]);
|
344
|
-
} else {
|
345
|
-
var ret = func.call(arr, i, arr[i]);
|
346
|
-
}
|
347
|
-
|
348
|
-
if (ret === false) {
|
349
|
-
return;
|
350
|
-
}
|
351
|
-
}
|
352
|
-
};
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
/**
|
358
|
-
* An old function the was used before all 4 gutters were added
|
359
|
-
*
|
360
|
-
* DEPRECATED
|
361
|
-
*
|
362
|
-
* @param object obj The chart object
|
363
|
-
*/
|
364
|
-
RG.getHeight =
|
365
|
-
RG.GetHeight = function (obj)
|
366
|
-
{
|
367
|
-
return obj.canvas.height;
|
368
|
-
};
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
/**
|
374
|
-
* An old function the was used before all 4 gutters were added
|
375
|
-
*
|
376
|
-
* DEPRECATED
|
377
|
-
*
|
378
|
-
* @param object obj The chart object
|
379
|
-
*/
|
380
|
-
RG.getWidth =
|
381
|
-
RG.GetWidth = function (obj)
|
382
|
-
{
|
383
|
-
return obj.canvas.width;
|
384
|
-
};
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
/**
|
390
|
-
* A timer function for measuring... time!
|
391
|
-
*
|
392
|
-
* @param string label A string to associate with this 'checkpoint'
|
393
|
-
*/
|
394
|
-
RG.timer =
|
395
|
-
RG.Timer = function (label)
|
396
|
-
{
|
397
|
-
if(typeof RG.TIMER_LAST_CHECKPOINT == 'undefined') {
|
398
|
-
|
399
|
-
RG.TIMER_LAST_CHECKPOINT = Date.now();
|
400
|
-
}
|
401
|
-
|
402
|
-
var now = Date.now();
|
403
|
-
|
404
|
-
console.log(label+': ' + (now - RG.TIMER_LAST_CHECKPOINT).toString());
|
405
|
-
|
406
|
-
RG.TIMER_LAST_CHECKPOINT = now;
|
407
|
-
};
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
/**
|
413
|
-
* If you prefer, you can use the SetConfig() method to set the configuration information
|
414
|
-
* for your chart. You may find that setting the configuration this way eases reuse.
|
415
|
-
*
|
416
|
-
* @param object obj The graph object
|
417
|
-
* @param object config The graph configuration information
|
418
|
-
*/
|
419
|
-
RG.setConfig =
|
420
|
-
RG.SetConfig = function (obj, config)
|
421
|
-
{
|
422
|
-
for (i in config) {
|
423
|
-
if (typeof i === 'string') {
|
424
|
-
obj.Set(i, config[i]);
|
425
|
-
}
|
426
|
-
}
|
427
|
-
|
428
|
-
return obj;
|
429
|
-
};
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
// End module pattern
|
435
|
-
})(window, document);
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
/**
|
441
|
-
* Checks whether strings or numbers are empty or not. It also
|
442
|
-
* handles null or variables set to undefined. If a variable really
|
443
|
-
* is undefined - ie it hasn't been declared at all - you need to use
|
444
|
-
* "typeof variable" and check the return value - which will be undefined.
|
445
|
-
*
|
446
|
-
* @param mixed value The variable to check
|
447
|
-
*/
|
448
|
-
window.$empty = function (value)
|
449
|
-
{
|
450
|
-
if (!value || value.length <= 0) {
|
451
|
-
return true;
|
452
|
-
}
|
453
|
-
|
454
|
-
return false;
|
455
|
-
};
|
2
|
+
RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
|
3
|
+
{var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.text=RG.Text=function(context,font,size,x,y,text)
|
4
|
+
{var args=arguments;if((typeof(text)!='string'&&typeof(text)!='number')||text=='undefined'){return;}
|
5
|
+
if(typeof(text)=='string'&&text.match(/\r\n/)){var dimensions=RGraph.MeasureText('M',args[11],font,size);var arr=text.split('\r\n');if(args[6]&&args[6]=='center')y=(y-(dimensions[1]*((arr.length-1)/2)));for(var i=1;i<arr.length;++i){RGraph.Text(context,font,size,args[9]==-90?(x+(size*1.5)):x,y+(dimensions[1]*i),arr[i],args[6]?args[6]:null,args[7],args[8],args[9],args[10],args[11],args[12]);}
|
6
|
+
text=arr[0];}
|
7
|
+
if(document.all&&RGraph.ISOLD){y+=2;}
|
8
|
+
context.font=(args[11]?'Bold ':'')+size+'pt '+font;var i;var origX=x;var origY=y;var originalFillStyle=context.fillStyle;var originalLineWidth=context.lineWidth;if(typeof(args[6])=='undefined')args[6]='bottom';if(typeof(args[7])=='undefined')args[7]='left';if(typeof(args[8])=='undefined')args[8]=null;if(typeof(args[9])=='undefined')args[9]=0;if(navigator.userAgent.indexOf('Opera')!=-1){context.canvas.__rgraph_valign__=args[6];context.canvas.__rgraph_halign__=args[7];}
|
9
|
+
context.save();context.canvas.__rgraph_originalx__=x;context.canvas.__rgraph_originaly__=y;context.translate(x,y);x=0;y=0;if(args[9]){context.rotate(args[9]/(180/RGraph.PI));}
|
10
|
+
if(args[6]){var vAlign=args[6];if(vAlign=='center'){context.textBaseline='middle';}else if(vAlign=='top'){context.textBaseline='top';}}
|
11
|
+
if(args[7]){var hAlign=args[7];var width=context.measureText(text).width;if(hAlign){if(hAlign=='center'){context.textAlign='center';}else if(hAlign=='right'){context.textAlign='right';}}}
|
12
|
+
context.fillStyle=originalFillStyle;context.save();context.fillText(text,0,0);context.lineWidth=1;var width=context.measureText(text).width;var width_offset=(hAlign=='center'?(width/2):(hAlign=='right'?width:0));var height=size*1.5;var height_offset=(vAlign=='center'?(height/2):(vAlign=='top'?height:0));var ieOffset=RGraph.ISOLD?2:0;if(args[8]){context.strokeRect(-3-width_offset,0-3-height-ieOffset+height_offset,width+6,height+6);if(args[10]){context.fillStyle=args[10];context.fillRect(-3-width_offset,0-3-height-ieOffset+height_offset,width+6,height+6);}
|
13
|
+
context.fillStyle=originalFillStyle;context.fillText(text,0,0);}
|
14
|
+
context.restore();context.lineWidth=originalLineWidth;context.restore();};RG.getMouseXY=function(e)
|
15
|
+
{var el=(RGraph.ISOLD?event.srcElement:e.target);var x;var y;var paddingLeft=el.style.paddingLeft?parseInt(el.style.paddingLeft):0;var paddingTop=el.style.paddingTop?parseInt(el.style.paddingTop):0;var borderLeft=el.style.borderLeftWidth?parseInt(el.style.borderLeftWidth):0;var borderTop=el.style.borderTopWidth?parseInt(el.style.borderTopWidth):0;if(RGraph.ISIE8)e=event;if(typeof(e.offsetX)=='number'&&typeof(e.offsetY)=='number'){x=e.offsetX;y=e.offsetY;}else{x=0;y=0;while(el!=document.body&&el){x+=el.offsetLeft;y+=el.offsetTop;el=el.offsetParent;}
|
16
|
+
x=e.pageX-x;y=e.pageY-y;}
|
17
|
+
return[x,y];};RG.oldBrowserCompat=RG.OldBrowserCompat=function(co)
|
18
|
+
{if(!co){return;}
|
19
|
+
if(!co.measureText){co.measureText=function(text)
|
20
|
+
{var textObj=document.createElement('DIV');textObj.innerHTML=text;textObj.style.position='absolute';textObj.style.top='-100px';textObj.style.left=0;document.body.appendChild(textObj);var width={width:textObj.offsetWidth};textObj.style.display='none';return width;}}
|
21
|
+
if(!co.fillText){co.fillText=function(text,targetX,targetY)
|
22
|
+
{return false;}}
|
23
|
+
if(!co.canvas.addEventListener){window.addEventListener=function(ev,func,bubble)
|
24
|
+
{return this.attachEvent('on'+ev,func);}
|
25
|
+
co.canvas.addEventListener=function(ev,func,bubble)
|
26
|
+
{return this.attachEvent('on'+ev,func);}}};RG.each=function(arr,func)
|
27
|
+
{for(var i=0,len=arr.length;i<len;i+=1){if(typeof arguments[2]!=='undefined'){var ret=func.call(arguments[2],i,arr[i]);}else{var ret=func.call(arr,i,arr[i]);}
|
28
|
+
if(ret===false){return;}}};RG.getHeight=RG.GetHeight=function(obj)
|
29
|
+
{return obj.canvas.height;};RG.getWidth=RG.GetWidth=function(obj)
|
30
|
+
{return obj.canvas.width;};RG.timer=RG.Timer=function(label)
|
31
|
+
{if(typeof RG.TIMER_LAST_CHECKPOINT=='undefined'){RG.TIMER_LAST_CHECKPOINT=Date.now();}
|
32
|
+
var now=Date.now();console.log(label+': '+(now-RG.TIMER_LAST_CHECKPOINT).toString());RG.TIMER_LAST_CHECKPOINT=now;};RG.setConfig=RG.SetConfig=function(obj,config)
|
33
|
+
{for(i in config){if(typeof i==='string'){obj.Set(i,config[i]);}}
|
34
|
+
return obj;};})(window,document);window.$empty=function(value)
|
35
|
+
{if(!value||value.length<=0){return true;}
|
36
|
+
return false;};
|