rgraph-rails 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/rgraph-rails/version.rb +1 -1
  4. data/license.txt +4 -16
  5. data/vendor/assets/javascripts/RGraph.bar.js +3734 -241
  6. data/vendor/assets/javascripts/RGraph.bipolar.js +2005 -115
  7. data/vendor/assets/javascripts/RGraph.common.annotate.js +395 -35
  8. data/vendor/assets/javascripts/RGraph.common.context.js +595 -30
  9. data/vendor/assets/javascripts/RGraph.common.core.js +5282 -405
  10. data/vendor/assets/javascripts/RGraph.common.csv.js +276 -19
  11. data/vendor/assets/javascripts/RGraph.common.deprecated.js +450 -35
  12. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1395 -86
  13. data/vendor/assets/javascripts/RGraph.common.effects.js +1545 -90
  14. data/vendor/assets/javascripts/RGraph.common.key.js +753 -54
  15. data/vendor/assets/javascripts/RGraph.common.resizing.js +563 -37
  16. data/vendor/assets/javascripts/RGraph.common.sheets.js +352 -29
  17. data/vendor/assets/javascripts/RGraph.common.tooltips.js +450 -32
  18. data/vendor/assets/javascripts/RGraph.common.zoom.js +219 -14
  19. data/vendor/assets/javascripts/RGraph.drawing.background.js +570 -35
  20. data/vendor/assets/javascripts/RGraph.drawing.circle.js +544 -35
  21. data/vendor/assets/javascripts/RGraph.drawing.image.js +755 -52
  22. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +645 -41
  23. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +633 -37
  24. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +514 -36
  25. data/vendor/assets/javascripts/RGraph.drawing.poly.js +559 -39
  26. data/vendor/assets/javascripts/RGraph.drawing.rect.js +548 -35
  27. data/vendor/assets/javascripts/RGraph.drawing.text.js +664 -36
  28. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +812 -50
  29. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +856 -51
  30. data/vendor/assets/javascripts/RGraph.fuel.js +964 -58
  31. data/vendor/assets/javascripts/RGraph.funnel.js +984 -55
  32. data/vendor/assets/javascripts/RGraph.gantt.js +1354 -77
  33. data/vendor/assets/javascripts/RGraph.gauge.js +1421 -87
  34. data/vendor/assets/javascripts/RGraph.hbar.js +2562 -146
  35. data/vendor/assets/javascripts/RGraph.hprogress.js +1401 -80
  36. data/vendor/assets/javascripts/RGraph.line.js +4226 -244
  37. data/vendor/assets/javascripts/RGraph.meter.js +1280 -74
  38. data/vendor/assets/javascripts/RGraph.modaldialog.js +301 -19
  39. data/vendor/assets/javascripts/RGraph.odo.js +1264 -71
  40. data/vendor/assets/javascripts/RGraph.pie.js +2288 -137
  41. data/vendor/assets/javascripts/RGraph.radar.js +1847 -110
  42. data/vendor/assets/javascripts/RGraph.rose.js +1977 -108
  43. data/vendor/assets/javascripts/RGraph.rscatter.js +1432 -80
  44. data/vendor/assets/javascripts/RGraph.scatter.js +3036 -168
  45. data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1120 -60
  46. data/vendor/assets/javascripts/RGraph.svg.bar.js +1067 -0
  47. data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +247 -0
  48. data/vendor/assets/javascripts/RGraph.svg.common.core.js +3363 -0
  49. data/vendor/assets/javascripts/RGraph.svg.common.csv.js +277 -0
  50. data/vendor/assets/javascripts/RGraph.svg.common.fx.js +1304 -0
  51. data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +353 -0
  52. data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +233 -0
  53. data/vendor/assets/javascripts/RGraph.svg.hbar.js +1141 -0
  54. data/vendor/assets/javascripts/RGraph.svg.line.js +1486 -0
  55. data/vendor/assets/javascripts/RGraph.svg.pie.js +781 -0
  56. data/vendor/assets/javascripts/RGraph.svg.radar.js +1326 -0
  57. data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +817 -0
  58. data/vendor/assets/javascripts/RGraph.thermometer.js +1135 -62
  59. data/vendor/assets/javascripts/RGraph.vprogress.js +1470 -83
  60. data/vendor/assets/javascripts/RGraph.waterfall.js +1347 -80
  61. metadata +15 -3
