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
@@ -0,0 +1,382 @@
|
|
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
|
11
|
+
|
12
|
+
//
|
13
|
+
// Initialise the various objects
|
14
|
+
//
|
15
|
+
RGraph = window.RGraph || {isrgraph:true,isRGraph: true,rgraph:true};
|
16
|
+
|
17
|
+
//
|
18
|
+
// The constructor
|
19
|
+
//
|
20
|
+
RGraph.starburst =
|
21
|
+
RGraph.Starburst =
|
22
|
+
RGraph.StarBurst = function (conf)
|
23
|
+
{
|
24
|
+
var id = conf.id,
|
25
|
+
canvas = document.getElementById(id);
|
26
|
+
|
27
|
+
// Get the canvas and context objects
|
28
|
+
this.id = id;
|
29
|
+
this.canvas = canvas;
|
30
|
+
this.context = this.canvas.getContext('2d');
|
31
|
+
this.type = 'starburst';
|
32
|
+
this.imageCache = [];
|
33
|
+
this.frame = 1;
|
34
|
+
this.rotatedAngle = (0 - (Math.PI / 2));
|
35
|
+
this.isRGraph = true;
|
36
|
+
this.isrgraph = true;
|
37
|
+
this.rgraph = true;
|
38
|
+
|
39
|
+
this.properties =
|
40
|
+
{
|
41
|
+
colors: ['white','#666'],
|
42
|
+
|
43
|
+
radius: 500,
|
44
|
+
delay: null,
|
45
|
+
segments: 12,
|
46
|
+
centerx: null,
|
47
|
+
centery: null,
|
48
|
+
|
49
|
+
callback: null,
|
50
|
+
|
51
|
+
animationStep: 0.0005,
|
52
|
+
|
53
|
+
radiusMultiplier: 0,
|
54
|
+
radiusIncrement: 0.01,
|
55
|
+
|
56
|
+
image: null,
|
57
|
+
imageHalign: 'center',
|
58
|
+
imageValign: 'center',
|
59
|
+
imageScale: 1,
|
60
|
+
imageX: null,
|
61
|
+
imageY: null,
|
62
|
+
imageW: null,
|
63
|
+
imageH: null,
|
64
|
+
imageShadow: false,
|
65
|
+
imageShadowOffsetx: 3,
|
66
|
+
imageShadowOffsety: 3,
|
67
|
+
imageShadowColor: '#666',
|
68
|
+
imageShadowBlur: 3,
|
69
|
+
};
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
var prop = this.properties;
|
74
|
+
var properties = this.properties;
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
//
|
84
|
+
// A setter
|
85
|
+
//
|
86
|
+
// @param name string The name of the property to set
|
87
|
+
// @param value mixed The value of the property
|
88
|
+
//
|
89
|
+
this.set = function (name)
|
90
|
+
{
|
91
|
+
var value = typeof arguments[1] === 'undefined' ? null : arguments[1];
|
92
|
+
|
93
|
+
// the number of arguments is only one and it's an
|
94
|
+
// object - parse it for configuration data and return.
|
95
|
+
if (arguments.length === 1 && typeof arguments[0] === 'object') {
|
96
|
+
for (i in arguments[0]) {
|
97
|
+
if (typeof i === 'string') {
|
98
|
+
this.set(i, arguments[0][i]);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
return this;
|
103
|
+
}
|
104
|
+
|
105
|
+
properties[name] = value;
|
106
|
+
|
107
|
+
return this;
|
108
|
+
};
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
// Returns the requested property
|
118
|
+
this.get = function (name)
|
119
|
+
{
|
120
|
+
return properties[name];
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
//
|
131
|
+
// The main draw function that gets everything going
|
132
|
+
//
|
133
|
+
this.draw = function ()
|
134
|
+
{
|
135
|
+
// Determine the starting angle
|
136
|
+
var start = (0 - (Math.PI / 2)) + ((properties.frame / (180 / Math.PI) / 10));
|
137
|
+
|
138
|
+
if (this.isNull(properties.centerx)) properties.centerx = canvas.width / 2;
|
139
|
+
if (this.isNull(properties.centery)) properties.centery = canvas.height / 2;
|
140
|
+
|
141
|
+
// Start by clearing the canvas
|
142
|
+
this.context.clearRect(-5,-5, this.canvas.width + 10, this.canvas.height + 10);
|
143
|
+
|
144
|
+
|
145
|
+
var grad = this.context.createRadialGradient(properties.centerx, properties.centery, 0, properties.centerx, properties.centery, properties.radius);
|
146
|
+
grad.addColorStop(0,properties.colors[0]);
|
147
|
+
|
148
|
+
for (var i=1,len=properties.colors.length; i<len; ++i) {
|
149
|
+
grad.addColorStop((1 / (len - 1)) * i, properties.colors[i]);
|
150
|
+
}
|
151
|
+
|
152
|
+
|
153
|
+
// The main loop that does the drawing
|
154
|
+
for (var i=0; i<(properties.segments * 2); ++i) {
|
155
|
+
|
156
|
+
this.startAngle = this.rotatedAngle + (((360 / (properties.segments * 2)) * i) / (180 / Math.PI) );
|
157
|
+
this.endAngle = this.startAngle + (((360 / (properties.segments * 2))) / (180 / Math.PI) ),
|
158
|
+
color = (i % 2 === 0 ? grad : 'rgba(0,0,0,0)');
|
159
|
+
this.startAngle += this.frame * properties.animationStep;
|
160
|
+
this.endAngle += this.frame * properties.animationStep;
|
161
|
+
|
162
|
+
// This draws an arm of the StarBurst
|
163
|
+
this.context.beginPath();
|
164
|
+
this.context.fillStyle = color;
|
165
|
+
this.context.moveTo(properties.centerx, properties.centery);
|
166
|
+
this.context.arc(
|
167
|
+
properties.centerx,
|
168
|
+
properties.centery,
|
169
|
+
properties.radius * (properties.animationStep === 0 ? 1 : properties.radiusMultiplier),
|
170
|
+
this.startAngle,
|
171
|
+
this.endAngle,
|
172
|
+
false
|
173
|
+
);
|
174
|
+
this.context.fill();
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
//
|
185
|
+
// Draw an image if one is specified
|
186
|
+
//
|
187
|
+
if (properties.image) {
|
188
|
+
|
189
|
+
//
|
190
|
+
// If there was an image specified then load it if it isn't
|
191
|
+
// cached and then draw it on the canvas
|
192
|
+
//
|
193
|
+
if (properties.image && !this.imageCache[properties.image]) {
|
194
|
+
this.imageCache[properties.image] = new Image();
|
195
|
+
this.imageCache[properties.image].src = properties.image;
|
196
|
+
|
197
|
+
var obj = this;
|
198
|
+
this.imageCache[properties.image].onload = function ()
|
199
|
+
{
|
200
|
+
obj.draw();
|
201
|
+
};
|
202
|
+
return;
|
203
|
+
}
|
204
|
+
|
205
|
+
var frameMultiplier = Math.min(1, properties.frame);
|
206
|
+
|
207
|
+
// Work out the image coordinates
|
208
|
+
if (!this.imageCoordsCalculated) {
|
209
|
+
|
210
|
+
//
|
211
|
+
// Centered alignment
|
212
|
+
//
|
213
|
+
var imageX = properties.centerx,
|
214
|
+
imageY = properties.centery,
|
215
|
+
imageW = this.imageCache[properties.image].width * properties.imageScale,
|
216
|
+
imageH = this.imageCache[properties.image].height * properties.imageScale;
|
217
|
+
|
218
|
+
// Custom coords given
|
219
|
+
if (typeof properties.imageX === 'number') imageX = properties.imageX;
|
220
|
+
if (typeof properties.imageY === 'number') imageY = properties.imageY;
|
221
|
+
if (typeof properties.imageW === 'number') imageW = properties.imageW;
|
222
|
+
if (typeof properties.imageH === 'number') imageH = properties.imageH;
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
if (properties.imageHalign === 'right') {
|
227
|
+
imageX = imageX - imageW;
|
228
|
+
} else if (properties.imageHalign === 'left') {
|
229
|
+
imageX = imageX;
|
230
|
+
} else {
|
231
|
+
imageX = imageX - (imageW / 2);
|
232
|
+
}
|
233
|
+
|
234
|
+
// Handle valign being top or bottom
|
235
|
+
if (properties.imageValign === 'bottom') {
|
236
|
+
imageY = imageY - imageH;
|
237
|
+
} else if (properties.imageValign === 'top') {
|
238
|
+
imageY = imageY;
|
239
|
+
} else {
|
240
|
+
imageY = imageY - (imageH / 2);
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
properties.imageX = imageX;
|
245
|
+
properties.imageY = imageY;
|
246
|
+
properties.imageW = imageW;
|
247
|
+
properties.imageH = imageH;
|
248
|
+
|
249
|
+
// Don't do this again
|
250
|
+
this.imageCoordsCalculated = true;
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
// Add shadow if necessary
|
257
|
+
if (properties.imageShadow) {
|
258
|
+
this.context.shadowOffsetX = properties.imageShadowOffsetx;
|
259
|
+
this.context.shadowOffsetY = properties.imageShadowOffsety;
|
260
|
+
this.context.shadowColor = properties.imageShadowColor;
|
261
|
+
this.context.shadowBlur = properties.imageShadowBlur;
|
262
|
+
}
|
263
|
+
|
264
|
+
|
265
|
+
// Call the canvas API drawImage function
|
266
|
+
this.context.drawImage(
|
267
|
+
this.imageCache[properties.image],
|
268
|
+
properties.imageX,
|
269
|
+
properties.imageY,
|
270
|
+
properties.imageW,
|
271
|
+
properties.imageH
|
272
|
+
);
|
273
|
+
|
274
|
+
// If the shadow is enabled turn it off
|
275
|
+
if (properties.imageShadow) {
|
276
|
+
this.context.shadowOffsetX = 0;
|
277
|
+
this.context.shadowOffsetY = 0;
|
278
|
+
this.context.shadowColor = 'rgba(0,0,0,0)';
|
279
|
+
this.context.shadowBlur = 0;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
// Call the user defined function that was passed into the
|
294
|
+
// function. The callback.
|
295
|
+
if (typeof properties.callback === 'function') {
|
296
|
+
var callbackReturn = properties.callback(this);
|
297
|
+
}
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
// Increment the frame counter
|
311
|
+
this.frame = ++this.frame;
|
312
|
+
|
313
|
+
// Update the radiusMultiplier
|
314
|
+
if (properties.radiusMultiplier < 1) {
|
315
|
+
properties.radiusMultiplier += properties.radiusIncrement;
|
316
|
+
}
|
317
|
+
|
318
|
+
// Call the StarBurst() function again after a small delay
|
319
|
+
if (callbackReturn !== false && properties.animationStep !== 0) {
|
320
|
+
|
321
|
+
var obj = this;
|
322
|
+
|
323
|
+
if (window.requestAnimationFrame && this.isNull(properties.delay)) {
|
324
|
+
window.requestAnimationFrame(function ()
|
325
|
+
{
|
326
|
+
obj.draw();
|
327
|
+
})
|
328
|
+
} else {
|
329
|
+
|
330
|
+
setTimeout(function ()
|
331
|
+
{
|
332
|
+
obj.draw();
|
333
|
+
}, properties.delay);
|
334
|
+
} // end if
|
335
|
+
} // end if
|
336
|
+
|
337
|
+
// Facilitate chaining
|
338
|
+
return this;
|
339
|
+
|
340
|
+
} // end draw function
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
//
|
350
|
+
// Returns true/false as to whether the given variable is null or not
|
351
|
+
//
|
352
|
+
// @param mixed arg The argument to check
|
353
|
+
//
|
354
|
+
this.isNull = function (arg)
|
355
|
+
{
|
356
|
+
// MUST BE DOUBLE EQUALS FOR THE FIRST TEST - NOT TRIPLE
|
357
|
+
if (arg == null || typeof arg === 'object' && !arg) {
|
358
|
+
return true;
|
359
|
+
}
|
360
|
+
|
361
|
+
return false;
|
362
|
+
}; // End RGraph.isNull function
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
// Set the configuration properties
|
373
|
+
for (var i in conf.options) {
|
374
|
+
if (typeof i === 'string') {
|
375
|
+
this.set(i, conf.options[i]);
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
// This facilitates chaining
|
380
|
+
return this;
|
381
|
+
|
382
|
+
}; // end RGraph.StarBurst function
|