rgraph-rails 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/README.md +73 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +7 -0
  11. data/lib/rgraph-rails/version.rb +3 -0
  12. data/lib/rgraph-rails.rb +8 -0
  13. data/license.txt +19 -0
  14. data/rgraph-rails.gemspec +26 -0
  15. data/vendor/assets/images/bg.png +0 -0
  16. data/vendor/assets/images/bullet.png +0 -0
  17. data/vendor/assets/images/facebook-large.png +0 -0
  18. data/vendor/assets/images/google-plus-large.png +0 -0
  19. data/vendor/assets/images/logo.png +0 -0
  20. data/vendor/assets/images/meter-image-sd-needle.png +0 -0
  21. data/vendor/assets/images/meter-image-sd.png +0 -0
  22. data/vendor/assets/images/meter-sketch-needle.png +0 -0
  23. data/vendor/assets/images/meter-sketch.png +0 -0
  24. data/vendor/assets/images/odometer-background.png +0 -0
  25. data/vendor/assets/images/rgraph.jpg +0 -0
  26. data/vendor/assets/images/title.png +0 -0
  27. data/vendor/assets/images/twitter-large.png +0 -0
  28. data/vendor/assets/javascripts/RGraph.bar.js +3246 -0
  29. data/vendor/assets/javascripts/RGraph.bipolar.js +2003 -0
  30. data/vendor/assets/javascripts/RGraph.common.annotate.js +399 -0
  31. data/vendor/assets/javascripts/RGraph.common.context.js +600 -0
  32. data/vendor/assets/javascripts/RGraph.common.core.js +4751 -0
  33. data/vendor/assets/javascripts/RGraph.common.csv.js +275 -0
  34. data/vendor/assets/javascripts/RGraph.common.deprecated.js +454 -0
  35. data/vendor/assets/javascripts/RGraph.common.dynamic.js +1194 -0
  36. data/vendor/assets/javascripts/RGraph.common.effects.js +1524 -0
  37. data/vendor/assets/javascripts/RGraph.common.key.js +735 -0
  38. data/vendor/assets/javascripts/RGraph.common.resizing.js +550 -0
  39. data/vendor/assets/javascripts/RGraph.common.tooltips.js +605 -0
  40. data/vendor/assets/javascripts/RGraph.common.zoom.js +223 -0
  41. data/vendor/assets/javascripts/RGraph.drawing.background.js +636 -0
  42. data/vendor/assets/javascripts/RGraph.drawing.circle.js +579 -0
  43. data/vendor/assets/javascripts/RGraph.drawing.image.js +810 -0
  44. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +710 -0
  45. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +672 -0
  46. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +568 -0
  47. data/vendor/assets/javascripts/RGraph.drawing.poly.js +623 -0
  48. data/vendor/assets/javascripts/RGraph.drawing.rect.js +603 -0
  49. data/vendor/assets/javascripts/RGraph.drawing.text.js +648 -0
  50. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +815 -0
  51. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +860 -0
  52. data/vendor/assets/javascripts/RGraph.fuel.js +965 -0
  53. data/vendor/assets/javascripts/RGraph.funnel.js +988 -0
  54. data/vendor/assets/javascripts/RGraph.gantt.js +1242 -0
  55. data/vendor/assets/javascripts/RGraph.gauge.js +1391 -0
  56. data/vendor/assets/javascripts/RGraph.hbar.js +1794 -0
  57. data/vendor/assets/javascripts/RGraph.hprogress.js +1307 -0
  58. data/vendor/assets/javascripts/RGraph.line.js +3940 -0
  59. data/vendor/assets/javascripts/RGraph.meter.js +1242 -0
  60. data/vendor/assets/javascripts/RGraph.modaldialog.js +292 -0
  61. data/vendor/assets/javascripts/RGraph.odo.js +1265 -0
  62. data/vendor/assets/javascripts/RGraph.pie.js +1979 -0
  63. data/vendor/assets/javascripts/RGraph.radar.js +1840 -0
  64. data/vendor/assets/javascripts/RGraph.rose.js +1860 -0
  65. data/vendor/assets/javascripts/RGraph.rscatter.js +1332 -0
  66. data/vendor/assets/javascripts/RGraph.scatter.js +3029 -0
  67. data/vendor/assets/javascripts/RGraph.thermometer.js +1131 -0
  68. data/vendor/assets/javascripts/RGraph.vprogress.js +1326 -0
  69. data/vendor/assets/javascripts/RGraph.waterfall.js +1252 -0
  70. data/vendor/assets/javascripts/financial-data.js +1067 -0
  71. data/vendor/assets/stylesheets/ModalDialog.css +90 -0
  72. data/vendor/assets/stylesheets/animations.css +3347 -0
  73. data/vendor/assets/stylesheets/website.css +402 -0
  74. metadata +175 -0
