rgraph-rails 5.00 → 6.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/publish-geml.yaml +46 -0
- data/.gitignore +1 -0
- data/README.md +4 -5
- data/lib/rgraph-rails/version.rb +1 -1
- data/rgraph-rails.gemspec +4 -4
- data/vendor/assets/javascripts/RGraph.activity.js +1691 -0
- data/vendor/assets/javascripts/RGraph.bar.js +4253 -236
- data/vendor/assets/javascripts/RGraph.bipolar.js +3958 -162
- data/vendor/assets/javascripts/RGraph.common.annotate.js +414 -35
- data/vendor/assets/javascripts/RGraph.common.context.js +635 -30
- data/vendor/assets/javascripts/RGraph.common.core.js +10485 -419
- data/vendor/assets/javascripts/RGraph.common.csv.js +508 -27
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +1693 -90
- data/vendor/assets/javascripts/RGraph.common.effects.js +1629 -89
- data/vendor/assets/javascripts/RGraph.common.key.js +1003 -53
- data/vendor/assets/javascripts/RGraph.common.moment.js +5670 -0
- data/vendor/assets/javascripts/RGraph.common.sheets.js +541 -31
- data/vendor/assets/javascripts/RGraph.common.sheets.php +351 -0
- data/vendor/assets/javascripts/RGraph.common.starburst.js +382 -0
- data/vendor/assets/javascripts/RGraph.common.table.js +386 -0
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +1433 -32
- data/vendor/assets/javascripts/RGraph.drawing.background.js +660 -35
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +618 -34
- data/vendor/assets/javascripts/RGraph.drawing.image.js +857 -52
- data/vendor/assets/javascripts/RGraph.drawing.line.js +712 -0
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +760 -38
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +740 -37
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +573 -36
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +667 -36
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +638 -34
- data/vendor/assets/javascripts/RGraph.drawing.text.js +672 -37
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +653 -52
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +714 -51
- data/vendor/assets/javascripts/RGraph.fuel.js +1149 -59
- data/vendor/assets/javascripts/RGraph.funnel.js +1277 -56
- data/vendor/assets/javascripts/RGraph.gantt.js +1646 -82
- data/vendor/assets/javascripts/RGraph.gauge.js +1773 -89
- data/vendor/assets/javascripts/RGraph.hbar.js +3869 -159
- data/vendor/assets/javascripts/RGraph.horseshoe.js +970 -0
- data/vendor/assets/javascripts/RGraph.hprogress.js +1829 -81
- data/vendor/assets/javascripts/RGraph.line.js +5293 -244
- data/vendor/assets/javascripts/RGraph.meter.js +1570 -77
- data/vendor/assets/javascripts/RGraph.modaldialog.js +300 -19
- data/vendor/assets/javascripts/RGraph.odo.js +1553 -68
- data/vendor/assets/javascripts/RGraph.pie.js +3273 -129
- data/vendor/assets/javascripts/RGraph.radar.js +2333 -108
- data/vendor/assets/javascripts/RGraph.rose.js +2685 -114
- data/vendor/assets/javascripts/RGraph.rscatter.js +1920 -80
- data/vendor/assets/javascripts/RGraph.scatter.js +4215 -171
- data/vendor/assets/javascripts/RGraph.segmented.js +1006 -0
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1980 -59
- data/vendor/assets/javascripts/RGraph.svg.activity.js +1696 -0
- data/vendor/assets/javascripts/RGraph.svg.bar.js +2575 -77
- data/vendor/assets/javascripts/RGraph.svg.bipolar.js +3533 -106
- data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +240 -21
- data/vendor/assets/javascripts/RGraph.svg.common.core.js +7105 -299
- data/vendor/assets/javascripts/RGraph.svg.common.csv.js +408 -28
- data/vendor/assets/javascripts/RGraph.svg.common.fx.js +1291 -68
- data/vendor/assets/javascripts/RGraph.svg.common.key.js +451 -20
- data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +543 -31
- data/vendor/assets/javascripts/RGraph.svg.common.table.js +391 -0
- data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +1072 -23
- data/vendor/assets/javascripts/RGraph.svg.funnel.js +1151 -32
- data/vendor/assets/javascripts/RGraph.svg.gauge.js +1429 -34
- data/vendor/assets/javascripts/RGraph.svg.hbar.js +2692 -65
- data/vendor/assets/javascripts/RGraph.svg.horseshoe.js +969 -0
- data/vendor/assets/javascripts/RGraph.svg.line.js +2855 -86
- data/vendor/assets/javascripts/RGraph.svg.pie.js +1630 -58
- data/vendor/assets/javascripts/RGraph.svg.radar.js +1772 -58
- data/vendor/assets/javascripts/RGraph.svg.rose.js +2419 -83
- data/vendor/assets/javascripts/RGraph.svg.scatter.js +2280 -65
- data/vendor/assets/javascripts/RGraph.svg.segmented.js +930 -0
- data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +1612 -29
- data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1525 -50
- data/vendor/assets/javascripts/RGraph.thermometer.js +1411 -64
- data/vendor/assets/javascripts/RGraph.vprogress.js +1915 -81
- data/vendor/assets/javascripts/RGraph.waterfall.js +1896 -89
- data/vendor/assets/javascripts/financial-data.js +1067 -0
- metadata +37 -16
- data/.travis.yml +0 -11
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +0 -35
- data/vendor/assets/javascripts/RGraph.common.resizing.js +0 -38
- data/vendor/assets/javascripts/RGraph.common.zoom.js +0 -15
- data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
@@ -1,29 +1,409 @@
|
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
12
|
+
//
|
13
|
+
// Initialise the various objects
|
14
|
+
//
|
15
|
+
RGraph = window.RGraph || {isrgraph:true,isRGraph:true,rgraph:true};
|
16
|
+
RGraph.SVG = RGraph.SVG || {};
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
//
|
26
|
+
// This function has been taken out of the RGraph.svg.common.ajax.js file to
|
27
|
+
// enable the CSV reader to work standalone.
|
28
|
+
//
|
29
|
+
if (!RGraph.SVG.AJAX) RGraph.SVG.AJAX = function (url, callback)
|
30
|
+
{
|
31
|
+
// Mozilla, Safari, ...
|
32
|
+
if (window.XMLHttpRequest) {
|
33
|
+
var httpRequest = new XMLHttpRequest();
|
34
|
+
|
35
|
+
// MSIE
|
36
|
+
} else if (window.ActiveXObject) {
|
37
|
+
var httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
|
38
|
+
}
|
39
|
+
|
40
|
+
httpRequest.onreadystatechange = function ()
|
41
|
+
{
|
42
|
+
if (this.readyState == 4 && this.status == 200) {
|
43
|
+
this.__user_callback__ = callback;
|
44
|
+
|
45
|
+
this.__user_callback__(this.responseText);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
httpRequest.open('GET', url, true);
|
50
|
+
httpRequest.send();
|
51
|
+
};
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
//
|
61
|
+
// Use the AJAX function above to fetch a string
|
62
|
+
//
|
63
|
+
if (!RGraph.SVG.getString) RGraph.SVG.AJAX.getString = function (url, callback)
|
64
|
+
{
|
65
|
+
RGraph.SVG.AJAX(url, function ()
|
66
|
+
{
|
67
|
+
var str = String(this.responseText);
|
68
|
+
|
69
|
+
callback(str);
|
70
|
+
});
|
71
|
+
};
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
// This function simply creates UID. Formerly the function in
|
81
|
+
// RGraph.common.core.js was being used - but now the CSV code
|
82
|
+
// is now standalone, hence this function
|
83
|
+
if (!RGraph.SVG.createUID) RGraph.SVG.createUID = function ()
|
84
|
+
{
|
85
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c)
|
86
|
+
{
|
87
|
+
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
88
|
+
return v.toString(16);
|
89
|
+
});
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
RGraph.SVG.CSV =
|
100
|
+
RGraph.CSV = function (url, func)
|
101
|
+
{
|
102
|
+
//
|
103
|
+
// Some default values
|
104
|
+
//
|
105
|
+
this.url = url;
|
106
|
+
this.ready = func;
|
107
|
+
this.data = null;
|
108
|
+
this.numrows = null;
|
109
|
+
this.numcols = null;
|
110
|
+
this.seperator = arguments[2] || ',';
|
111
|
+
this.endofline = arguments[3] || /\r?\n/;
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
//
|
117
|
+
// A Custom split function
|
118
|
+
//
|
119
|
+
// @param string str The CSV string to split
|
120
|
+
// @param mixed char The character to split on - or it can also be an object like this:
|
121
|
+
// {
|
122
|
+
// preserve: false, // Whether to preserve whitespace
|
123
|
+
// char: ',' // The character to split on
|
124
|
+
// }
|
125
|
+
//
|
126
|
+
this.splitCSV = function (str, split)
|
127
|
+
{
|
128
|
+
// Defaults
|
129
|
+
var arr = [];
|
130
|
+
var field = '';
|
131
|
+
var inDoubleQuotes = false;
|
132
|
+
var inSingleQuotes = false;
|
133
|
+
var preserve = (typeof split === 'object' && split.preserve) ? true : false;
|
134
|
+
|
135
|
+
// The character to split the CSV string on
|
136
|
+
if (typeof split === 'object') {
|
137
|
+
if (typeof split.char === 'string') {
|
138
|
+
split = split.char;
|
139
|
+
} else {
|
140
|
+
split = ',';
|
141
|
+
}
|
142
|
+
} // If not an object just leave the char as it's supplied
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
for (var i=0,len=str.length; i<len; i+=1) {
|
147
|
+
|
148
|
+
char = str.charAt(i);
|
149
|
+
|
150
|
+
if ( (char === '"') && !inDoubleQuotes) {
|
151
|
+
inDoubleQuotes = true;
|
152
|
+
continue;
|
153
|
+
|
154
|
+
} else if ( (char === '"') && inDoubleQuotes) {
|
155
|
+
inDoubleQuotes = false;
|
156
|
+
continue;
|
157
|
+
}
|
158
|
+
if ( (char === "'") && !inSingleQuotes) {
|
159
|
+
inSingleQuotes = true;
|
160
|
+
continue;
|
161
|
+
|
162
|
+
} else if ( (char === "'") && inSingleQuotes) {
|
163
|
+
inSingleQuotes = false;
|
164
|
+
continue;
|
165
|
+
|
166
|
+
} else if (char === split && !inDoubleQuotes && !inSingleQuotes) {
|
167
|
+
// TODO look ahead in order to allow for multi-character seperators
|
168
|
+
arr.push(field);
|
169
|
+
field = '';
|
170
|
+
continue;
|
171
|
+
|
172
|
+
} else {
|
173
|
+
field = field + char;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
// Add the last field
|
178
|
+
arr.push(field);
|
179
|
+
|
180
|
+
// Now trim each value if necessary
|
181
|
+
if (!preserve) {
|
182
|
+
for (i=0,len=arr.length; i<len; i+=1) {
|
183
|
+
arr[i] = arr[i].trim();
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
return arr;
|
188
|
+
};
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
//
|
194
|
+
// This function splits the CSV data into an array so that it can be useful.
|
195
|
+
//
|
196
|
+
this.fetch = function ()
|
197
|
+
{
|
198
|
+
var sep = this.seperator,
|
199
|
+
eol = this.endofline,
|
200
|
+
obj = this;
|
201
|
+
|
202
|
+
if (this.url.substring(0,3) === 'id:' || this.url.substring(0,4) === 'str:') {
|
203
|
+
|
204
|
+
// Get rid of any surrounding whitespace
|
205
|
+
if (this.url.substring(0,3) === 'id:') {
|
206
|
+
var data = document.getElementById(this.url.substring(3)).innerHTML.trim();
|
207
|
+
|
208
|
+
} else if (this.url.substring(0,4) === 'str:') {
|
209
|
+
var data = this.url.substring(4).trim();
|
210
|
+
}
|
211
|
+
|
212
|
+
// Store the CSV data on the CSV object (ie - this object)
|
213
|
+
obj.data = data.split(eol);
|
214
|
+
|
215
|
+
// Store the number of rows
|
216
|
+
obj.numrows = obj.data.length;
|
217
|
+
|
218
|
+
for (var i=0,len=obj.data.length; i<len; i+=1) {
|
219
|
+
|
220
|
+
|
221
|
+
//
|
222
|
+
// Split the individual line
|
223
|
+
//
|
224
|
+
//var row = obj.data[i].split(sep);
|
225
|
+
var row = obj.splitCSV(obj.data[i], {preserve: false, char: sep});
|
226
|
+
|
227
|
+
|
228
|
+
if (!obj.numcols) {
|
229
|
+
obj.numcols = row.length;
|
230
|
+
}
|
231
|
+
|
232
|
+
//
|
233
|
+
// If the cell is purely made up of numbers - convert it
|
234
|
+
//
|
235
|
+
for (var j=0; j<row.length; j+=1) {
|
236
|
+
if ((/^\-?[0-9.]+$/).test(row[j])) {
|
237
|
+
row[j] = parseFloat(row[j]);
|
238
|
+
}
|
239
|
+
|
240
|
+
// Assign the split-up-row back to the data array
|
241
|
+
obj.data[i] = row;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
// Call the ready function straight away
|
246
|
+
obj.ready(obj);
|
247
|
+
|
248
|
+
} else {
|
249
|
+
|
250
|
+
RGraph.SVG.AJAX.getString(this.url, function (data)
|
251
|
+
{
|
252
|
+
data = data.replace(/(\r?\n)+$/, '');
|
253
|
+
|
254
|
+
//
|
255
|
+
// Split the lines in the CSV
|
256
|
+
//
|
257
|
+
obj.data = data.split(eol);
|
258
|
+
|
259
|
+
//
|
260
|
+
// Store the number of rows
|
261
|
+
//
|
262
|
+
obj.numrows = obj.data.length;
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
//
|
267
|
+
// Loop thru each lines in the CSV file
|
268
|
+
//
|
269
|
+
for (var i=0,len=obj.data.length; i<len; i+=1) {
|
270
|
+
//
|
271
|
+
// Use the new split function to split each row NOT preserving whitespace
|
272
|
+
//
|
273
|
+
//var row = obj.data[i].split(sep);
|
274
|
+
var row = obj.splitCSV(obj.data[i], {preserve: false, char: sep});
|
275
|
+
|
276
|
+
if (!obj.numcols) {
|
277
|
+
obj.numcols = row.length;
|
278
|
+
}
|
279
|
+
|
280
|
+
//
|
281
|
+
// If the cell is purely made up of numbers - convert it
|
282
|
+
//
|
283
|
+
for (var j=0; j<row.length; j+=1) {
|
284
|
+
if ((/^\-?[0-9.]+$/).test(row[j])) {
|
285
|
+
row[j] = parseFloat(row[j]);
|
286
|
+
}
|
287
|
+
|
288
|
+
// Assign the split-up-row back to the data array
|
289
|
+
obj.data[i] = row;
|
290
|
+
}
|
291
|
+
|
292
|
+
}
|
293
|
+
|
294
|
+
// Call the ready function straight away
|
295
|
+
obj.ready(obj);
|
296
|
+
});
|
297
|
+
}
|
298
|
+
};
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
//
|
308
|
+
// Returns a row of the CSV file
|
309
|
+
//
|
310
|
+
// @param number index The index of the row to fetch
|
311
|
+
// @param start OPTIONAL If desired you can specify a column to
|
312
|
+
// start at (which starts at 0 by default)
|
313
|
+
//
|
314
|
+
this.row =
|
315
|
+
this.getRow = function (index)
|
316
|
+
{
|
317
|
+
var row = [],
|
318
|
+
start = parseInt(arguments[1]) || 0,
|
319
|
+
length = arguments[2];
|
320
|
+
|
321
|
+
if (start < 0) {
|
322
|
+
row = this.data[index].slice(this.data[index].length - Math.abs(start));
|
323
|
+
} else {
|
324
|
+
row = this.data[index].slice(start);
|
325
|
+
}
|
326
|
+
|
327
|
+
// Zero length
|
328
|
+
if (typeof length === 'number' && length === 0) {
|
329
|
+
row = [];
|
330
|
+
|
331
|
+
} else {
|
332
|
+
// Positive length
|
333
|
+
if (typeof length === 'number' && length > 0) {
|
334
|
+
row = row.slice(0, length)
|
335
|
+
|
336
|
+
// Negative length
|
337
|
+
} else if (typeof length === 'number' && length < 0) {
|
338
|
+
for (var i=0; i<Math.abs(length); ++i) {
|
339
|
+
row.pop();
|
340
|
+
}
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
return row;
|
347
|
+
};
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
//
|
353
|
+
// This fuunction allows you to fetch a column
|
354
|
+
// of the HTML table data.
|
355
|
+
//
|
356
|
+
this.col =
|
357
|
+
this.column =
|
358
|
+
this.getColumn =
|
359
|
+
this.getCol = function (index)
|
360
|
+
{
|
361
|
+
var col = [],
|
362
|
+
start = arguments[1] || 0,
|
363
|
+
length = arguments[2];
|
364
|
+
|
365
|
+
if (start >= 0) {
|
366
|
+
for (var i=start; i<this.data.length; i+=1) {
|
367
|
+
if (this.data[i]) {
|
368
|
+
col.push(this.data[i][index]);
|
369
|
+
} else {
|
370
|
+
col.push(null);
|
371
|
+
}
|
372
|
+
}
|
373
|
+
} else {
|
374
|
+
for (var i=(this.data.length - Math.abs(start)); i<this.data.length; i+=1) {
|
375
|
+
if (this.data[i]) {
|
376
|
+
col.push(this.data[i][index]);
|
377
|
+
} else {
|
378
|
+
col.push(null);
|
379
|
+
}
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
// Zero length
|
384
|
+
if (typeof length === 'number' && length === 0) {
|
385
|
+
col = [];
|
386
|
+
|
387
|
+
} else {
|
388
|
+
// Positive length
|
389
|
+
if (typeof length === 'number' && length > 0) {
|
390
|
+
col = col.slice(0, length)
|
391
|
+
|
392
|
+
// Negative length
|
393
|
+
} else if (typeof length === 'number' && length < 0) {
|
394
|
+
for (var i=0; i<Math.abs(length); ++i) {
|
395
|
+
col.pop();
|
396
|
+
}
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
return col;
|
401
|
+
};
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
// Fetch the CSV file
|
408
|
+
this.fetch();
|
409
|
+
};
|