@@ -1,37 +1,515 @@
1
+ // version: 2017-01-02
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 licensed under the Open Source MIT license. That means that it's |
9
+ * | totally free to use! |
10
+ * o--------------------------------------------------------------------------------o
11
+ */
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
+ */
1
17
 
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
4
- var canvas=document.getElementById(id);var x=conf.x;var y=conf.y;var radius=conf.radius;var parseConfObjectForOptions=true;}else{var id=conf;var canvas=document.getElementById(id);var x=arguments[1];var y=arguments[2];var radius=arguments[3];}
5
- this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d')
6
- this.colorsParsed=false;this.canvas.__object__=this;this.original_colors=[];this.firstDraw=true;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.fillstyle':'rgba(255,255,255,1)','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':true,'chart.clearto':'rgba(0,0,0,0)'}
7
- if(!this.canvas){alert('[DRAWING.MARKER3] No canvas support');return;}
8
- 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;}
9
- var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
10
- if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
11
- this.set=this.Set=function(name)
12
- {var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
13
- if(name.substr(0,6)!='chart.'){name='chart.'+name;}
14
- while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
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
- {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.fillstyle']]);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;}
20
- var obj=this;setTimeout(function()
21
- {RG.redrawCanvas(ca);},prop['chart.delay']);RG.InstallEventListeners(this);if(this.firstDraw){RG.fireCustomEvent(this,'onfirstdraw');this.firstDraw=false;this.firstDrawFunc();}
22
- RG.fireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
23
- {func(this);return this;};this.getObjectByXY=function(e)
24
- {if(this.getShape(e)){return this;}};this.getShape=function(e)
25
- {var mouseXY=RGraph.getMouseXY(e);var mouseX=mouseXY[0];var 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};}
26
- return null;};this.highlight=this.Highlight=function(shape)
27
- {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()
28
- {if(this.original_colors.length===0){this.original_colors['chart.fillstyle']=RG.array_clone(prop['chart.fillstyle']);this.original_colors['chart.highlight.fill']=RG.array_clone(prop['chart.highlight.fill']);}
29
- prop['chart.fillstyle']=this.parseSingleColorForGradient(prop['chart.fillstyle']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);};this.reset=function()
30
- {};this.parseSingleColorForGradient=function(color)
31
- {var canvas=this.canvas;var context=this.context;if(!color){return color;}
32
- if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createRadialGradient(this.centerx,this.centery,0,this.centerx,this.centery,this.radius);var 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.att(ca);RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
18
+ // Define the RGraph global variable
19
+ RGraph = window.RGraph || {isRGraph: true};
20
+ RGraph.Drawing = RGraph.Drawing || {};
21
+
22
+ /**
23
+ * The constructor. This function sets up the object. It takes the ID (the HTML attribute) of the canvas as the
24
+ * first argument and the data as the second. If you need to change this, you can. Alternatively it can take
25
+ * a single JSON-style configuration object
26
+ *
27
+ * @param string id The canvas tag ID
28
+ * @param number x The X position of the marker
29
+ * @param number y The Y position of the marker
30
+ * @param number text The max radius of the pulsing circle
31
+ */
32
+ RGraph.Drawing.Marker3 = function (conf)
33
+ {
34
+ /**
35
+ * Allow for object config style
36
+ */
37
+ if ( typeof conf === 'object'
38
+ && typeof conf.x === 'number'
39
+ && typeof conf.y === 'number'
40
+ && typeof conf.id === 'string'
41
+ && typeof conf.radius === 'number') {
42
+
43
+ var id = conf.id,
44
+ canvas = document.getElementById(id),
45
+ x = conf.x,
46
+ y = conf.y,
47
+ radius = conf.radius,
48
+ parseConfObjectForOptions = true; // Set this so the config is parsed (at the end of the constructor)
49
+
50
+ } else {
51
+
52
+ var id = conf,
53
+ canvas = document.getElementById(id),
54
+ x = arguments[1],
55
+ y = arguments[2],
56
+ radius = arguments[3];
57
+ }
58
+
59
+
60
+
61
+
62
+ this.id = id;
63
+ this.canvas = document.getElementById(this.id);
64
+ this.context = this.canvas.getContext('2d')
65
+ this.colorsParsed = false;
66
+ this.canvas.__object__ = this;
67
+ this.original_colors = [];
68
+ this.firstDraw = true; // After the first draw this will be false
69
+
70
+ // The actual radius is what is used to draw the marker - the other radius is the maximum target radius
71
+ // that the marker grows to
72
+ this.actualRadius = 0;
73
+
74
+ // This is the alpha value that is used to fade out the pulsing marker
75
+ this.alpha = 1;
76
+
77
+
78
+ /**
79
+ * Store the properties
80
+ */
81
+ this.centerx = x;
82
+ this.centery = y;
83
+ this.radius = radius;
84
+
85
+
86
+ /**
87
+ * This defines the type of this shape
88
+ */
89
+ this.type = 'drawing.marker3';
90
+
91
+
92
+ /**
93
+ * This facilitates easy object identification, and should always be true
94
+ */
95
+ this.isRGraph = true;
96
+
97
+
98
+ /**
99
+ * This adds a uid to the object that you can use for identification purposes
100
+ */
101
+ this.uid = RGraph.CreateUID();
102
+
103
+
104
+ /**
105
+ * This adds a UID to the canvas for identification purposes
106
+ */
107
+ this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.createUID();
108
+
109
+
110
+ /**
111
+ * Some example background properties
112
+ */
113
+ this.properties =
114
+ {
115
+ 'chart.fillstyle': 'rgba(255,255,255,1)',
116
+ 'chart.delay': 50,
117
+ 'chart.events.click': null,
118
+ 'chart.events.mousemove': null,
119
+ 'chart.highlight.fill': 'rgba(255,0,0,1.0)',
120
+ 'chart.tooltips': null,
121
+ 'chart.tooltips.highlight': true,
122
+ 'chart.tooltips.event': 'onclick',
123
+ 'chart.text.accessible': true,
124
+ 'chart.text.accessible.overflow': 'visible',
125
+ 'chart.text.accessible.pointerevents': true,
126
+ 'chart.clearto': 'rgba(0,0,0,0)'
127
+ }
128
+
129
+ /**
130
+ * A simple check that the browser has canvas support
131
+ */
132
+ if (!this.canvas) {
133
+ alert('[DRAWING.MARKER3] No canvas support');
134
+ return;
135
+ }
136
+
137
+ /**
138
+ * These are used to store coords
139
+ */
140
+ this.coords = [];
141
+ this.coordsText = [];
142
+
143
+
144
+ /**
145
+ * Create the dollar object so that functions can be added to them
146
+ */
147
+ this.$0 = {};
148
+
149
+
150
+ /**
151
+ * Translate half a pixel for antialiasing purposes - but only if it hasn't beeen
152
+ * done already
153
+ */
154
+ if (!this.canvas.__rgraph_aa_translated__) {
155
+ this.context.translate(0.5,0.5);
156
+
157
+ this.canvas.__rgraph_aa_translated__ = true;
158
+ }
159
+
160
+
161
+
162
+
163
+ // Short variable names
164
+ var RG = RGraph,
165
+ ca = this.canvas,
166
+ co = ca.getContext('2d'),
167
+ prop = this.properties,
168
+ pa2 = RG.path2,
169
+ win = window,
170
+ doc = document,
171
+ ma = Math;
172
+
173
+
174
+
175
+ /**
176
+ * "Decorate" the object with the generic effects if the effects library has been included
177
+ */
178
+ if (RG.Effects && typeof RG.Effects.decorate === 'function') {
179
+ RG.Effects.decorate(this);
180
+ }
181
+
182
+
183
+
184
+
185
+ /**
186
+ * A setter method for setting graph properties. It can be used like this: obj.Set('chart.strokestyle', '#666');
187
+ *
188
+
189
+ * @param name string The name of the property to set OR it can be a map
190
+ * of name/value settings like what you set in the constructor
191
+ */
192
+ this.set =
193
+ this.Set = function (name)
194
+ {
195
+ var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
196
+
197
+ /**
198
+ * the number of arguments is only one and it's an
199
+ * object - parse it for configuration data and return.
200
+ */
201
+ if (arguments.length === 1 && typeof name === 'object') {
202
+ RG.parseObjectStyleConfig(this, name);
203
+ return this;
204
+ }
205
+
206
+
207
+
208
+
209
+
210
+ /**
211
+ * This should be done first - prepend the propertyy name with "chart." if necessary
212
+ */
213
+ if (name.substr(0,6) != 'chart.') {
214
+ name = 'chart.' + name;
215
+ }
216
+
217
+
218
+
219
+
220
+ // Convert uppercase letters to dot+lower case letter
221
+ while(name.match(/([A-Z])/)) {
222
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
223
+ }
224
+
225
+
226
+ prop[name] = value;
227
+
228
+ return this;
229
+ };
230
+
231
+
232
+
233
+
234
+ /**
235
+ * A getter method for retrieving graph properties. It can be used like this: obj.Get('chart.strokestyle');
236
+ *
237
+ * @param name string The name of the property to get
238
+ */
239
+ this.get =
240
+ this.Get = function (name)
241
+ {
242
+ /**
243
+ * This should be done first - prepend the property name with "chart." if necessary
244
+ */
245
+ if (name.substr(0,6) != 'chart.') {
246
+ name = 'chart.' + name;
247
+ }
248
+
249
+ // Convert uppercase letters to dot+lower case letter
250
+ while(name.match(/([A-Z])/)) {
251
+ name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
252
+ }
253
+
254
+ return prop[name.toLowerCase()];
255
+ };
256
+
257
+
258
+
259
+
260
+ /**
261
+ * Draws the marker
262
+ */
263
+ this.draw =
264
+ this.Draw = function ()
265
+ {
266
+ // Draw a circle to start with
267
+ co.globalAlpha = this.alpha;
268
+ pa2(co, [
269
+ 'b',
270
+ 'a', this.centerx, this.centery, this.actualRadius, 0, 2 * Math.PI,false,
271
+ 'a', this.centerx, this.centery, ma.max(this.actualRadius - 8, 0), 2 * Math.PI,0, true,
272
+ 'f', prop['chart.fillstyle']
273
+ ]);
274
+
275
+ this.alpha = this.actualRadius ? 1 - ( (this.actualRadius * 0.75) / this.radius) : 1;
276
+ co.globalAlpha = 1;
277
+
278
+
279
+ if (this.actualRadius < this.radius) {
280
+ this.actualRadius += 2;
281
+ } else if (this.actualRadius >= this.radius) {
282
+ this.actualRadius = 0;
283
+ this.alpha = 1;
284
+ }
285
+
286
+ if (!this.TIMER) {
287
+
288
+ var obj = this;
289
+
290
+ setInterval(function ()
291
+ {
292
+ RG.redrawCanvas(ca);
293
+ }, prop['chart.delay']);
294
+
295
+ this.TIMER = true;
296
+ }
297
+
298
+
299
+
300
+
301
+ /**
302
+ * This installs the event listeners
303
+ */
304
+ RG.installEventListeners(this);
305
+
306
+
307
+ /**
308
+ * Fire the onfirstdraw event
309
+ */
310
+ if (this.firstDraw) {
311
+ RG.fireCustomEvent(this, 'onfirstdraw');
312
+ this.firstDraw = false;
313
+ this.firstDrawFunc();
314
+ }
315
+
316
+
317
+
318
+
319
+ /**
320
+ * Fire the ondraw event
321
+ */
322
+ RG.fireCustomEvent(this, 'ondraw');
323
+
324
+ return this;
325
+ };
326
+
327
+
328
+
329
+ /**
330
+ * Used in chaining. Runs a function there and then - not waiting for
331
+ * the events to fire (eg the onbeforedraw event)
332
+ *
333
+ * @param function func The function to execute
334
+ */
335
+ this.exec = function (func)
336
+ {
337
+ func(this);
338
+
339
+ return this;
340
+ };
341
+
342
+
343
+
344
+
345
+ /**
346
+ * The getObjectByXY() worker method
347
+ */
348
+ this.getObjectByXY = function (e)
349
+ {
350
+ if (this.getShape(e)) {
351
+ return this;
352
+ }
353
+ };
354
+
355
+
356
+
357
+
358
+ /**
359
+ * Not used by the class during creating the shape, but is used by event handlers
360
+ * to get the coordinates (if any) of the selected bar
361
+ *
362
+ * @param object e The event object
363
+ */
364
+ this.getShape = function (e)
365
+ {
366
+ var mouseXY = RG.getMouseXY(e),
367
+ mouseX = mouseXY[0],
368
+ mouseY = mouseXY[1];
369
+
370
+ if (RG.getHypLength(this.centerx, this.centery, mouseXY[0], mouseXY[1]) <= this.radius) {
371
+ return {
372
+ 0: this, 1: this.centerx, 2: this.centery, 3: this.radius, 4: null, 5: 0,
373
+ 'object': this, 'x': this.centerx, 'y': this.centery, 'radius': this.radius, 'index': 0, 'tooltip': prop['chart.tooltips'] ? prop['chart.tooltips'][0] : null
374
+ };
375
+ }
376
+
377
+ return null;
378
+ };
379
+
380
+
381
+
382
+
383
+ /**
384
+ * Each object type has its own Highlight() function which highlights the appropriate shape
385
+ *
386
+ * @param object shape The shape to highlight
387
+ */
388
+ this.highlight =
389
+ this.Highlight = function (shape)
390
+ {
391
+ if (prop['chart.tooltips.highlight']) {
392
+ if (typeof prop['chart.highlight.style'] === 'function') {
393
+ (prop['chart.highlight.style'])(shape);
394
+ } else {
395
+ 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']]);
396
+ }
397
+ }
398
+ };
399
+
400
+
401
+
402
+
403
+ /**
404
+ * This allows for easy specification of gradients
405
+ */
406
+ this.parseColors = function ()
407
+ {
408
+ // Save the original colors so that they can be restored when the canvas is reset
409
+ if (this.original_colors.length === 0) {
410
+ this.original_colors['chart.fillstyle'] = RG.arrayClone(prop['chart.fillstyle']);
411
+ this.original_colors['chart.highlight.fill'] = RG.arrayClone(prop['chart.highlight.fill']);
412
+ }
413
+
414
+
415
+ /**
416
+ * Parse various properties for colors
417
+ */
418
+ prop['chart.fillstyle'] = this.parseSingleColorForGradient(prop['chart.fillstyle']);
419
+ prop['chart.highlight.fill'] = this.parseSingleColorForGradient(prop['chart.highlight.fill']);
420
+ };
421
+
422
+
423
+
424
+
425
+ /**
426
+ * Use this function to reset the object to the post-constructor state. Eg reset colors if
427
+ * need be etc
428
+ */
429
+ this.reset = function ()
430
+ {
431
+ };
432
+
433
+
434
+
435
+
436
+ /**
437
+ * This parses a single color value
438
+ */
439
+ this.parseSingleColorForGradient = function (color)
440
+ {
441
+ if (!color) {
442
+ return color;
443
+ }
444
+
445
+ if (typeof color === 'string' && color.match(/^gradient\((.*)\)$/i)) {
446
+
447
+ // Create the gradient
448
+ var parts = RegExp.$1.split(':'),
449
+ grad = co.createRadialGradient(this.centerx, this.centery, 0, this.centerx, this.centery, this.radius),
450
+ diff = 1 / (parts.length - 1);
451
+
452
+ //grad.addColorStop(0, RG.trim(parts[0]));
453
+
454
+ for (var j=0; j<parts.length; j+=1) {
455
+ grad.addColorStop(j * diff, RG.trim(parts[j]));
456
+ }
457
+ }
458
+
459
+ return grad ? grad : color;
460
+ };
461
+
462
+
463
+
464
+
465
+ /**
466
+ * Using a function to add events makes it easier to facilitate method chaining
467
+ *
468
+ * @param string type The type of even to add
469
+ * @param function func
470
+ */
471
+ this.on = function (type, func)
472
+ {
473
+ if (type.substr(0,2) !== 'on') {
474
+ type = 'on' + type;
475
+ }
476
+
477
+ if (typeof this[type] !== 'function') {
478
+ this[type] = func;
479
+ } else {
480
+ RG.addCustomEventListener(this, type, func);
481
+ }
482
+
483
+ return this;
484
+ };
485
+
486
+
487
+
488
+
489
+ /**
490
+ * This function runs once only
491
+ * (put at the end of the file (before any effects))
492
+ */
493
+ this.firstDrawFunc = function ()
494
+ {
495
+ };
496
+
497
+
498
+
499
+
500
+ /**
501
+ * Objects are now always registered so that the chart is redrawn if need be.
502
+ */
503
+ RG.register(this);
504
+
505
+
506
+
507
+
508
+ /**
509
+ * the number of arguments is only one and it's an
510
+ * object - parse it for configuration data and return.
511
+ */
512
+ if (parseConfObjectForOptions) {
513
+ RG.parseObjectStyleConfig(this, conf.options);
514
+ }
515
+ };