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,21 +1,452 @@
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.SVG=RGraph.SVG||{};RGraph.SVG.HTML=RGraph.SVG.HTML||{};(function(win,doc,undefined)
3
- {var RG=RGraph,ua=navigator.userAgent,ma=Math;RG.SVG.drawKey=function(obj)
4
- {var prop=obj.properties,key=prop.key,colors=prop.keyColors||prop.colors,defaultFont='Arial',blobSize=0,width=0,keyColorShape=prop.keyColorShape;var centerx=obj.svg.getAttribute('width')/2;if(obj.type==='funnel'){centerx=(obj.graphWidth/2)+prop.marginLeft;}
5
- if(key&&key.length){for(var i=0,length=0;i<key.length;i++){var textDimensions=RG.SVG.measureText({text:key[i],italic:prop.keyLabelsItalic||prop.textItalic,bold:prop.keyLabelsBold||prop.textBold,font:prop.keyLabelsFont||prop.textFont||defaultFont,size:prop.keyLabelsSize||prop.textSize});blobSize=ma.max(blobSize,textDimensions[1]);width=width+10+blobSize+5+textDimensions[0];}
6
- x=centerx-width/2;for(var i=0,y=prop.marginTop-5;i<key.length;++i){if(i===0){if(obj.type==='pie'&&prop.highlightStyle=='outline'){y-=prop.highlightStyleOutlineWidth;}}
7
- var textDimensions=RG.SVG.measureText({text:key[i],italic:prop.keyLabelsItalic||prop.textItalic,bold:prop.keyLabelsBold||prop.textBold,font:prop.keyLabelsFont||prop.textFont||defaultFont,size:prop.keyLabelsSize||prop.textSize});var shape=prop.keyColorShape;if(typeof shape==='object'){shape=prop.keyColorShape[i];}
8
- if(shape==='circle'){RG.SVG.create({svg:obj.svg,type:'circle',parent:obj.svg.all,attr:{cx:x+(blobSize/2)+prop.keyOffsetx,cy:y-(blobSize/2)+prop.keyOffsety,r:blobSize/2,fill:colors[i]}});}else if(shape==='triangle'){RG.SVG.create({svg:obj.svg,type:'path',parent:obj.svg.all,attr:{d:'M {1} {2} L {3} {4} L {5} {6} z'.format(x+prop.keyOffsetx+(blobSize/2),y-blobSize+prop.keyOffsety,x+prop.keyOffsetx+blobSize,y+prop.keyOffsety,x+prop.keyOffsetx,y+prop.keyOffsety),fill:colors[i]}});}else if(shape==='line'){RG.SVG.create({svg:obj.svg,type:'path',parent:obj.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(x+prop.keyOffsetx,y-(blobSize/2)+prop.keyOffsety,x+prop.keyOffsetx+blobSize,y-(blobSize/2)+prop.keyOffsety),stroke:colors[i],'stroke-width':2,'stroke-linecap':'round'}});}else if(shape==='dot'){RG.SVG.create({svg:obj.svg,type:'path',parent:obj.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(x+prop.keyOffsetx,y-(blobSize/2)+prop.keyOffsety,x+prop.keyOffsetx+blobSize,y-(blobSize/2)+prop.keyOffsety),stroke:colors[i],'stroke-width':2,'stroke-linecap':'round'}});RG.SVG.create({svg:obj.svg,type:'circle',parent:obj.svg.all,attr:{cx:x+(blobSize/2)+prop.keyOffsetx,cy:y-(blobSize/2)+prop.keyOffsety,r:blobSize/4,fill:colors[i]}});}else if(shape==='squaredot'||shape==='rectdot'){RG.SVG.create({svg:obj.svg,type:'path',parent:obj.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(x+prop.keyOffsetx,y-(blobSize/2)+prop.keyOffsety,x+prop.keyOffsetx+blobSize,y-(blobSize/2)+prop.keyOffsety),stroke:colors[i],'stroke-width':2,'stroke-linecap':'round'}});RG.SVG.create({svg:obj.svg,type:'rect',parent:obj.svg.all,attr:{x:x+(blobSize/4)+prop.keyOffsetx,y:y+(blobSize/4)-blobSize+prop.keyOffsety,width:blobSize/2,height:blobSize/2,fill:colors[i]}});}else if(typeof shape==='function'){RG.SVG.create({svg:obj.svg,type:'path',parent:obj.svg.all,attr:{d:'M {1} {2} L {3} {4}'.format(x+prop.keyOffsetx,y-(blobSize/2)+prop.keyOffsety,x+prop.keyOffsetx+blobSize,y-(blobSize/2)+prop.keyOffsety),stroke:colors[i],'stroke-width':2,'stroke-linecap':'round'}});}else{RG.SVG.create({svg:obj.svg,type:'rect',parent:obj.svg.all,attr:{x:x+prop.keyOffsetx,y:y-blobSize+prop.keyOffsety,width:blobSize,height:blobSize,fill:colors[i]}});}
9
- RGraph.SVG.text({object:obj,parent:obj.svg.all,tag:'key',size:typeof prop.keyLabelsSize==='number'?prop.keyLabelsSize:prop.textSize,bold:typeof prop.keyLabelsBold==='boolean'?prop.keyLabelsBold:prop.textBold,italic:typeof prop.keyLabelsItalic==='boolean'?prop.keyLabelsItalic:prop.textItalic,font:prop.keyLabelsFont||prop.textFont,color:prop.keyLabelsColor||prop.textColor,halign:'left',valign:'bottom',text:key[i],x:x+blobSize+5+prop.keyLabelsOffsetx+prop.keyOffsetx,y:y+prop.keyLabelsOffsety+prop.keyOffsety,background:prop.keyLabelsBackground||'white',padding:0})
10
- x+=10+blobSize+5+textDimensions[0];}}};RG.SVG.HTML.key=function(id,prop)
11
- {var div=doc.getElementById(id);var str='<table border="0" cellspacing="0" cellpadding="0" id="rgraph_key" style="display: inline;'+(function()
12
- {var style=''
13
- for(i in prop.tableCss){if(typeof i==='string'){style=style+i+': '+prop.tableCss[i]+';';}}
14
- return style;})()+'" '+(prop.tableClass?'class="'+prop.tableClass+'"':'')+'>';for(var i=0;i<prop.labels.length;i+=1){str+='<tr><td><div style="'+(function()
15
- {var style='';for(var j in prop.blobCss){if(typeof j==='string'){style=style+j+': '+prop.blobCss[j]+';';}}
16
- return style;})()+'display: inline-block; margin-right: 5px; margin-top: 4px; width: 15px; height: 15px; background-color: '+prop.colors[i]+'"'+(prop.blobClass?'class="'+prop.blobClass+'"':'')+'>&nbsp;</div><td>'+(prop.links&&prop.links[i]?'<a href="'+prop.links[i]+'">':'')+'<span '+(prop.labelClass?'class="'+prop.labelClass+'"':'')+'" style="'+(function()
17
- {var style='';for(var j in prop.labelCss){if(typeof j==='string'){style=style+j+': '+prop.labelCss[j]+';';}}
18
- return style;})()+'" '+(function()
19
- {var style='';if(prop['labelCss_'+i]){for(var j in prop['labelCss_'+i]){style=style+j+': '+prop['labelCss_'+i][j]+';';}}
20
- return style?'style="'+style+'"':'';})()+'>'+prop.labels[i]+'</span>'+(prop.links&&prop.links[i]?'</a>':'')+'</td></tr>';}
21
- div.innerHTML+=(str+'</table>');return doc.getElementById('rgraph_key');};})(window,document);
12
+ RGraph = window.RGraph || {isrgraph:true,isRGraph:true,rgraph:true};
13
+ RGraph.SVG = RGraph.SVG || {};
14
+ RGraph.SVG.HTML = RGraph.SVG.HTML || {};
15
+
16
+ // Module pattern
17
+ (function (win, doc, undefined)
18
+ {
19
+ //
20
+ // Draws the graph key (used by various graphs)
21
+ //
22
+ // @param object obj The graph object
23
+ // @param array key An array of the texts to be listed in the key
24
+ // @param colors An array of the colors to be used
25
+ //
26
+ RGraph.SVG.drawKey = function (obj)
27
+ {
28
+ var properties = obj.properties,
29
+ key = properties.key,
30
+ colors = properties.keyColors || properties.colors,
31
+ defaultFont = 'Arial',
32
+ blobSize = 0,
33
+ width = 0,
34
+ keyColorShape = properties.keyColorShape;
35
+
36
+ // Work out the center point of the SVG tag
37
+ var centerx = obj.svg.getAttribute('width') / 2;
38
+
39
+ // If we're drawing a key on a funnel then work out the center of
40
+ // the chart differently. This may be useful to other chart types
41
+ // too
42
+ if (obj.type === 'funnel') {
43
+ centerx = (obj.graphWidth / 2) + properties.marginLeft;
44
+ }
45
+
46
+
47
+
48
+
49
+ // Loop thru the key and draw them
50
+ if (key && key.length) {
51
+
52
+ // First measure the length so that the key can be centered
53
+ for (var i=0,length = 0; i<key.length; i++) {
54
+
55
+ // First measure the text
56
+ var textDimensions = RGraph.SVG.measureText({
57
+ text: key[i],
58
+ italic: properties.keyLabelsItalic || properties.textItalic,
59
+ bold: properties.keyLabelsBold || properties.textBold,
60
+ font: properties.keyLabelsFont || properties.textFont || defaultFont,
61
+ size: properties.keyLabelsSize || properties.textSize,
62
+ cache: false
63
+ });
64
+
65
+ blobSize = Math.max(blobSize, textDimensions[1]);
66
+
67
+ width = width + 10 + blobSize + 5 + textDimensions[0];
68
+ }
69
+
70
+ // Center the key
71
+ x = centerx - width / 2;
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ // Get the text configuration
82
+ var textConf = RGraph.SVG.getTextConf({
83
+ object: obj,
84
+ prefix: 'keyLabels'
85
+ });
86
+
87
+
88
+ for (var i=0,y=properties.marginTop - 5; i<key.length; ++i) {
89
+
90
+ // Do this on the first iteration only
91
+ if (i === 0) {
92
+ if (obj.type === 'pie' && properties.highlightStyle == 'outline') {
93
+ y -= properties.highlightStyleOutlineWidth;
94
+ }
95
+ }
96
+
97
+
98
+ // First measure the text
99
+ var textDimensions = RGraph.SVG.measureText({
100
+ text: key[i],
101
+ italic: properties.keyLabelsItalic || properties.textItalic,
102
+ bold: properties.keyLabelsBold || properties.textBold,
103
+ font: properties.keyLabelsFont || properties.textFont || defaultFont,
104
+ size: properties.keyLabelsSize || properties.textSize,
105
+ cache: false
106
+ });
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ //
120
+ // Draw the blob of color (accounting for it being an array first)
121
+ //
122
+
123
+ var shape = properties.keyColorShape;
124
+
125
+ if (typeof shape === 'object') {
126
+ shape = properties.keyColorShape[i];
127
+ }
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ // A circle
136
+ if (shape === 'circle') {
137
+ RGraph.SVG.create({
138
+ svg: obj.svg,
139
+ type: 'circle',
140
+ parent: obj.svg.all,
141
+ attr: {
142
+ cx: x + (blobSize / 2) + properties.keyOffsetx,
143
+ cy: y - (blobSize / 2) + properties.keyOffsety,
144
+ r: blobSize / 2,
145
+ fill: colors[i]
146
+ }
147
+ });
148
+
149
+
150
+
151
+
152
+
153
+ // A triangle
154
+ } else if (shape === 'triangle') {
155
+ RGraph.SVG.create({
156
+ svg: obj.svg,
157
+ type: 'path',
158
+ parent: obj.svg.all,
159
+ attr: {
160
+ d: 'M {1} {2} L {3} {4} L {5} {6} z'.format(
161
+ x + properties.keyOffsetx + (blobSize / 2),
162
+ y - blobSize + properties.keyOffsety,
163
+
164
+ x + properties.keyOffsetx + blobSize,
165
+ y + properties.keyOffsety,
166
+
167
+ x + properties.keyOffsetx,
168
+ y + properties.keyOffsety
169
+ ),
170
+ fill: colors[i]
171
+ }
172
+ });
173
+
174
+
175
+
176
+
177
+
178
+ // A line
179
+ } else if (shape === 'line') {
180
+ RGraph.SVG.create({
181
+ svg: obj.svg,
182
+ type: 'path',
183
+ parent: obj.svg.all,
184
+ attr: {
185
+ d: 'M {1} {2} L {3} {4}'.format(
186
+ x + properties.keyOffsetx,
187
+ y - (blobSize / 2) + properties.keyOffsety,
188
+
189
+ x + properties.keyOffsetx + blobSize,
190
+ y - (blobSize / 2) + properties.keyOffsety
191
+ ),
192
+ stroke: colors[i],
193
+ 'stroke-width': 2,
194
+ 'stroke-linecap': 'round'
195
+ }
196
+ });
197
+
198
+
199
+
200
+
201
+
202
+ // A dot
203
+ } else if (shape === 'dot') {
204
+
205
+ RGraph.SVG.create({
206
+ svg: obj.svg,
207
+ type: 'path',
208
+ parent: obj.svg.all,
209
+ attr: {
210
+ d: 'M {1} {2} L {3} {4}'.format(
211
+ x + properties.keyOffsetx,
212
+ y - (blobSize / 2) + properties.keyOffsety,
213
+
214
+ x + properties.keyOffsetx + blobSize,
215
+ y - (blobSize / 2) + properties.keyOffsety
216
+ ),
217
+ stroke: colors[i],
218
+ 'stroke-width': 2,
219
+ 'stroke-linecap': 'round'
220
+ }
221
+ });
222
+
223
+ RGraph.SVG.create({
224
+ svg: obj.svg,
225
+ type: 'circle',
226
+ parent: obj.svg.all,
227
+ attr: {
228
+ cx: x + (blobSize / 2) + properties.keyOffsetx,
229
+ cy: y - (blobSize / 2) + properties.keyOffsety,
230
+ r: blobSize / 4,
231
+ fill: colors[i]
232
+ }
233
+ });
234
+
235
+ // A dot
236
+ } else if (shape === 'squaredot' || shape === 'rectdot') {
237
+
238
+ // Create the line
239
+ RGraph.SVG.create({
240
+ svg: obj.svg,
241
+ type: 'path',
242
+ parent: obj.svg.all,
243
+ attr: {
244
+ d: 'M {1} {2} L {3} {4}'.format(
245
+ x + properties.keyOffsetx,
246
+ y - (blobSize / 2) + properties.keyOffsety,
247
+
248
+ x + properties.keyOffsetx + blobSize,
249
+ y - (blobSize / 2) + properties.keyOffsety
250
+ ),
251
+ stroke: colors[i],
252
+ 'stroke-width': 2,
253
+ 'stroke-linecap': 'round'
254
+ }
255
+ });
256
+
257
+ RGraph.SVG.create({
258
+ svg: obj.svg,
259
+ type: 'rect',
260
+ parent: obj.svg.all,
261
+ attr: {
262
+ x: x + (blobSize / 4) + properties.keyOffsetx,
263
+ y: y + (blobSize / 4) - blobSize + properties.keyOffsety,
264
+ width: blobSize / 2,
265
+ height: blobSize / 2,
266
+ fill: colors[i]
267
+ }
268
+ });
269
+
270
+
271
+
272
+ // Ccustom
273
+ } else if (typeof shape === 'function') {
274
+ RGraph.SVG.create({
275
+ svg: obj.svg,
276
+ type: 'path',
277
+ parent: obj.svg.all,
278
+ attr: {
279
+ d: 'M {1} {2} L {3} {4}'.format(
280
+ x + properties.keyOffsetx,
281
+ y - (blobSize / 2) + properties.keyOffsety,
282
+
283
+ x + properties.keyOffsetx + blobSize,
284
+ y - (blobSize / 2) + properties.keyOffsety
285
+ ),
286
+ stroke: colors[i],
287
+ 'stroke-width': 2,
288
+ 'stroke-linecap': 'round'
289
+ }
290
+ });
291
+
292
+
293
+
294
+ // A rectangle default
295
+ } else {
296
+ RGraph.SVG.create({
297
+ svg: obj.svg,
298
+ type: 'rect',
299
+ parent: obj.svg.all,
300
+ attr: {
301
+ x: x + properties.keyOffsetx,
302
+ y: y - blobSize + properties.keyOffsety,
303
+ width: blobSize,
304
+ height: blobSize,
305
+ fill: colors[i]
306
+ }
307
+ });
308
+ }
309
+
310
+ //
311
+ // Add the text
312
+ //
313
+ RGraph.SVG.text({
314
+
315
+ object: obj,
316
+ parent: obj.svg.all,
317
+ tag: 'key',
318
+
319
+ size: textConf.size,
320
+ bold: textConf.bold,
321
+ italic: textConf.italic,
322
+ font: textConf.font,
323
+ color: textConf.color,
324
+
325
+ halign: 'left',
326
+ valign: 'bottom',
327
+
328
+ text: key[i],
329
+
330
+ x: x + blobSize + 5 + properties.keyLabelsOffsetx + properties.keyOffsetx,
331
+ y: y + properties.keyLabelsOffsety + properties.keyOffsety,
332
+
333
+ background: properties.keyLabelsBackground || 'white',
334
+ padding: 0
335
+ })
336
+
337
+ x += 10 + blobSize + 5 + textDimensions[0];
338
+ }
339
+ }
340
+ };
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+ //
350
+ // Create a TABLE based HTML key. There's lots of options so it's
351
+ // suggested that you consult the documentation page
352
+ //
353
+ // @param mixed id This should be a string consisting of the ID of the container
354
+ // @param object prop An object map of the various properties that you can use to
355
+ // configure the key. See the documentation page for a list.
356
+ //
357
+ RGraph.SVG.HTML.key = function (id, properties)
358
+ {
359
+ var div = doc.getElementById(id);
360
+
361
+
362
+ //
363
+ // Create the table that becomes the key
364
+ //
365
+ var str = '<table border="0" cellspacing="0" cellpadding="0" id="rgraph_key" ' + (properties.tableClass ? 'class="' + properties.tableClass + '"' : '') + '>';
366
+
367
+
368
+
369
+ //
370
+ // Add the individual key elements
371
+ //
372
+ for (var i=0; i<properties.labels.length; i+=1) {
373
+ str += '<tr><td><div id="rgraph_html_key_blob_' + i + '" ' + (properties.blobClass ? 'class="rgraph_html_key_blob ' + (properties.blobClass || '') + ' rgraph_html_key_blob"' : '') + '>&nbsp;</div><td>' + (properties.links && properties.links[i] ? '<a href="' + properties.links[i] + '">' : '') + '<span ' + (properties.labelClass ? 'class="' + properties.labelClass + '"' : '') + '" id="rgraph_html_key_label_' + i + '" >' + properties.labels[i] + '</span>' + (properties.links && properties.links[i] ? '</a>' : '') + '</td></tr>';
374
+ }
375
+
376
+ div.innerHTML += (str + '</table>');
377
+
378
+ for (var i=0; i<properties.labels.length; i+=1) {
379
+ var n = document.getElementById('rgraph_html_key_blob_' + i);
380
+ n.style.width = '20px';
381
+ n.style.height = '20px';
382
+ }
383
+
384
+
385
+
386
+
387
+
388
+
389
+ // Set CSS for the whole table that has been specified
390
+ RGraph.SVG.setCSS(doc.getElementById('rgraph_key'),
391
+ {
392
+ display: 'inline',
393
+ ...properties.tableCss
394
+ });
395
+
396
+
397
+
398
+
399
+ // Apply CSS styles to each key element
400
+
401
+ // Apply styles to the color blob
402
+ for (var i=0; i<properties.labels.length; i+=1) {
403
+ RGraph.SVG.setCSS('rgraph_html_key_blob_' + i,
404
+ {
405
+ display: 'inline-block',
406
+ marginRight: '5px',
407
+ marginTop: '4px',
408
+ width: '15px',
409
+ height: '15px',
410
+ backgroundColor: properties.colors[i],
411
+ ...properties.blobCss
412
+ });
413
+
414
+
415
+
416
+
417
+ // Set cSS on the key labels
418
+ RGraph.SVG.setCSS('rgraph_html_key_label_' + i, properties.labelCss);
419
+
420
+
421
+
422
+
423
+ // Set cSS on individual key labels
424
+ RGraph.SVG.setCSS('rgraph_html_key_label_' + i, properties['labelCss_' + i]);
425
+ }
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+ // Return the TABLE object that is the HTML key
445
+ return doc.getElementById('rgraph_key');
446
+ };
447
+
448
+
449
+
450
+
451
+ // End module pattern
452
+ })(window, document);