rgraph-rails 5.00 → 6.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish-geml.yaml +46 -0
  3. data/.gitignore +1 -0
  4. data/README.md +4 -5
  5. data/lib/rgraph-rails/version.rb +1 -1
  6. data/rgraph-rails.gemspec +4 -4
  7. data/vendor/assets/javascripts/RGraph.activity.js +1691 -0
  8. data/vendor/assets/javascripts/RGraph.bar.js +4253 -236
  9. data/vendor/assets/javascripts/RGraph.bipolar.js +3958 -162
  10. data/vendor/assets/javascripts/RGraph.common.annotate.js +414 -35
  11. data/vendor/assets/javascripts/RGraph.common.context.js +635 -30
  12. data/vendor/assets/javascripts/RGraph.common.core.js +10485 -419
  13. data/vendor/assets/javascripts/RGraph.common.csv.js +508 -27
  14. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1693 -90
  15. data/vendor/assets/javascripts/RGraph.common.effects.js +1629 -89
  16. data/vendor/assets/javascripts/RGraph.common.key.js +1003 -53
  17. data/vendor/assets/javascripts/RGraph.common.moment.js +5670 -0
  18. data/vendor/assets/javascripts/RGraph.common.sheets.js +541 -31
  19. data/vendor/assets/javascripts/RGraph.common.sheets.php +351 -0
  20. data/vendor/assets/javascripts/RGraph.common.starburst.js +382 -0
  21. data/vendor/assets/javascripts/RGraph.common.table.js +386 -0
  22. data/vendor/assets/javascripts/RGraph.common.tooltips.js +1433 -32
  23. data/vendor/assets/javascripts/RGraph.drawing.background.js +660 -35
  24. data/vendor/assets/javascripts/RGraph.drawing.circle.js +618 -34
  25. data/vendor/assets/javascripts/RGraph.drawing.image.js +857 -52
  26. data/vendor/assets/javascripts/RGraph.drawing.line.js +712 -0
  27. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +760 -38
  28. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +740 -37
  29. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +573 -36
  30. data/vendor/assets/javascripts/RGraph.drawing.poly.js +667 -36
  31. data/vendor/assets/javascripts/RGraph.drawing.rect.js +638 -34
  32. data/vendor/assets/javascripts/RGraph.drawing.text.js +672 -37
  33. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +653 -52
  34. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +714 -51
  35. data/vendor/assets/javascripts/RGraph.fuel.js +1149 -59
  36. data/vendor/assets/javascripts/RGraph.funnel.js +1277 -56
  37. data/vendor/assets/javascripts/RGraph.gantt.js +1646 -82
  38. data/vendor/assets/javascripts/RGraph.gauge.js +1773 -89
  39. data/vendor/assets/javascripts/RGraph.hbar.js +3869 -159
  40. data/vendor/assets/javascripts/RGraph.horseshoe.js +970 -0
  41. data/vendor/assets/javascripts/RGraph.hprogress.js +1829 -81
  42. data/vendor/assets/javascripts/RGraph.line.js +5293 -244
  43. data/vendor/assets/javascripts/RGraph.meter.js +1570 -77
  44. data/vendor/assets/javascripts/RGraph.modaldialog.js +300 -19
  45. data/vendor/assets/javascripts/RGraph.odo.js +1553 -68
  46. data/vendor/assets/javascripts/RGraph.pie.js +3273 -129
  47. data/vendor/assets/javascripts/RGraph.radar.js +2333 -108
  48. data/vendor/assets/javascripts/RGraph.rose.js +2685 -114
  49. data/vendor/assets/javascripts/RGraph.rscatter.js +1920 -80
  50. data/vendor/assets/javascripts/RGraph.scatter.js +4215 -171
  51. data/vendor/assets/javascripts/RGraph.segmented.js +1006 -0
  52. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1980 -59
  53. data/vendor/assets/javascripts/RGraph.svg.activity.js +1696 -0
  54. data/vendor/assets/javascripts/RGraph.svg.bar.js +2575 -77
  55. data/vendor/assets/javascripts/RGraph.svg.bipolar.js +3533 -106
  56. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +240 -21
  57. data/vendor/assets/javascripts/RGraph.svg.common.core.js +7105 -299
  58. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +408 -28
  59. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +1291 -68
  60. data/vendor/assets/javascripts/RGraph.svg.common.key.js +451 -20
  61. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +543 -31
  62. data/vendor/assets/javascripts/RGraph.svg.common.table.js +391 -0
  63. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +1072 -23
  64. data/vendor/assets/javascripts/RGraph.svg.funnel.js +1151 -32
  65. data/vendor/assets/javascripts/RGraph.svg.gauge.js +1429 -34
  66. data/vendor/assets/javascripts/RGraph.svg.hbar.js +2692 -65
  67. data/vendor/assets/javascripts/RGraph.svg.horseshoe.js +969 -0
  68. data/vendor/assets/javascripts/RGraph.svg.line.js +2855 -86
  69. data/vendor/assets/javascripts/RGraph.svg.pie.js +1630 -58
  70. data/vendor/assets/javascripts/RGraph.svg.radar.js +1772 -58
  71. data/vendor/assets/javascripts/RGraph.svg.rose.js +2419 -83
  72. data/vendor/assets/javascripts/RGraph.svg.scatter.js +2280 -65
  73. data/vendor/assets/javascripts/RGraph.svg.segmented.js +930 -0
  74. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +1612 -29
  75. data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1525 -50
  76. data/vendor/assets/javascripts/RGraph.thermometer.js +1411 -64
  77. data/vendor/assets/javascripts/RGraph.vprogress.js +1915 -81
  78. data/vendor/assets/javascripts/RGraph.waterfall.js +1896 -89
  79. data/vendor/assets/javascripts/financial-data.js +1067 -0
  80. metadata +37 -16
  81. data/.travis.yml +0 -11
  82. data/vendor/assets/javascripts/RGraph.common.deprecated.js +0 -35
  83. data/vendor/assets/javascripts/RGraph.common.resizing.js +0 -38
  84. data/vendor/assets/javascripts/RGraph.common.zoom.js +0 -15
  85. data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