@@ -0,0 +1,1242 @@
1
+ // version: 2015-11-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 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
+
16
+ RGraph = window.RGraph || {isRGraph: true};
17
+
18
+ /**
19
+ * The gantt chart constructor
20
+ *
21
+ * @param object conf The configuration object. You can also give seperate arguments if you prefer:
22
+ * var foo = new RGraph.Gantt('cvs', [[0,50],[25,50],[50,50]]);
23
+ */
24
+ RGraph.Gantt = function (conf)
25
+ {
26
+ /**
27
+ * Allow for object config style
28
+ */
29
+ if ( typeof conf === 'object'
30
+ && typeof conf.data === 'object'
31
+ && typeof conf.id === 'string') {
32
+
33
+ var id = conf.id
34
+ var canvas = document.getElementById(id);
35
+ var data = conf.data;
36
+ var parseConfObjectForOptions = true; // Set this so the config is parsed (at the end of the constructor)
37
+
38
+ } else {
39
+
40
+ var id = conf;
41
+ var canvas = document.getElementById(id);
42
+ var data = arguments[1];
43
+ }
44
+
45
+
46
+
47
+ this.id = id;
48
+ this.canvas = canvas;
49
+ this.context = this.canvas.getContext ? this.canvas.getContext("2d", {alpha: (typeof id === 'object' && id.alpha === false) ? false : true}) : null;
50
+ this.canvas.__object__ = this;
51
+ this.type = 'gantt';
52
+ this.isRGraph = true;
53
+ this.uid = RGraph.CreateUID();
54
+ this.canvas.uid = this.canvas.uid ? this.canvas.uid : RGraph.CreateUID();
55
+ this.data = data;
56
+ this.colorsParsed = false;
57
+ this.coordsText = [];
58
+ this.original_colors = [];
59
+ this.firstDraw = true; // After the first draw this will be false
60
+
61
+
62
+ /**
63
+ * Compatibility with older browsers
64
+ */
65
+ //RGraph.OldBrowserCompat(this.context);
66
+
67
+
68
+ // Set some defaults
69
+ this.properties =
70
+ {
71
+ 'chart.background.barcolor1': 'rgba(0,0,0,0)',
72
+ 'chart.background.barcolor2': 'rgba(0,0,0,0)',
73
+ 'chart.background.grid': true,
74
+ 'chart.background.grid.width': 1,
75
+ 'chart.background.grid.color': '#ddd',
76
+ 'chart.background.grid.hsize': 20,
77
+ 'chart.background.grid.vsize': 20,
78
+ 'chart.background.grid.hlines': true,
79
+ 'chart.background.grid.vlines': true,
80
+ 'chart.background.grid.border': true,
81
+ 'chart.background.grid.autofit':true,
82
+ 'chart.background.grid.autofit.align':true,
83
+ 'chart.background.grid.autofit.numhlines': 7,
84
+ 'chart.background.grid.autofit.numvlines': null,
85
+ 'chart.vbars': [],
86
+ 'chart.hbars': [],
87
+ 'chart.text.size': 12,
88
+ 'chart.text.font': 'Arial',
89
+ 'chart.text.color': 'black',
90
+ 'chart.gutter.left': 75,
91
+ 'chart.gutter.right': 25,
92
+ 'chart.gutter.top': 35,
93
+ 'chart.gutter.bottom': 25,
94
+ 'chart.labels': [],
95
+ 'chart.labels.color': null,
96
+ 'chart.labels.align': 'bottom',
97
+ 'chart.labels.inbar': null,
98
+ 'chart.labels.inbar.color': 'black',
99
+ 'chart.labels.inbar.bgcolor': null,
100
+ 'chart.labels.inbar.align': 'left',
101
+ 'chart.labels.inbar.size': 10,
102
+ 'chart.labels.inbar.font': 'Arial',
103
+ 'chart.labels.inbar.above': false,
104
+ 'chart.labels.percent': true,
105
+ 'chart.vmargin': 2,
106
+ 'chart.title': '',
107
+ 'chart.title.background': null,
108
+ 'chart.title.x': null,
109
+ 'chart.title.y': null,
110
+ 'chart.title.bold': true,
111
+ 'chart.title.font': null,
112
+ 'chart.title.yaxis': '',
113
+ 'chart.title.yaxis.bold': true,
114
+ 'chart.title.yaxis.pos': null,
115
+ 'chart.title.yaxis.color': null,
116
+ 'chart.title.yaxis.position': 'right',
117
+ 'chart.title.yaxis.x': null,
118
+ 'chart.title.yaxis.y': null,
119
+ 'chart.title.xaxis.x': null,
120
+ 'chart.title.xaxis.y': null,
121
+ 'chart.title.xaxis.bold': true,
122
+ 'chart.title.x': null,
123
+ 'chart.title.y': null,
124
+ 'chart.title.halign': null,
125
+ 'chart.title.valign': null,
126
+ 'chart.borders': true,
127
+ 'chart.defaultcolor': 'white',
128
+ 'chart.coords': [],
129
+ 'chart.tooltips': null,
130
+ 'chart.tooltips.effect': 'fade',
131
+ 'chart.tooltips.css.class': 'RGraph_tooltip',
132
+ 'chart.tooltips.highlight': true,
133
+ 'chart.tooltips.event': 'onclick',
134
+ 'chart.highlight.stroke': 'rgba(0,0,0,0)',
135
+ 'chart.highlight.fill': 'rgba(255,255,255,0.7)',
136
+ 'chart.xmin': 0,
137
+ 'chart.xmax': 0,
138
+ 'chart.contextmenu': null,
139
+ 'chart.annotatable': false,
140
+ 'chart.annotate.color': 'black',
141
+ 'chart.zoom.factor': 1.5,
142
+ 'chart.zoom.fade.in': true,
143
+ 'chart.zoom.fade.out': true,
144
+ 'chart.zoom.hdir': 'right',
145
+ 'chart.zoom.vdir': 'down',
146
+ 'chart.zoom.frames': 25,
147
+ 'chart.zoom.delay': 16.666,
148
+ 'chart.zoom.shadow': true,
149
+ 'chart.zoom.background': true,
150
+ 'chart.zoom.action': 'zoom',
151
+ 'chart.resizable': false,
152
+ 'chart.resize.handle.adjust': [0,0],
153
+ 'chart.resize.handle.background': null,
154
+ 'chart.adjustable': false,
155
+ 'chart.events.click': null,
156
+ 'chart.events.mousemove': null
157
+ }
158
+
159
+
160
+ /**
161
+ * Create the dollar objects so that functions can be added to them
162
+ */
163
+ if (!data) {
164
+ alert('[GANTT] The Gantt chart event data is now supplied as the second argument to the constructor - please update your code');
165
+ }
166
+
167
+ // Linearize the data (DON'T use RGraph.array_linearize() here)
168
+ for (var i=0,idx=0; i<data.length; ++i) {
169
+ if (RGraph.is_array(this.data[i][0])) {
170
+ for (var j=0; j<this.data[i].length; ++j) {
171
+ this['$' + (idx++)] = {};
172
+ }
173
+ } else {
174
+ this['$' + (idx++)] = {};
175
+ }
176
+ }
177
+
178
+
179
+
180
+ /*
181
+ * Translate half a pixel for antialiasing purposes - but only if it hasn't beeen
182
+ * done already
183
+ */
184
+ if (!this.canvas.__rgraph_aa_translated__) {
185
+ this.context.translate(0.5,0.5);
186
+
187
+ this.canvas.__rgraph_aa_translated__ = true;
188
+ }
189
+
190
+
191
+
192
+
193
+ // Short variable names
194
+ var RG = RGraph,
195
+ ca = this.canvas,
196
+ co = ca.getContext('2d'),
197
+ prop = this.properties,
198
+ pa = RG.Path,
199
+ pa2 = RG.path2,
200
+ win = window,
201
+ doc = document,
202
+ ma = Math
203
+
204
+
205
+
206
+ /**
207
+ * "Decorate" the object with the generic effects if the effects library has been included
208
+ */
209
+ if (RG.Effects && typeof RG.Effects.decorate === 'function') {
210
+ RG.Effects.decorate(this);
211
+ }
212
+
213
+
214
+
215
+
216
+ /**
217
+ * A peudo setter
218
+ *
219
+ * @param name string The name of the property to set
220
+ * @param value mixed The value of the property
221
+ */
222
+ this.set =
223
+ this.Set = function (name)
224
+ {
225
+ var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
226
+
227
+ /**
228
+ * the number of arguments is only one and it's an
229
+ * object - parse it for configuration data and return.
230
+ */
231
+ if (arguments.length === 1 && typeof name === 'object') {
232
+ RG.parseObjectStyleConfig(this, name);
233
+ return this;
234
+ }
235
+
236
+
237
+
238
+
239
+
240
+ /**
241
+ * This should be done first - prepend the propertyy name with "chart." if necessary
242
+ */
243
+ if (name.substr(0,6) != 'chart.') {
244
+ name = 'chart.' + name;
245
+ }
246
+
247
+
248
+
249
+
250
+ // Convert uppercase letters to dot+lower case letter
251
+ name = name.replace(/([A-Z])/g, function (str)
252
+ {
253
+ return '.' + String(RegExp.$1).toLowerCase();
254
+ });
255
+
256
+ if (name == 'chart.margin') {
257
+ name = 'chart.vmargin'
258
+ }
259
+
260
+ if (name == 'chart.events') {
261
+ alert('[GANTT] The chart.events property is deprecated - supply the events data as an argument to the constructor instead');
262
+ this.data = value;
263
+ }
264
+
265
+
266
+
267
+
268
+
269
+
270
+ prop[name] = value;
271
+
272
+ return this;
273
+ };
274
+
275
+
276
+
277
+
278
+ /**
279
+ * A peudo getter
280
+ *
281
+ * @param name string The name of the property to get
282
+ */
283
+ this.get =
284
+ this.Get = function (name)
285
+ {
286
+ /**
287
+ * This should be done first - prepend the property name with "chart." if necessary
288
+ */
289
+ if (name.substr(0,6) != 'chart.') {
290
+ name = 'chart.' + name;
291
+ }
292
+
293
+ // Convert uppercase letters to dot+lower case letter
294
+ name = name.replace(/([A-Z])/g, function (str)
295
+ {
296
+ return '.' + String(RegExp.$1).toLowerCase()
297
+ });
298
+
299
+ if (name == 'chart.margin') {
300
+ name = 'chart.vmargin'
301
+ }
302
+
303
+ return prop[name.toLowerCase()];
304
+ };
305
+
306
+
307
+
308
+
309
+ /**
310
+ * Draws the chart
311
+ */
312
+ this.draw =
313
+ this.Draw = function ()
314
+ {
315
+ /**
316
+ * Fire the onbeforedraw event
317
+ */
318
+ RG.FireCustomEvent(this, 'onbeforedraw');
319
+
320
+
321
+
322
+ /**
323
+ * This is new in May 2011 and facilitates indiviual gutter settings,
324
+ * eg chart.gutter.left
325
+ */
326
+ this.gutterLeft = prop['chart.gutter.left'];
327
+ this.gutterRight = prop['chart.gutter.right'];
328
+ this.gutterTop = prop['chart.gutter.top'];
329
+ this.gutterBottom = prop['chart.gutter.bottom'];
330
+
331
+ /**
332
+ * Stop this growing uncntrollably
333
+ */
334
+ this.coordsText = [];
335
+
336
+
337
+ /**
338
+ * Parse the colors. This allows for simple gradient syntax
339
+ */
340
+ if (!this.colorsParsed) {
341
+
342
+ this.parseColors();
343
+
344
+ // Don't want to do this again
345
+ this.colorsParsed = true;
346
+ }
347
+
348
+ /**
349
+ * Work out the graphArea
350
+ */
351
+ this.graphArea = ca.width - this.gutterLeft - this.gutterRight;
352
+ this.graphHeight = ca.height - this.gutterTop - this.gutterBottom;
353
+ this.numEvents = this.data.length
354
+ this.barHeight = this.graphHeight / this.numEvents;
355
+ this.halfBarHeight = this.barHeight / 2;
356
+
357
+
358
+
359
+
360
+ /**
361
+ * Draw the background
362
+ */
363
+ RG.background.Draw(this);
364
+
365
+
366
+
367
+ /**
368
+ * Draw the labels at the top
369
+ */
370
+ this.drawLabels();
371
+
372
+
373
+
374
+ /**
375
+ * Draw the events
376
+ */
377
+ this.DrawEvents();
378
+
379
+
380
+
381
+ /**
382
+ * Setup the context menu if required
383
+ */
384
+ if (prop['chart.contextmenu']) {
385
+ RG.ShowContext(this);
386
+ }
387
+
388
+
389
+ /**
390
+ * This function enables resizing
391
+ */
392
+ if (prop['chart.resizable']) {
393
+ RG.AllowResizing(this);
394
+ }
395
+
396
+
397
+ /**
398
+ * This installs the event listeners
399
+ */
400
+ RG.InstallEventListeners(this);
401
+
402
+
403
+ /**
404
+ * Fire the onfirstdraw event
405
+ */
406
+ if (this.firstDraw) {
407
+ RG.fireCustomEvent(this, 'onfirstdraw');
408
+ this.firstDraw = false;
409
+ this.firstDrawFunc();
410
+ }
411
+
412
+
413
+
414
+
415
+ /**
416
+ * Fire the RGraph ondraw event
417
+ */
418
+ RG.FireCustomEvent(this, 'ondraw');
419
+
420
+ return this;
421
+ };
422
+
423
+
424
+
425
+ /**
426
+ * Used in chaining. Runs a function there and then - not waiting for
427
+ * the events to fire (eg the onbeforedraw event)
428
+ *
429
+ * @param function func The function to execute
430
+ */
431
+ this.exec = function (func)
432
+ {
433
+ func(this);
434
+
435
+ return this;
436
+ };
437
+
438
+
439
+
440
+
441
+ /**
442
+ * Draws the labels at the top and the left of the chart
443
+ */
444
+ this.drawLabels =
445
+ this.DrawLabels = function ()
446
+ {
447
+ /**
448
+ * Draw the X labels at the top/bottom of the chart.
449
+ */
450
+ var labels = prop['chart.labels'];
451
+ var labelsColor = prop['chart.labels.color'] || prop['chart.text.color'];
452
+ var labelSpace = (this.graphArea) / labels.length;
453
+ var x = this.gutterLeft + (labelSpace / 2);
454
+ var y = this.gutterTop - (prop['chart.text.size'] / 2) - 5;
455
+ var font = prop['chart.text.font'];
456
+ var size = prop['chart.text.size'];
457
+
458
+ co.beginPath();
459
+ co.fillStyle = prop['chart.text.color'];
460
+ co.strokeStyle = 'black'
461
+
462
+ /**
463
+ * This facilitates chart.labels.align
464
+ */
465
+ if (prop['chart.labels.align'] == 'bottom') {
466
+ y = ca.height - this.gutterBottom + size + 2;
467
+ }
468
+
469
+ /**
470
+ * Draw the horizontal labels
471
+ */
472
+ for (i=0; i<labels.length; ++i) {
473
+ RG.Text2(this,{'font': font,
474
+ 'size':size,
475
+ 'x': x + (i * labelSpace),
476
+ 'y': y,
477
+ 'text': String(labels[i]),
478
+ 'halign':'center',
479
+ 'valign':'center',
480
+ 'tag': 'labels.horizontal'
481
+ });
482
+ }
483
+
484
+ /**
485
+ * Draw the vertical labels
486
+ */
487
+ for (var i=0,len=this.data.length; i<len; ++i) {
488
+
489
+ var ev = this.data[i];
490
+ var x = this.gutterLeft;
491
+ var y = this.gutterTop + this.halfBarHeight + (i * this.barHeight);
492
+
493
+ co.fillStyle = labelsColor || prop['chart.text.color'];
494
+
495
+ RG.Text2(this,{'font': font,
496
+ 'size':size,
497
+ 'x': x - 5,
498
+ 'y': y,
499
+ 'text': RG.is_array(ev[0]) ? (ev[0][3] ? String(ev[0][3]) : '') : (typeof ev[3] == 'string' ? ev[3] : ''),
500
+ 'halign':'right',
501
+ 'valign':'center',
502
+ 'tag': 'labels.vertical'
503
+ });
504
+ }
505
+ };
506
+
507
+
508
+
509
+
510
+ /**
511
+ * Draws the events to the canvas
512
+ */
513
+ this.drawEvents =
514
+ this.DrawEvents = function ()
515
+ {
516
+ var events = this.data;
517
+
518
+ /**
519
+ * Reset the coords array to prevent it growing
520
+ */
521
+ this.coords = [];
522
+
523
+
524
+
525
+
526
+ /**
527
+ * First draw the vertical bars that have been added
528
+ */
529
+ if (prop['chart.vbars']) {
530
+
531
+ for (i=0,len=prop['chart.vbars'].length; i<len; ++i) {
532
+
533
+ // Boundary checking
534
+ if (prop['chart.vbars'][i][0] + prop['chart.vbars'][i][1] > prop['chart.xmax']) {
535
+ prop['chart.vbars'][i][1] = 364 - prop['chart.vbars'][i][0];
536
+ }
537
+
538
+ var barX = this.gutterLeft + (( (prop['chart.vbars'][i][0] - prop['chart.xmin']) / (prop['chart.xmax'] - prop['chart.xmin']) ) * this.graphArea);
539
+
540
+ var barY = this.gutterTop;
541
+ var width = (this.graphArea / (prop['chart.xmax'] - prop['chart.xmin']) ) * prop['chart.vbars'][i][1];
542
+ var height = ca.height - this.gutterTop - this.gutterBottom;
543
+
544
+ // Right hand bounds checking
545
+ if ( (barX + width) > (ca.width - this.gutterRight) ) {
546
+ width = ca.width - this.gutterRight - barX;
547
+ }
548
+
549
+ co.fillStyle = prop['chart.vbars'][i][2];
550
+ co.fillRect(barX, barY, width, height);
551
+ }
552
+ }
553
+
554
+
555
+
556
+
557
+ /**
558
+ * Now draw the horizontal bars
559
+ */
560
+ if (prop['chart.hbars']) {
561
+
562
+ for (i=0,len=prop['chart.hbars'].length; i<len; ++i) {
563
+
564
+ if (prop['chart.hbars'][i]) {
565
+
566
+ var barX = this.gutterLeft,
567
+ barY = ((ca.height - this.gutterTop - this.gutterBottom) / this.data.length) * i + this.gutterTop,
568
+ width = this.graphArea,
569
+ height = this.barHeight
570
+
571
+ co.fillStyle = prop['chart.hbars'][i];
572
+ co.fillRect(barX, barY, width, height);
573
+ }
574
+ }
575
+ }
576
+
577
+
578
+
579
+
580
+ /**
581
+ * Draw the events
582
+ */
583
+ var sequentialIndex = 0;
584
+ for (i=0; i<events.length; ++i) {
585
+ if (typeof(events[i][0]) == 'number') {
586
+ this.DrawSingleEvent(events[i], i, sequentialIndex++);
587
+ } else {
588
+ for (var j=0; j<events[i].length; ++j) {
589
+ this.DrawSingleEvent(events[i][j], i, sequentialIndex++);
590
+ }
591
+ }
592
+
593
+ }
594
+ };
595
+
596
+
597
+
598
+
599
+ /**
600
+ * Retrieves the bar (if any) that has been click on or is hovered over
601
+ *
602
+ * @param object e The event object
603
+ */
604
+ this.getShape =
605
+ this.getBar = function (e)
606
+ {
607
+ e = RG.FixEventObject(e);
608
+
609
+ //var canvas = e.target;
610
+ //var context = canvas.getContext('2d');
611
+ var mouseCoords = RGraph.getMouseXY(e);
612
+ var mouseX = mouseCoords[0];
613
+ var mouseY = mouseCoords[1];
614
+
615
+ /**
616
+ * Loop through the bars determining if the mouse is over a bar
617
+ */
618
+ for (var i=0,len=this.coords.length; i<len; i++) {
619
+
620
+ var left = this.coords[i][0];
621
+ var top = this.coords[i][1];
622
+ var width = this.coords[i][2];
623
+ var height = this.coords[i][3];
624
+
625
+ if ( mouseX >= left
626
+ && mouseX <= (left + width)
627
+ && mouseY >= top
628
+ && mouseY <= (top + height)
629
+ ) {
630
+
631
+ var tooltip = RGraph.parseTooltipText(prop['chart.tooltips'], i);
632
+
633
+ return {0: this, 'object': this,
634
+ 1: left, 'x': left,
635
+ 2: top, 'y': top,
636
+ 3: width, 'width': width,
637
+ 4: height, 'height': height,
638
+ 5: i, 'index': i,
639
+ 'tooltip': tooltip};
640
+ }
641
+ }
642
+ };
643
+
644
+
645
+
646
+
647
+ /**
648
+ * Draws a single event
649
+ */
650
+ this.drawSingleEvent =
651
+ this.DrawSingleEvent = function (ev, index, sequentialIndex)
652
+ {
653
+ var min = prop['chart.xmin'];
654
+
655
+ co.beginPath();
656
+ co.strokeStyle = 'black';
657
+ co.fillStyle = ev[4] ? ev[4] : prop['chart.defaultcolor'];
658
+
659
+ var barStartX = this.gutterLeft + (((ev[0] - min) / (prop['chart.xmax'] - min)) * this.graphArea);
660
+ var barStartY = this.gutterTop + (index * this.barHeight);
661
+ var barWidth = (ev[1] / (prop['chart.xmax'] - min) ) * this.graphArea;
662
+
663
+ /**
664
+ * If the width is greater than the graph atrea, curtail it
665
+ */
666
+ if ( (barStartX + barWidth) > (ca.width - this.gutterRight) ) {
667
+ barWidth = ca.width - this.gutterRight - barStartX;
668
+ }
669
+
670
+ /**
671
+ * Draw the actual bar storing store the coordinates
672
+ */
673
+ this.coords.push([barStartX, barStartY + prop['chart.vmargin'], barWidth, this.barHeight - (2 * prop['chart.vmargin'])]);
674
+
675
+ // draw the border around the bar
676
+ if (prop['chart.borders'] || ev[6]) {
677
+ co.strokeStyle = typeof(ev[6]) == 'string' ? ev[6] : 'black';
678
+ co.lineWidth = (typeof(ev[7]) == 'number' ? ev[7] : 1);
679
+ co.beginPath();
680
+ co.strokeRect(barStartX, barStartY + prop['chart.vmargin'], barWidth, this.barHeight - (2 * prop['chart.vmargin']) );
681
+ }
682
+
683
+ co.beginPath();
684
+ co.fillRect(barStartX, barStartY + prop['chart.vmargin'], barWidth, this.barHeight - (2 * prop['chart.vmargin']) );
685
+ co.fill();
686
+
687
+ // Work out the completeage indicator
688
+ var complete = (ev[2] / 100) * barWidth;
689
+
690
+ // Draw the % complete indicator. If it's greater than 0
691
+ if (typeof(ev[2]) == 'number') {
692
+ co.beginPath();
693
+ co.fillStyle = ev[5] ? ev[5] : '#0c0';
694
+ co.fillRect(barStartX,
695
+ barStartY + prop['chart.vmargin'],
696
+ (ev[2] / 100) * barWidth,
697
+ this.barHeight - (2 * prop['chart.vmargin']) );
698
+
699
+ // Don't necessarily have to draw the label
700
+ if (prop['chart.labels.percent']) {
701
+ co.beginPath();
702
+ co.fillStyle = prop['chart.text.color'];
703
+ RG.Text2(this,{
704
+ 'font': prop['chart.text.font'],
705
+ 'size': prop['chart.text.size'],
706
+ 'x': barStartX + barWidth + 5,
707
+ 'y': barStartY + this.halfBarHeight,
708
+ 'text': String(ev[2]) + '%',
709
+ 'valign':'center',
710
+ 'tag': 'labels.complete'
711
+ });
712
+ }
713
+ }
714
+
715
+ /**
716
+ * Draw the inbar label if it's defined
717
+ */
718
+ if (prop['chart.labels.inbar'] && prop['chart.labels.inbar'][sequentialIndex]) {
719
+
720
+ var label = String(prop['chart.labels.inbar'][sequentialIndex]);
721
+ var halign = prop['chart.labels.inbar.align'] == 'left' ? 'left' : 'center';
722
+ halign = prop['chart.labels.inbar.align'] == 'right' ? 'right' : halign;
723
+
724
+ // Work out the position of the text
725
+ if (halign == 'right') {
726
+ var x = (barStartX + barWidth) - 5;
727
+ } else if (halign == 'center') {
728
+ var x = barStartX + (barWidth / 2);
729
+ } else {
730
+ var x = barStartX + 5;
731
+ }
732
+
733
+
734
+ // Draw the labels "above" the bar
735
+ if (prop['chart.labels.inbar.above']) {
736
+ x = barStartX + barWidth + 5;
737
+ halign = 'left';
738
+ }
739
+
740
+
741
+ // Set the color
742
+ co.fillStyle = prop['chart.labels.inbar.color'];
743
+ RGraph.Text2(this,{'font':prop['chart.labels.inbar.font'],
744
+ 'size':prop['chart.labels.inbar.size'],
745
+ 'x': x,
746
+ 'y': barStartY + this.halfBarHeight,
747
+ 'text': label,
748
+ 'valign':'center',
749
+ 'halign':halign,
750
+ 'bounding': typeof(prop['chart.labels.inbar.bgcolor']) == 'string',
751
+ 'boundingFill':typeof(prop['chart.labels.inbar.bgcolor']) == 'string' ? prop['chart.labels.inbar.bgcolor'] : null,
752
+ 'tag': 'labels.inbar'
753
+ });
754
+ }
755
+ };
756
+
757
+
758
+
759
+
760
+ /**
761
+ * Each object type has its own Highlight() function which highlights the appropriate shape
762
+ *
763
+ * @param object shape The shape to highlight
764
+ */
765
+ this.highlight =
766
+ this.Highlight = function (shape)
767
+ {
768
+ // Add the new highlight
769
+ RG.Highlight.Rect(this, shape);
770
+ };
771
+
772
+
773
+
774
+
775
+ /**
776
+ * The getObjectByXY() worker method. Don't call this call:
777
+ *
778
+ * RGraph.ObjectRegistry.getObjectByXY(e)
779
+ *
780
+ * @param object e The event object
781
+ */
782
+ this.getObjectByXY = function (e)
783
+ {
784
+ var mouseXY = RG.getMouseXY(e);
785
+
786
+ if (
787
+ mouseXY[0] > this.gutterLeft
788
+ && mouseXY[0] < (ca.width - this.gutterRight)
789
+ && mouseXY[1] > this.gutterTop
790
+ && mouseXY[1] < (ca.height - this.gutterBottom)
791
+ ) {
792
+
793
+ return this;
794
+ }
795
+ };
796
+
797
+
798
+
799
+
800
+ /**
801
+ * This method handles the adjusting calculation for when the mouse is moved
802
+ *
803
+ * @param object e The event object
804
+ */
805
+ this.adjusting_mousemove =
806
+ this.Adjusting_mousemove = function (e)
807
+ {
808
+ /**
809
+ * Handle adjusting for the Bar
810
+ */
811
+ if (prop['chart.adjustable'] && RG.Registry.Get('chart.adjusting') && RG.Registry.Get('chart.adjusting').uid == this.uid) {
812
+
813
+ var bar = RG.Registry.Get('chart.adjusting.gantt');
814
+
815
+ if (bar) {
816
+ var mouseXY = RG.getMouseXY(e);
817
+ var obj = RG.Registry.Get('chart.adjusting.gantt')['object'];
818
+ var index = bar['index'];
819
+ var diff = ((mouseXY[0] - RG.Registry.Get('chart.adjusting.gantt')['mousex']) / (ca.width - obj.gutterLeft - obj.gutterRight)) * prop['chart.xmax'];
820
+ var eventStart = RG.Registry.Get('chart.adjusting.gantt')['event_start'];
821
+ var duration = RG.Registry.Get('chart.adjusting.gantt')['event_duration'];
822
+
823
+ if (bar['mode'] == 'move') {
824
+
825
+ diff = Math.round(diff);
826
+
827
+ if ( eventStart + diff >= 0
828
+ && (eventStart + diff + obj.data[index][1]) < prop['chart.xmax']) {
829
+
830
+ obj.data[index][0] = eventStart + diff;
831
+
832
+ } else if (eventStart + diff < 0) {
833
+ obj.data[index][0] = 0;
834
+ //
835
+ } else if ((eventStart + diff + obj.data[index][1]) > prop['chart.xmax']) {
836
+ obj.data[index][0] = prop['chart.xmax'] - obj.data[index][1];
837
+ }
838
+
839
+ } else if (bar['mode'] == 'resize') {
840
+
841
+ /*
842
+ * Account for the right hand gutter. Appears to be a FF bug
843
+ */
844
+ if (mouseXY[0] > (ca.width - obj.gutterRight)) {
845
+ mouseXY[0] = ca.width - obj.gutterRight;
846
+ }
847
+
848
+ var diff = ((mouseXY[0] - RG.Registry.Get('chart.adjusting.gantt')['mousex']) / (ca.width - obj.gutterLeft - obj.gutterRight)) * prop['chart.xmax'];
849
+ diff = Math.round(diff);
850
+
851
+ obj.data[index][1] = duration + diff;
852
+
853
+ if (obj.data[index][1] < 0) {
854
+ obj.data[index][1] = 1;
855
+ }
856
+ }
857
+
858
+ RG.resetColorsToOriginalValues(this);
859
+
860
+ //RG.Clear(ca);
861
+ RG.redrawCanvas(ca);
862
+
863
+ RG.fireCustomEvent(obj, 'onadjust');
864
+ }
865
+ }
866
+ };
867
+
868
+
869
+
870
+
871
+ /**
872
+ * This function positions a tooltip when it is displayed
873
+ *
874
+ * @param obj object The chart object
875
+ * @param int x The X coordinate specified for the tooltip
876
+ * @param int y The Y coordinate specified for the tooltip
877
+ * @param objec tooltip The tooltips DIV element
878
+ */
879
+ this.positionTooltip = function (obj, x, y, tooltip, idx)
880
+ {
881
+ var coordX = obj.coords[tooltip.__index__][0];
882
+ var coordY = obj.coords[tooltip.__index__][1];
883
+ var coordW = obj.coords[tooltip.__index__][2];
884
+ var coordH = obj.coords[tooltip.__index__][3];
885
+ var canvasXY = RG.getCanvasXY(obj.canvas);
886
+ var gutterLeft = obj.gutterLeft;
887
+ var gutterTop = obj.gutterTop;
888
+ var width = tooltip.offsetWidth;
889
+ var height = tooltip.offsetHeight;
890
+
891
+ // Set the top position
892
+ tooltip.style.left = 0;
893
+ tooltip.style.top = canvasXY[1] + coordY - height - 7 + 'px';
894
+
895
+ // By default any overflow is hidden
896
+ tooltip.style.overflow = '';
897
+
898
+ // The arrow
899
+ var img = new Image();
900
+ img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
901
+ img.style.position = 'absolute';
902
+ img.id = '__rgraph_tooltip_pointer__';
903
+ img.style.top = (tooltip.offsetHeight - 2) + 'px';
904
+ tooltip.appendChild(img);
905
+
906
+ // Reposition the tooltip if at the edges:
907
+
908
+ // LEFT edge
909
+ if ((canvasXY[0] + coordX - (width / 2)) < 10) {
910
+ tooltip.style.left = (canvasXY[0] + coordX - (width * 0.1)) + (coordW / 2) + 'px';
911
+ img.style.left = ((width * 0.1) - 8.5) + 'px';
912
+
913
+ // RIGHT edge
914
+ } else if ((canvasXY[0] + coordX + (width / 2)) > document.body.offsetWidth) {
915
+ tooltip.style.left = canvasXY[0] + coordX - (width * 0.9) + (coordW / 2) + 'px';
916
+ img.style.left = ((width * 0.9) - 8.5) + 'px';
917
+
918
+ // Default positioning - CENTERED
919
+ } else {
920
+ tooltip.style.left = (canvasXY[0] + coordX + (coordW / 2) - (width * 0.5)) + 'px';
921
+ img.style.left = ((width * 0.5) - 8.5) + 'px';
922
+ }
923
+ };
924
+
925
+
926
+
927
+
928
+ /**
929
+ * Returns the X coordinate for the given value
930
+ *
931
+ * @param number value The desired value (eg minute/hour/day etc)
932
+ */
933
+ this.getXCoord = function (value)
934
+ {
935
+ var min = prop['chart.xmin'];
936
+ var max = prop['chart.xmax'];
937
+ var graphArea = ca.width - this.gutterLeft - this.gutterRight;
938
+
939
+ if (value > max || value < min) {
940
+ return null;
941
+ }
942
+
943
+
944
+ var x = (((value - min) / (max - min)) * graphArea) + this.gutterLeft;
945
+
946
+ return x;
947
+ };
948
+
949
+
950
+
951
+
952
+ /**
953
+ * Returns the value given EITHER the event object OR a two element array containing the X/Y coords
954
+ */
955
+ this.getValue = function (arg)
956
+ {
957
+ if (arg.length == 2) {
958
+ var mouseXY = arg;
959
+ } else {
960
+ var mouseXY = RGraph.getMouseXY(arg);
961
+ }
962
+
963
+ var mouseX = mouseXY[0];
964
+ var mouseY = mouseXY[1];
965
+
966
+ var value = (mouseX - this.gutterLeft) / (ca.width - this.gutterLeft - this.gutterRight);
967
+ value *= (prop['chart.xmax'] - prop['chart.xmin']);
968
+
969
+ // Bounds checking
970
+ if (value < prop['chart.xmin'] || value > prop['chart.xmax']) {
971
+ value = null;
972
+ }
973
+
974
+ return value;
975
+ };
976
+
977
+
978
+
979
+
980
+ /**
981
+ * This allows for easy specification of gradients. Could optimise this not to repeatedly call parseSingleColors()
982
+ */
983
+ this.parseColors = function ()
984
+ {
985
+ // Save the original colors so that they can be restored when the canvas is reset
986
+ if (this.original_colors.length === 0) {
987
+
988
+ this.original_colors['data'] = RG.arrayClone(this.data);
989
+
990
+
991
+ this.original_colors['chart.background.barcolor1'] = RG.array_clone(prop['chart.background.barcolor1']);
992
+ this.original_colors['chart.background.barcolor2'] = RG.array_clone(prop['chart.background.barcolor2']);
993
+ this.original_colors['chart.background.grid.color'] = RG.array_clone(prop['chart.background.grid.color']);
994
+ this.original_colors['chart.defaultcolor'] = RG.array_clone(prop['chart.defaultcolor']);
995
+ this.original_colors['chart.highlight.stroke'] = RG.array_clone(prop['chart.highlight.stroke']);
996
+ this.original_colors['chart.highlight.fill'] = RG.array_clone(prop['chart.highlight.fill']);
997
+ }
998
+
999
+
1000
+
1001
+
1002
+ /**
1003
+ * this.coords can be used here as gradients are only parsed on the SECOND draw - not the first.
1004
+ * A .redraw() is downe at the end of the first draw.
1005
+ */
1006
+ for (var i=0,sequentialIndex=0; i<this.data.length; ++i) {
1007
+
1008
+ if (typeof this.data[i][0] == 'object' && typeof this.data[i][0][0] === 'number') {
1009
+
1010
+ for (var j=0,len=this.data[i].length; j<len; j+=1,sequentialIndex+=1) {
1011
+ this.data[i][j][4] = this.parseSingleColorForGradient(this.data[i][j][4], {start: this.data[i][j][0],duration: this.data[i][j][1]});
1012
+ this.data[i][j][5] = this.parseSingleColorForGradient(this.data[i][j][5], {start: this.data[i][j][0],duration: this.data[i][j][1]});
1013
+ }
1014
+
1015
+ } else {
1016
+
1017
+ if (typeof this.data[i][4] == 'string') this.data[i][4] = this.parseSingleColorForGradient(this.data[i][4], {start: this.data[i][0],duration: this.data[i][1]});
1018
+ if (typeof this.data[i][5] == 'string') this.data[i][5] = this.parseSingleColorForGradient(this.data[i][5], {start: this.data[i][0],duration: this.data[i][1]});
1019
+ ++sequentialIndex;
1020
+ }
1021
+ }
1022
+
1023
+ prop['chart.background.barcolor1'] = this.parseSingleColorForGradient(prop['chart.background.barcolor1']);
1024
+ prop['chart.background.barcolor2'] = this.parseSingleColorForGradient(prop['chart.background.barcolor2']);
1025
+ prop['chart.background.grid.color'] = this.parseSingleColorForGradient(prop['chart.background.grid.color']);
1026
+ prop['chart.background.color'] = this.parseSingleColorForGradient(prop['chart.background.color']);
1027
+ prop['chart.defaultcolor'] = this.parseSingleColorForGradient(prop['chart.defaultcolor']);
1028
+ prop['chart.highlight.stroke'] = this.parseSingleColorForGradient(prop['chart.highlight.stroke']);
1029
+ prop['chart.highlight.fill'] = this.parseSingleColorForGradient(prop['chart.highlight.fill']);
1030
+ };
1031
+
1032
+
1033
+
1034
+
1035
+ /**
1036
+ * Use this function to reset the object to the post-constructor state. Eg reset colors if
1037
+ * need be etc
1038
+ */
1039
+ this.reset = function ()
1040
+ {
1041
+ };
1042
+
1043
+
1044
+
1045
+
1046
+ /**
1047
+ * This parses a single color value
1048
+ *
1049
+ * @param string color The color to parse
1050
+ */
1051
+ this.parseSingleColorForGradient = function (color)
1052
+ {
1053
+ var opts = arguments[1] || {};
1054
+
1055
+ if (!color || typeof(color) != 'string') {
1056
+ return color;
1057
+ }
1058
+
1059
+
1060
+ if (color.match(/^gradient\((.*)\)$/i)) {
1061
+
1062
+ var parts = RegExp.$1.split(':');
1063
+ var value = (opts.start + opts.duration) > prop['chart.xmax'] ? prop['chart.xmax'] : (opts.start + opts.duration);
1064
+
1065
+ // Create the gradient
1066
+ var grad = co.createLinearGradient(
1067
+ typeof opts.start === 'number' ? this.getXCoord(opts.start) : this.gutterLeft,
1068
+ 0,
1069
+ typeof opts.start === 'number' ? this.getXCoord(value) : ca.width - this.gutterRight,
1070
+ 0
1071
+ );
1072
+
1073
+ var diff = 1 / (parts.length - 1);
1074
+
1075
+ grad.addColorStop(0, RG.trim(parts[0]));
1076
+ for (var j=1; j<parts.length; ++j) {
1077
+ grad.addColorStop(j * diff, RG.trim(parts[j]));
1078
+ }
1079
+ }
1080
+
1081
+ return grad ? grad : color;
1082
+ };
1083
+
1084
+
1085
+
1086
+
1087
+ /**
1088
+ * Using a function to add events makes it easier to facilitate method chaining
1089
+ *
1090
+ * @param string type The type of even to add
1091
+ * @param function func
1092
+ */
1093
+ this.on = function (type, func)
1094
+ {
1095
+ if (type.substr(0,2) !== 'on') {
1096
+ type = 'on' + type;
1097
+ }
1098
+
1099
+ this[type] = func;
1100
+
1101
+ return this;
1102
+ };
1103
+
1104
+
1105
+
1106
+
1107
+ /**
1108
+ * This function runs once only
1109
+ * (put at the end of the file (before any effects))
1110
+ */
1111
+ this.firstDrawFunc = function ()
1112
+ {
1113
+ };
1114
+
1115
+
1116
+
1117
+
1118
+ /**
1119
+ * Gantt chart Grow effect
1120
+ *
1121
+ * @param object obj Options for the grow effect
1122
+ * @param function Optional callback (a function)
1123
+ */
1124
+ this.grow = function ()
1125
+ {
1126
+ var obj = this;
1127
+ var opt = arguments[0] || {};
1128
+ var callback = arguments[1] ? arguments[1] : function () {};
1129
+ var canvas = obj.canvas;
1130
+ var context = obj.context;
1131
+ var numFrames = opt.frames || 30;
1132
+ var frame = 0;
1133
+
1134
+ var original_events = RG.arrayClone(obj.data);
1135
+
1136
+ function iterator ()
1137
+ {
1138
+ RG.clear(obj.canvas);
1139
+ RG.redrawCanvas(obj.canvas);
1140
+
1141
+
1142
+ if (frame <= numFrames) {
1143
+ // Update the events
1144
+ for (var i=0,len=obj.data.length; i<len; ++i) {
1145
+ if (typeof obj.data[i][0] === 'object') {
1146
+ for (var j=0; j<obj.data[i].length; ++j) {
1147
+ obj.data[i][j][1] = (frame / numFrames) * original_events[i][j][1];
1148
+ }
1149
+ } else {
1150
+ obj.data[i][1] = (frame / numFrames) * original_events[i][1];
1151
+ }
1152
+ }
1153
+
1154
+ obj.reset();
1155
+
1156
+
1157
+
1158
+ frame++;
1159
+
1160
+ RGraph.Effects.updateCanvas(iterator);
1161
+
1162
+ } else {
1163
+ callback(obj);
1164
+ }
1165
+ }
1166
+
1167
+ iterator();
1168
+
1169
+ return this;
1170
+ };
1171
+
1172
+
1173
+
1174
+
1175
+ /**
1176
+ * This helps the Gantt reset colors when the reset function is called.
1177
+ * It handles going through the data and resetting the colors.
1178
+ */
1179
+ this.resetColorsToOriginalValues = function ()
1180
+ {
1181
+ /**
1182
+ * Copy the original colors over for single-event-per-line data
1183
+ */
1184
+ for (var i=0; i<this.original_colors['data'].length; ++i) {
1185
+ if (this.original_colors['data'][i][4]) {
1186
+ this.data[i][4] = RG.arrayClone(this.original_colors['data'][i][4]);
1187
+ }
1188
+
1189
+ if (this.original_colors['data'][i][5]) {
1190
+ this.data[i][5] = RG.arrayClone(this.original_colors['data'][i][5]);
1191
+ }
1192
+
1193
+ if (typeof this.original_colors['data'][i][0] === 'object' && typeof this.original_colors['data'][i][0][0] === 'number') {
1194
+ for (var j=0,len2=this.original_colors['data'][i].length; j<len2; ++j) {
1195
+ this.data[i][j][4] = RG.arrayClone(this.original_colors['data'][i][j][4]);
1196
+ this.data[i][j][5] = RG.arrayClone(this.original_colors['data'][i][j][5]);
1197
+ }
1198
+ }
1199
+ }
1200
+ };
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+ /**
1207
+ * This function resets the object - clearing it of any previously gathered info
1208
+ */
1209
+ this.reset = function ()
1210
+ {
1211
+ this.resetColorsToOriginalValues();
1212
+
1213
+ this.colorsParsed = false;
1214
+ this.coordsText = [];
1215
+ this.original_colors = [];
1216
+ this.firstDraw = true;
1217
+ this.coords = [];
1218
+ };
1219
+
1220
+
1221
+
1222
+ RG.att(ca);
1223
+
1224
+
1225
+
1226
+
1227
+ /**
1228
+ * Register the object
1229
+ */
1230
+ RG.Register(this);
1231
+
1232
+
1233
+
1234
+
1235
+ /**
1236
+ * This is the 'end' of the constructor so if the first argument
1237
+ * contains configuration data - handle that.
1238
+ */
1239
+ if (parseConfObjectForOptions) {
1240
+ RG.parseObjectStyleConfig(this, conf.options);
1241
+ }
1242
+ };