@@ -1,37 +1,574 @@
1
+ 'version:2023-09-16 (6.14)';
2
+ //
3
+ // o--------------------------------------------------------------------------------o
4
+ // | This file is part of the RGraph package - you can learn more at: |
5
+ // | |
6
+ // | https://www.rgraph.net |
7
+ // | |
8
+ // | RGraph is licensed under the Open Source MIT license. That means that it's |
9
+ // | totally free to use and there are no restrictions on what you can do with it! |
10
+ // o--------------------------------------------------------------------------------o
1
11
 
2
- RGraph=window.RGraph||{isRGraph:true};RGraph.Drawing=RGraph.Drawing||{};RGraph.Drawing.Marker3=function(conf)
3
- {if(typeof conf==='object'&&typeof conf.x==='number'&&typeof conf.y==='number'&&typeof conf.id==='string'&&typeof conf.radius==='number'){var id=conf.id,canvas=document.getElementById(id),x=conf.x,y=conf.y,radius=conf.radius,parseConfObjectForOptions=true;}else{var id=conf,canvas=document.getElementById(id),x=arguments[1],y=arguments[2],radius=arguments[3];}
4
- this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d')
5
- this.colorsParsed=false;this.canvas.__object__=this;this.original_colors=[];this.firstDraw=true;this.propertyNameAliases={};this.actualRadius=0;this.alpha=1;this.centerx=x;this.centery=y;this.radius=radius;this.type='drawing.marker3';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.createUID();this.properties={'chart.colors.fill':'white','chart.delay':50,'chart.events.click':null,'chart.events.mousemove':null,'chart.highlight.fill':'rgba(255,0,0,1.0)','chart.tooltips':null,'chart.tooltips.highlight':true,'chart.tooltips.event':'onclick','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.clearto':'rgba(0,0,0,0)'}
6
- if(!this.canvas){alert('[DRAWING.MARKER3] No canvas support');return;}
7
- this.coords=[];this.coordsText=[];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;if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
9
- this.set=this.Set=function(name)
10
- {var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
11
- if(name.substr(0,6)!='chart.'){name='chart.'+name;}
12
- while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
13
- prop[name]=value;return this;};this.get=this.Get=function(name)
14
- {if(name.substr(0,6)!='chart.'){name='chart.'+name;}
15
- while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
16
- return prop[name.toLowerCase()];};this.draw=this.Draw=function()
17
- {co.globalAlpha=this.alpha;pa2(co,['b','a',this.centerx,this.centery,this.actualRadius,0,2*Math.PI,false,'a',this.centerx,this.centery,ma.max(this.actualRadius-8,0),2*Math.PI,0,true,'f',prop['chart.colors.fill']]);this.alpha=this.actualRadius?1-((this.actualRadius*0.75)/this.radius):1;co.globalAlpha=1;if(this.actualRadius<this.radius){this.actualRadius+=2;}else if(this.actualRadius>=this.radius){this.actualRadius=0;this.alpha=1;}
18
- if(!this.TIMER){var obj=this;setInterval(function()
19
- {RG.redrawCanvas(ca);},prop['chart.delay']);this.TIMER=true;}
20
- RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');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),mouseX=mouseXY[0],mouseY=mouseXY[1];if(RG.getHypLength(this.centerx,this.centery,mouseXY[0],mouseXY[1])<=this.radius){return{0:this,1:this.centerx,2:this.centery,3:this.radius,4:null,5:0,'object':this,'x':this.centerx,'y':this.centery,'radius':this.radius,'index':0,'tooltip':prop['chart.tooltips']?prop['chart.tooltips'][0]:null};}
25
- return null;};this.highlight=this.Highlight=function(shape)
26
- {if(prop['chart.tooltips.highlight']){if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{pa2(co,['b','r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.highlight.fill'],'s',prop['chart.highlight.stroke']]);}}};this.parseColors=function()
27
- {if(this.original_colors.length===0){this.original_colors['chart.colors.fill']=RG.arrayClone(prop['chart.colors.fill']);this.original_colors['chart.highlight.fill']=RG.arrayClone(prop['chart.highlight.fill']);}
28
- prop['chart.colors.fill']=this.parseSingleColorForGradient(prop['chart.colors.fill']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);};this.reset=function()
29
- {};this.parseSingleColorForGradient=function(color)
30
- {if(!color){return color;}
31
- if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
32
- var parts=RegExp.$1.split(':'),grad=co.createRadialGradient(this.centerx,this.centery,0,this.centerx,this.centery,this.radius),diff=1/(parts.length-1);for(var j=0;j<parts.length;j+=1){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
33
- return grad?grad:color;};this.on=function(type,func)
34
- {if(type.substr(0,2)!=='on'){type='on'+type;}
35
- if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
36
- return this;};this.firstDrawFunc=function()
37
- {};RG.register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
12
+
13
+ //
14
+ // Having this here means that the RGraph libraries can be included in any order, instead of you having
15
+ // to include the common core library first.
16
+ //
17
+
18
+ // Define the RGraph global variable
19
+ RGraph = window.RGraph || {isrgraph:true,isRGraph: true,rgraph:true};
20
+ RGraph.Drawing = RGraph.Drawing || {};
21
+
22
+ //
23
+ // The constructor. This function sets up the object.
24
+ //
25
+ RGraph.Drawing.Marker3 = function (conf)
26
+ {
27
+ var id = conf.id,
28
+ canvas = document.getElementById(id),
29
+ x = conf.x,
30
+ y = conf.y,
31
+ radius = conf.radius;
32
+
33
+ this.id = id;
34
+ this.canvas = document.getElementById(this.id);
35
+ this.context = this.canvas.getContext('2d')
36
+ this.colorsParsed = false;
37
+ this.canvas.__object__ = this;
38
+ this.original_colors = [];
39
+ this.firstDraw = true; // After the first draw this will be false
40
+
41
+
42
+ // The actual radius is what is used to draw the marker - the other radius is the maximum target radius
43
+ // that the marker grows to
44
+ this.actualRadius = 0;
45
+
46
+ // This is the alpha value that is used to fade out the pulsing marker
47
+ this.alpha = 1;
48
+
49
+
50
+ //
51
+ // Store the properties
52
+ //
53
+ this.centerx = x;
54
+ this.centery = y;
55
+ this.radius = radius;
56
+
57
+
58
+ //
59
+ // This defines the type of this shape
60
+ //
61
+ this.type = 'drawing.marker3';
62
+
63
+
64
+ //
65
+ // This facilitates easy object identification, and should always be true
66
+ //
67
+ this.isRGraph = true;
68
+ this.isrgraph = true;
69
+ this.rgraph = true;
70
+
71
+
72
+ //
73
+ // This adds a uid to the object that you can use for identification purposes
74
+ //
75
+ this.uid = RGraph.createUID();
76
+
77
+
78
+ //
79
+ // This adds a UID to the canvas for identification purposes
80
+ //
81
+ this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.createUID();
82
+
83
+
84
+ //
85
+ // Some example background properties
86
+ //
87
+ this.properties =
88
+ {
89
+ colorsFill: 'white',
90
+
91
+ delay: 50,
92
+
93
+ highlightFill: 'rgba(255,0,0,1.0)',
94
+
95
+ tooltips: null,
96
+ tooltipsCssClass: 'RGraph_tooltip',
97
+ tooltipsCss: null,
98
+ tooltipsHighlight: true,
99
+ tooltipsEffect: 'slide',
100
+ tooltipsEvent: 'onclick',
101
+ tooltipsFormattedPoint: '.',
102
+ tooltipsFormattedThousand: ',',
103
+ tooltipsFormattedDecimals: 0,
104
+ tooltipsFormattedUnitsPre: '',
105
+ tooltipsFormattedUnitsPost: '',
106
+ tooltipsFormattedListType: 'ul',
107
+ tooltipsFormattedListItems: null,
108
+ tooltipsPointer: true,
109
+ tooltipsPointerOffsetx: 0,
110
+ tooltipsPointerOffsety: 0,
111
+ tooltipsPositionStatic: true,
112
+
113
+ textAccessible: false,
114
+ textAccessibleOverflow: 'visible',
115
+ textAccessiblePointerevents: false,
116
+ text: null,
117
+
118
+ clearto: 'rgba(0,0,0,0)'
119
+ }
120
+
121
+ //
122
+ // A simple check that the browser has canvas support
123
+ //
124
+ if (!this.canvas) {
125
+ alert('[DRAWING.MARKER3] No canvas support');
126
+ return;
127
+ }
128
+
129
+ //
130
+ // These are used to store coords
131
+ //
132
+ this.coords = [];
133
+ this.coordsText = [];
134
+
135
+
136
+ //
137
+ // Create the dollar object so that functions can be added to them
138
+ //
139
+ this.$0 = {};
140
+
141
+
142
+
143
+
144
+ // Easy access to properties and the path function
145
+ var properties = this.properties;
146
+ this.path = RGraph.pathObjectFunction;
147
+
148
+
149
+
150
+ //
151
+ // "Decorate" the object with the generic effects if the effects library has been included
152
+ //
153
+ if (RGraph.Effects && typeof RGraph.Effects.decorate === 'function') {
154
+ RGraph.Effects.decorate(this);
155
+ }
156
+
157
+
158
+
159
+
160
+ //
161
+ // A setter method for setting graph properties. It can be used like this: obj.set('colorsStroke', '#666');
162
+ //
163
+
164
+ // @param name string The name of the property to set OR it can be a map
165
+ // of name/value settings like what you set in the constructor
166
+ //
167
+ this.set = function (name)
168
+ {
169
+ var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
170
+
171
+ // the number of arguments is only one and it's an
172
+ // object - parse it for configuration data and return.
173
+ if (arguments.length === 1 && typeof arguments[0] === 'object') {
174
+ for (i in arguments[0]) {
175
+ if (typeof i === 'string') {
176
+ this.set(i, arguments[0][i]);
177
+ }
178
+ }
179
+
180
+ return this;
181
+ }
182
+
183
+ properties[name] = value;
184
+
185
+ return this;
186
+ };
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+ //
196
+ // A getter method for retrieving graph properties. It can be used like this: obj.get('colorsStroke');
197
+ //
198
+ // @param name string The name of the property to get
199
+ //
200
+ this.get = function (name)
201
+ {
202
+ return properties[name];
203
+ };
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+ //
213
+ // Draws the marker
214
+ //
215
+ this.draw = function ()
216
+ {
217
+ // Translate half a pixel for antialiasing purposes - but only if it hasn't been
218
+ // done already
219
+ //
220
+ // MUST be the first thing done!
221
+ //
222
+ if (!this.canvas.__rgraph_aa_translated__) {
223
+ this.context.translate(0.5,0.5);
224
+
225
+ this.canvas.__rgraph_aa_translated__ = true;
226
+ }
227
+
228
+
229
+
230
+ // Draw a circle to start with
231
+ this.context.globalAlpha = this.alpha;
232
+ this.path(
233
+ 'b a % % % % % % a % % % % % % f %',
234
+ this.centerx, this.centery, this.actualRadius, 0, 2 * Math.PI,false,
235
+ this.centerx, this.centery, Math.max(this.actualRadius - 8, 0), 2 * Math.PI,0, true,
236
+ properties.colorsFill
237
+ );
238
+
239
+ this.alpha = this.actualRadius ? 1 - ( (this.actualRadius * 0.75) / this.radius) : 1;
240
+ this.context.globalAlpha = 1;
241
+
242
+
243
+ if (this.actualRadius < this.radius) {
244
+ this.actualRadius += 2;
245
+ } else if (this.actualRadius >= this.radius) {
246
+ this.actualRadius = 0;
247
+ this.alpha = 1;
248
+ }
249
+
250
+ if (!this.TIMER) {
251
+
252
+ var obj = this;
253
+
254
+ setInterval(function ()
255
+ {
256
+ RGraph.redrawCanvas(obj.canvas);
257
+ }, properties.delay);
258
+
259
+ this.TIMER = true;
260
+ }
261
+
262
+
263
+
264
+
265
+ //
266
+ // Add custom text thats specified
267
+ //
268
+ RGraph.addCustomText(this);
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+ //
278
+ // This installs the event listeners
279
+ //
280
+ RGraph.installEventListeners(this);
281
+
282
+
283
+ //
284
+ // Fire the onfirstdraw event
285
+ //
286
+ if (this.firstDraw) {
287
+ this.firstDraw = false;
288
+ RGraph.fireCustomEvent(this, 'onfirstdraw');
289
+ this.firstDrawFunc();
290
+ }
291
+
292
+
293
+
294
+
295
+ //
296
+ // Fire the draw event
297
+ //
298
+ RGraph.fireCustomEvent(this, 'ondraw');
299
+
300
+ return this;
301
+ };
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+ //
311
+ // Used in chaining. Runs a function there and then - not waiting for
312
+ // the events to fire (eg the onbeforedraw event)
313
+ //
314
+ // @param function func The function to execute
315
+ //
316
+ this.exec = function (func)
317
+ {
318
+ func(this);
319
+
320
+ return this;
321
+ };
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+ //
331
+ // The getObjectByXY() worker method
332
+ //
333
+ this.getObjectByXY = function (e)
334
+ {
335
+ if (this.getShape(e)) {
336
+ return this;
337
+ }
338
+ };
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+ //
348
+ // Not used by the class during creating the shape, but is used by event handlers
349
+ // to get the coordinates (if any) of the selected bar
350
+ //
351
+ // @param object e The event object
352
+ //
353
+ this.getShape = function (e)
354
+ {
355
+ var mouseXY = RGraph.getMouseXY(e),
356
+ mouseX = mouseXY[0],
357
+ mouseY = mouseXY[1];
358
+
359
+ if (RGraph.getHypLength(this.centerx, this.centery, mouseXY[0], mouseXY[1]) <= this.radius) {
360
+
361
+ if (RGraph.parseTooltipText && properties.tooltips) {
362
+ var tooltip = RGraph.parseTooltipText(properties.tooltips, 0);
363
+ }
364
+
365
+ return {
366
+ object: this,
367
+ x: this.centerx,
368
+ y: this.centery,
369
+ radius: this.radius,
370
+ dataset: 0,
371
+ index: 0,
372
+ sequentialIndex: 0,
373
+ tooltip: typeof tooltip === 'string' ? tooltip : null
374
+ };
375
+ }
376
+
377
+ return null;
378
+ };
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+ //
388
+ // Each object type has its own Highlight() function which highlights the appropriate shape
389
+ //
390
+ // @param object shape The shape to highlight
391
+ //
392
+ this.highlight = function (shape)
393
+ {
394
+ if (properties.tooltipsHighlight) {
395
+ if (typeof properties.highlightStyle === 'function') {
396
+ (properties.highlightStyle)(shape);
397
+ } else {
398
+ this.path(
399
+ 'b r % % % % f % s %',
400
+ this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],
401
+ properties.highlightFill,properties.highlightStroke
402
+ );
403
+ }
404
+ }
405
+ };
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+ //
415
+ // This allows for easy specification of gradients
416
+ //
417
+ this.parseColors = function ()
418
+ {
419
+ // Save the original colors so that they can be restored when the canvas is reset
420
+ if (this.original_colors.length === 0) {
421
+ this.original_colors.colorsFill = RGraph.arrayClone(properties.colorsFill);
422
+ this.original_colors.highlightFill = RGraph.arrayClone(properties.highlightFill);
423
+ }
424
+
425
+
426
+ //
427
+ // Parse various properties for colors
428
+ //
429
+ properties.colorsFill = this.parseSingleColorForGradient(properties.colorsFill);
430
+ properties.highlightFill = this.parseSingleColorForGradient(properties.highlightFill);
431
+ };
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+ //
441
+ // Use this function to reset the object to the post-constructor state. Eg reset colors if
442
+ // need be etc
443
+ //
444
+ this.reset = function ()
445
+ {
446
+ };
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+ //
456
+ // This parses a single color value
457
+ //
458
+ this.parseSingleColorForGradient = function (color)
459
+ {
460
+ if (!color) {
461
+ return color;
462
+ }
463
+
464
+ if (typeof color === 'string' && color.match(/^gradient\((.*)\)$/i)) {
465
+
466
+
467
+ // Allow for JSON gradients
468
+ if (color.match(/^gradient\(({.*})\)$/i)) {
469
+ return RGraph.parseJSONGradient({object: this, def: RegExp.$1});
470
+ }
471
+
472
+ // Create the gradient
473
+ var parts = RegExp.$1.split(':'),
474
+ grad = this.context.createRadialGradient(this.centerx, this.centery, 0, this.centerx, this.centery, this.radius),
475
+ diff = 1 / (parts.length - 1);
476
+
477
+ //grad.addColorStop(0, RGraph.trim(parts[0]));
478
+
479
+ for (var j=0; j<parts.length; j+=1) {
480
+ grad.addColorStop(j * diff, RGraph.trim(parts[j]));
481
+ }
482
+ }
483
+
484
+ return grad ? grad : color;
485
+ };
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+ //
495
+ // Using a function to add events makes it easier to facilitate method chaining
496
+ //
497
+ // @param string type The type of even to add
498
+ // @param function func
499
+ //
500
+ this.on = function (type, func)
501
+ {
502
+ if (type.substr(0,2) !== 'on') {
503
+ type = 'on' + type;
504
+ }
505
+
506
+ if (typeof this[type] !== 'function') {
507
+ this[type] = func;
508
+ } else {
509
+ RGraph.addCustomEventListener(this, type, func);
510
+ }
511
+
512
+ return this;
513
+ };
514
+
515
+
516
+
517
+
518
+
519
+
520
+
521
+
522
+ //
523
+ // This function runs once only
524
+ // (put at the end of the file (before any effects))
525
+ //
526
+ this.firstDrawFunc = function ()
527
+ {
528
+ };
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+ //
538
+ // A worker function that handles Bar chart specific tooltip substitutions
539
+ //
540
+ this.tooltipSubstitutions = function (opt)
541
+ {
542
+ return {
543
+ index: 0,
544
+ dataset: 0,
545
+ sequentialIndex: 0,
546
+ value: null
547
+ };
548
+ };
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+ //
558
+ // Objects are now always registered so that the chart is redrawn if need be.
559
+ //
560
+ RGraph.register(this);
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+ //
570
+ // the number of arguments is only one and it's an
571
+ // object - parse it for configuration data and return.
572
+ //
573
+ RGraph.parseObjectStyleConfig(this, conf.options);
574
+ };