rgraph-rails 1.0.4 → 1.0.5
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.
- checksums.yaml +8 -8
- data/.travis.yml +1 -0
- data/README.md +2 -2
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/images/bullet.png +0 -0
- data/vendor/assets/images/facebook-large.png +0 -0
- data/vendor/assets/images/google-plus-large.png +0 -0
- data/vendor/assets/images/logo.png +0 -0
- data/vendor/assets/images/rgraph.jpg +0 -0
- data/vendor/assets/javascripts/RGraph.bar.js +533 -242
- data/vendor/assets/javascripts/RGraph.bipolar.js +152 -169
- data/vendor/assets/javascripts/RGraph.common.annotate.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.context.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.core.js +688 -373
- data/vendor/assets/javascripts/RGraph.common.csv.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +188 -193
- data/vendor/assets/javascripts/RGraph.common.effects.js +62 -38
- data/vendor/assets/javascripts/RGraph.common.key.js +35 -15
- data/vendor/assets/javascripts/RGraph.common.resizing.js +38 -21
- data/vendor/assets/javascripts/RGraph.common.sheets.js +2 -2
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +48 -40
- data/vendor/assets/javascripts/RGraph.common.zoom.js +2 -2
- data/vendor/assets/javascripts/RGraph.drawing.background.js +33 -49
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +27 -30
- data/vendor/assets/javascripts/RGraph.drawing.image.js +23 -26
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +47 -40
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +38 -42
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +24 -28
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +25 -39
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +27 -32
- data/vendor/assets/javascripts/RGraph.drawing.text.js +53 -58
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +24 -29
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +45 -51
- data/vendor/assets/javascripts/RGraph.fuel.js +11 -9
- data/vendor/assets/javascripts/RGraph.funnel.js +40 -43
- data/vendor/assets/javascripts/RGraph.gantt.js +34 -34
- data/vendor/assets/javascripts/RGraph.gauge.js +64 -55
- data/vendor/assets/javascripts/RGraph.hbar.js +194 -137
- data/vendor/assets/javascripts/RGraph.hprogress.js +261 -167
- data/vendor/assets/javascripts/RGraph.line.js +520 -512
- data/vendor/assets/javascripts/RGraph.meter.js +11 -10
- data/vendor/assets/javascripts/RGraph.modaldialog.js +11 -2
- data/vendor/assets/javascripts/RGraph.odo.js +11 -9
- data/vendor/assets/javascripts/RGraph.pie.js +385 -100
- data/vendor/assets/javascripts/RGraph.radar.js +36 -29
- data/vendor/assets/javascripts/RGraph.rose.js +58 -41
- data/vendor/assets/javascripts/RGraph.rscatter.js +40 -36
- data/vendor/assets/javascripts/RGraph.scatter.js +441 -499
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1015 -0
- data/vendor/assets/javascripts/RGraph.thermometer.js +37 -37
- data/vendor/assets/javascripts/RGraph.vprogress.js +285 -157
- data/vendor/assets/javascripts/RGraph.waterfall.js +62 -62
- data/vendor/assets/stylesheets/website.css +30 -16
- metadata +3 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
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 starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -201,15 +201,15 @@
|
|
201
201
|
{
|
202
202
|
// This function gets added to the chart object - so the this
|
203
203
|
// variable is the chart object
|
204
|
-
var obj = this
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
204
|
+
var obj = this,
|
205
|
+
opt = arguments[0] || {},
|
206
|
+
frames = opt.frames || 30,
|
207
|
+
frame = 0,
|
208
|
+
pc = -20,
|
209
|
+
step = (120 - pc) / frames,
|
210
|
+
canvasXY = RG.getCanvasXY(obj.canvas),
|
211
|
+
color = opt.color || 'white',
|
212
|
+
callback = arguments[1] || function () {};
|
213
213
|
|
214
214
|
|
215
215
|
// Draw the chart
|
@@ -230,8 +230,8 @@
|
|
230
230
|
{
|
231
231
|
if (pc < 120) {
|
232
232
|
$('div#rgraph_fadeslide_cover_' + obj.id).css({
|
233
|
-
|
234
|
-
|
233
|
+
background: 'linear-gradient(135deg, rgba(255,255,255,0) ' + pc + '%, ' + color + ' ' + (pc + 20) + '%)'
|
234
|
+
});
|
235
235
|
pc += step;
|
236
236
|
RG.Effects.updateCanvas(iterator);
|
237
237
|
|
@@ -292,8 +292,8 @@
|
|
292
292
|
RG.Effects.updateCanvas(iterator);
|
293
293
|
|
294
294
|
} else {
|
295
|
-
|
296
|
-
RG.clear(obj.canvas,
|
295
|
+
|
296
|
+
RG.clear(obj.canvas, obj.get('clearto'))
|
297
297
|
|
298
298
|
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
299
299
|
|
@@ -411,9 +411,9 @@
|
|
411
411
|
RG.Effects.updateCanvas(iterator);
|
412
412
|
|
413
413
|
} else {
|
414
|
-
|
414
|
+
|
415
415
|
RG.clear(obj.canvas, color);
|
416
|
-
|
416
|
+
|
417
417
|
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
418
418
|
|
419
419
|
callback(obj);
|
@@ -525,7 +525,7 @@
|
|
525
525
|
} else {
|
526
526
|
|
527
527
|
RG.clear(obj.canvas);
|
528
|
-
|
528
|
+
|
529
529
|
$('div#rgraph_fadeslide_cover_' + obj.id).remove();
|
530
530
|
|
531
531
|
callback(obj);
|
@@ -638,22 +638,31 @@
|
|
638
638
|
obj.canvas.style.top = 0;
|
639
639
|
obj.canvas.style.left = 0;
|
640
640
|
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
641
|
+
if (opt.bounce !== false) {
|
642
|
+
jQuery('#' + obj.id).animate({
|
643
|
+
width: (obj.canvas.width * 1.2) + 'px',
|
644
|
+
height: (obj.canvas.height * 1.2) + 'px',
|
645
|
+
left: (obj.canvas.width * -0.1) + 'px',
|
646
|
+
top: (obj.canvas.height * -0.1) + 'px'
|
647
|
+
}, duration * 0.25, function ()
|
648
|
+
{
|
649
|
+
jQuery('#' + obj.id).animate({
|
650
|
+
opacity: 0,
|
651
|
+
width: 0,
|
652
|
+
height: 0,
|
653
|
+
left: (obj.canvas.width * 0.5) + 'px',
|
654
|
+
top: (obj.canvas.height * 0.5) + 'px'
|
655
|
+
}, duration * 0.75, function () {callback(obj);});
|
656
|
+
});
|
657
|
+
} else {
|
658
|
+
jQuery('#' + obj.id).animate({
|
659
|
+
opacity: 0,
|
660
|
+
width: 0,
|
661
|
+
height: 0,
|
662
|
+
left: (obj.canvas.width * 0.5) + 'px',
|
663
|
+
top: (obj.canvas.height * 0.5) + 'px'
|
664
|
+
}, duration * 0.75, function () {callback(obj);});
|
665
|
+
}
|
657
666
|
|
658
667
|
|
659
668
|
return this;
|
@@ -828,7 +837,6 @@
|
|
828
837
|
|
829
838
|
|
830
839
|
|
831
|
-
|
832
840
|
var divs = [
|
833
841
|
['rgraph_conceal_left_' + obj.id, xy[0], xy[1], 0, obj.canvas.height],
|
834
842
|
['rgraph_conceal_right_' + obj.id,(xy[0] + obj.canvas.width),xy[1],0,obj.canvas.height],
|
@@ -866,7 +874,7 @@
|
|
866
874
|
doc.body.removeChild(doc.getElementById("rgraph_conceal_left_" + obj.id));
|
867
875
|
doc.body.removeChild(doc.getElementById("rgraph_conceal_right_" + obj.id));
|
868
876
|
|
869
|
-
RG.clear(obj.canvas
|
877
|
+
RG.clear(obj.canvas);
|
870
878
|
|
871
879
|
callback(obj);
|
872
880
|
|
@@ -1317,7 +1325,16 @@
|
|
1317
1325
|
}
|
1318
1326
|
}
|
1319
1327
|
|
1320
|
-
setTimeout(function ()
|
1328
|
+
setTimeout(function ()
|
1329
|
+
{
|
1330
|
+
RGraph.clear(obj.canvas);
|
1331
|
+
jQuery('#' + 'rgraph_hscissors_' + 0 + '_' + obj.id).remove();
|
1332
|
+
jQuery('#' + 'rgraph_hscissors_' + 1 + '_' + obj.id).remove();
|
1333
|
+
jQuery('#' + 'rgraph_hscissors_' + 2 + '_' + obj.id).remove();
|
1334
|
+
jQuery('#' + 'rgraph_hscissors_' + 3 + '_' + obj.id).remove();
|
1335
|
+
jQuery('#' + 'rgraph_hscissors_' + 4 + '_' + obj.id).remove();
|
1336
|
+
callback(obj);
|
1337
|
+
}, duration);
|
1321
1338
|
|
1322
1339
|
return this;
|
1323
1340
|
};
|
@@ -1445,7 +1462,14 @@
|
|
1445
1462
|
}
|
1446
1463
|
}
|
1447
1464
|
|
1448
|
-
setTimeout(function ()
|
1465
|
+
setTimeout(function ()
|
1466
|
+
{
|
1467
|
+
RG.clear(obj.canvas);
|
1468
|
+
for (var i=0; i<10; i++) {
|
1469
|
+
jQuery('#rgraph_vscissors_' + i + '_' + obj.id).remove();
|
1470
|
+
}
|
1471
|
+
callback(obj);
|
1472
|
+
}, duration);
|
1449
1473
|
|
1450
1474
|
return this;
|
1451
1475
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
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 starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -298,15 +298,26 @@
|
|
298
298
|
co.beginPath();
|
299
299
|
co.fillStyle = typeof text_color == 'object' ? text_color[i] : text_color;
|
300
300
|
|
301
|
-
ret = RG.Text2(obj, {
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
301
|
+
ret = RG.Text2(obj, {
|
302
|
+
'font': text_font,
|
303
|
+
'size': text_size,
|
304
|
+
'bold': text_bold,
|
305
|
+
'italic': text_italic,
|
306
|
+
'x': hpos + blob_size + 5 + 5,
|
307
|
+
'y': vpos + (5 * j) + (text_size * j) + 3,
|
308
|
+
'text': key[i],
|
309
|
+
'accessible': !obj.properties['chart.key.interactive']
|
310
|
+
});
|
311
|
+
|
312
|
+
obj.coords.key[i] = [
|
313
|
+
ret.x,
|
314
|
+
ret.y,
|
315
|
+
ret.width,
|
316
|
+
ret.height,
|
317
|
+
key[i],
|
318
|
+
colors[i],
|
319
|
+
obj
|
320
|
+
];
|
310
321
|
}
|
311
322
|
co.fill();
|
312
323
|
}
|
@@ -537,12 +548,21 @@
|
|
537
548
|
'italic': text_italic,
|
538
549
|
'x':pos,
|
539
550
|
'y':vpos + text_size + 3,
|
540
|
-
'text': key[i]
|
551
|
+
'text': key[i],
|
552
|
+
accessible: !obj.properties['chart.key.interactive']
|
541
553
|
});
|
542
554
|
co.fill();
|
543
555
|
pos += co.measureText(key[i]).width;
|
544
|
-
|
545
|
-
obj.coords.key[i] = [
|
556
|
+
|
557
|
+
obj.coords.key[i] = [
|
558
|
+
ret.x,
|
559
|
+
ret.y,
|
560
|
+
ret.width,
|
561
|
+
ret.height,
|
562
|
+
key[i],
|
563
|
+
colors[i],
|
564
|
+
obj
|
565
|
+
];
|
546
566
|
}
|
547
567
|
}
|
548
568
|
|
@@ -622,7 +642,7 @@
|
|
622
642
|
|
623
643
|
rect.onmousemove = function (e, shape)
|
624
644
|
{
|
625
|
-
|
645
|
+
return true;
|
626
646
|
}
|
627
647
|
})(i);
|
628
648
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
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 starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -33,9 +33,9 @@
|
|
33
33
|
RGraph.allowResizing =
|
34
34
|
RGraph.AllowResizing = function (obj)
|
35
35
|
{
|
36
|
-
var ca
|
37
|
-
co
|
38
|
-
|
36
|
+
var ca = obj.canvas,
|
37
|
+
co = obj.context,
|
38
|
+
pa2 = RG.path2;
|
39
39
|
|
40
40
|
ca.resizing = ca.resizing || {};
|
41
41
|
ca.resizing.placeHolders = ca.resizing.placeHolders || [];
|
@@ -80,31 +80,42 @@
|
|
80
80
|
|
81
81
|
|
82
82
|
// Draw the resize handle
|
83
|
-
|
83
|
+
pa2(co,
|
84
|
+
'b m % % r % % % % f %',
|
85
|
+
ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX, ca.height - resizeHandleSize,
|
86
|
+
ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX, ca.height - resizeHandleSize + ca.resizing.adjustY, 2 * resizeHandleSize, resizeHandleSize,
|
87
|
+
ca.resizing.bgcolor
|
88
|
+
);
|
84
89
|
|
85
90
|
// Draw the arrows
|
86
|
-
|
91
|
+
pa2(co,
|
92
|
+
'b lw 1 m % % l % % m % % l % % s gray f transparent',
|
93
|
+
ma.round(ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX), ca.height - resizeHandleSize + ca.resizing.adjustY,
|
94
|
+
ma.round(ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX), ca.height + ca.resizing.adjustY,
|
95
|
+
ca.width + ca.resizing.adjustX, ma.round(ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY),
|
96
|
+
ca.width - resizeHandleSize + ca.resizing.adjustX, ma.round(ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY)
|
97
|
+
);
|
87
98
|
|
88
99
|
// Top arrow head
|
89
|
-
|
100
|
+
pa2(co, [ 'b', 'm', ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX, ca.height - resizeHandleSize + ca.resizing.adjustY, 'l',ca.width - (resizeHandleSize / 2) + 3 + ca.resizing.adjustX, ca.height - resizeHandleSize + 3 + ca.resizing.adjustY, 'l',ca.width - (resizeHandleSize / 2) - 3 + ca.resizing.adjustX, ca.height - resizeHandleSize + 3 + ca.resizing.adjustY, 'c', 'f','gray']);
|
90
101
|
|
91
102
|
// Bottom arrow head
|
92
|
-
|
103
|
+
pa2(co, ['b','m', ca.width - (resizeHandleSize / 2) + ca.resizing.adjustX, ca.height + ca.resizing.adjustY,'l', ca.width - (resizeHandleSize / 2) + 3 + ca.resizing.adjustX, ca.height - 3 + ca.resizing.adjustY,'l', ca.width - (resizeHandleSize / 2) - 3 + ca.resizing.adjustX, ca.height - 3 + ca.resizing.adjustY,'c','f', 'gray']);
|
93
104
|
|
94
105
|
// Left arrow head
|
95
|
-
|
106
|
+
pa2(co, ['b','m', ca.width - resizeHandleSize + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'l', ca.width - resizeHandleSize + 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + 3 + ca.resizing.adjustY,'l', ca.width - resizeHandleSize + 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 3 + ca.resizing.adjustY,'c','f', 'gray']);
|
96
107
|
|
97
108
|
// Right arrow head
|
98
|
-
|
109
|
+
pa2(co, ['b','m',ca.width + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'l',ca.width - 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + 3 + ca.resizing.adjustY,'l',ca.width - 3 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 3 + ca.resizing.adjustY,'c','f', 'gray']);
|
99
110
|
|
100
111
|
// Square at the centre of the arrows
|
101
|
-
|
112
|
+
pa2(co, ['b','m',ca.width + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'r',ca.width - (resizeHandleSize / 2) - 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 2 + ca.resizing.adjustY, 4, 4,'r',ca.width - (resizeHandleSize / 2) - 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 2 + ca.resizing.adjustY, 4, 4,'s','gray','f','white']);
|
102
113
|
|
103
114
|
// Draw the "Reset" button
|
104
|
-
|
115
|
+
pa2(co, ['b','m',ma.round(ca.width - resizeHandleSize - 3 + ca.resizing.adjustX), ca.height - resizeHandleSize / 2 + ca.resizing.adjustY,'l',ma.round(ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX), ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'l',ca.width - resizeHandleSize - resizeHandleSize + 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) - 2 + ca.resizing.adjustY,'l',ca.width - resizeHandleSize - resizeHandleSize + 2 + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + 2 + ca.resizing.adjustY,'l',ca.width - resizeHandleSize - resizeHandleSize + ca.resizing.adjustX, ca.height - (resizeHandleSize / 2) + ca.resizing.adjustY,'s','gray','f','gray']);
|
105
116
|
|
106
117
|
// The vertical line at the end of the reset button
|
107
|
-
|
118
|
+
pa2(co, ['b','m', ma.round(ca.width - resizeHandleSize - resizeHandleSize - 1 + ca.resizing.adjustX), ca.height - (resizeHandleSize / 2) - 3 + ca.resizing.adjustY,'l', ma.round(ca.width - resizeHandleSize - resizeHandleSize - 1 + ca.resizing.adjustX), ca.height - (resizeHandleSize / 2) + 3 + ca.resizing.adjustY,'s','f']);
|
108
119
|
|
109
120
|
|
110
121
|
|
@@ -142,8 +153,9 @@ ca.style.left = 0;
|
|
142
153
|
|
143
154
|
var window_onmousemove = function (e)
|
144
155
|
{
|
145
|
-
var ca
|
146
|
-
|
156
|
+
var ca = active,
|
157
|
+
obj = ca ? ca.__object__ : null;
|
158
|
+
|
147
159
|
if (ca) {
|
148
160
|
|
149
161
|
e = RG.fixEventObject(e);
|
@@ -153,11 +165,13 @@ ca.style.left = 0;
|
|
153
165
|
var newWidth = ca.width + (e.pageX - ca.resizing.originalx);
|
154
166
|
var newHeight = ca.height + (e.pageY - ca.resizing.originaly);
|
155
167
|
|
156
|
-
if (newWidth > (ca.resizing.originalw / 2)
|
168
|
+
if ( newWidth > (ca.resizing.originalw / 2)
|
169
|
+
&& (typeof obj.get('resizableMaxwidth') === 'number' ? newWidth < obj.get('resizableMaxwidth') : true)
|
170
|
+
) {
|
157
171
|
ca.resizing.div.style.width = newWidth + 'px';
|
158
172
|
}
|
159
173
|
|
160
|
-
if (newHeight > (ca.resizing.originalh / 2)) {
|
174
|
+
if (newHeight > (ca.resizing.originalh / 2) && (typeof obj.get('resizableMaxheight') === 'number' ? newHeight < obj.get('resizableMaxheight') : true) ) {
|
161
175
|
ca.resizing.div.style.height = newHeight + 'px';
|
162
176
|
}
|
163
177
|
|
@@ -165,10 +179,13 @@ ca.style.left = 0;
|
|
165
179
|
}
|
166
180
|
}
|
167
181
|
}
|
182
|
+
|
183
|
+
|
184
|
+
|
168
185
|
// Install the function as an event listener - but only once
|
169
|
-
if (typeof
|
186
|
+
if (typeof ca.rgraph_resize_window_mousemove_listener_installed != 'boolean') {
|
170
187
|
window.addEventListener('mousemove', window_onmousemove, false);
|
171
|
-
|
188
|
+
ca.rgraph_resize_window_mousemove_listener_installed = true;
|
172
189
|
}
|
173
190
|
|
174
191
|
// The window onmouseup function
|
@@ -244,7 +261,7 @@ ca.style.left = 0;
|
|
244
261
|
|
245
262
|
|
246
263
|
// Fire the onresize event
|
247
|
-
RG.fireCustomEvent(
|
264
|
+
RG.fireCustomEvent(ca.__object__, 'onresizebeforedraw');
|
248
265
|
|
249
266
|
RG.redrawCanvas(ca);
|
250
267
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
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 starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2016-
|
1
|
+
// version: 2016-06-04
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* | |
|
8
8
|
* | RGraph is dual licensed under the Open Source GPL (General Public License) |
|
9
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 starts at just
|
10
|
+
* | the terms of the GPL. The commercial license starts at just 99 GBP and |
|
11
11
|
* | you can read about it here: |
|
12
12
|
* | |
|
13
13
|
* | http://www.rgraph.net/license |
|
@@ -58,10 +58,17 @@
|
|
58
58
|
/**
|
59
59
|
* chart.tooltip.override allows you to totally take control of rendering the tooltip yourself
|
60
60
|
*/
|
61
|
-
if (typeof(obj.
|
62
|
-
return obj.
|
61
|
+
if (typeof(obj.get('chart.tooltips.override')) == 'function') {
|
62
|
+
return obj.get('chart.tooltips.override')(obj, text, x, y, idx);
|
63
63
|
}
|
64
64
|
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Fire the beforetooltip event
|
68
|
+
*/
|
69
|
+
RG.fireCustomEvent(obj, 'onbeforetooltip');
|
70
|
+
|
71
|
+
|
65
72
|
/**
|
66
73
|
* Save the X/Y coords
|
67
74
|
*/
|
@@ -71,25 +78,25 @@
|
|
71
78
|
/**
|
72
79
|
* This facilitates the "id:xxx" format
|
73
80
|
*/
|
74
|
-
text =
|
81
|
+
text = RG.getTooltipTextFromDIV(text);
|
75
82
|
|
76
83
|
/**
|
77
84
|
* First clear any exising timers
|
78
85
|
*/
|
79
|
-
var timers =
|
86
|
+
var timers = RG.Registry.Get('chart.tooltip.timers');
|
80
87
|
|
81
88
|
if (timers && timers.length) {
|
82
89
|
for (i=0; i<timers.length; ++i) {
|
83
90
|
clearTimeout(timers[i]);
|
84
91
|
}
|
85
92
|
}
|
86
|
-
|
93
|
+
RG.Registry.Set('chart.tooltip.timers', []);
|
87
94
|
|
88
95
|
/**
|
89
96
|
* Hide the context menu if it's currently shown
|
90
97
|
*/
|
91
98
|
if (obj.Get('chart.contextmenu')) {
|
92
|
-
|
99
|
+
RG.hideContext();
|
93
100
|
}
|
94
101
|
|
95
102
|
var effect = obj.Get('chart.tooltips.effect') ? obj.Get('chart.tooltips.effect').toLowerCase() : 'fade';
|
@@ -101,24 +108,19 @@
|
|
101
108
|
var tooltipObj = document.createElement('DIV');
|
102
109
|
tooltipObj.className = obj.Get('chart.tooltips.css.class');
|
103
110
|
tooltipObj.style.display = 'none';
|
104
|
-
tooltipObj.style.position =
|
111
|
+
tooltipObj.style.position = RG.isFixed(obj.canvas) ? 'fixed' : 'absolute';
|
105
112
|
tooltipObj.style.left = 0;
|
106
113
|
tooltipObj.style.top = 0;
|
107
114
|
tooltipObj.style.backgroundColor = 'rgb(255,255,239)';
|
108
115
|
tooltipObj.style.color = 'black';
|
109
116
|
if (!document.all) tooltipObj.style.border = '';
|
110
117
|
tooltipObj.style.visibility = 'visible';
|
111
|
-
tooltipObj.style.paddingLeft =
|
112
|
-
tooltipObj.style.paddingRight =
|
113
|
-
tooltipObj.style.fontFamily =
|
114
|
-
tooltipObj.style.fontSize =
|
118
|
+
tooltipObj.style.paddingLeft = RG.tooltips.padding;
|
119
|
+
tooltipObj.style.paddingRight = RG.tooltips.padding;
|
120
|
+
tooltipObj.style.fontFamily = RG.tooltips.font_face;
|
121
|
+
tooltipObj.style.fontSize = RG.tooltips.font_size;
|
115
122
|
tooltipObj.style.zIndex = 3;
|
116
123
|
|
117
|
-
// Only apply a border if there's content
|
118
|
-
if (RGraph.trim(text).length > 0) {
|
119
|
-
tooltipObj.style.border = '1px #bbb solid';
|
120
|
-
}
|
121
|
-
|
122
124
|
tooltipObj.style.borderRadius = '5px';
|
123
125
|
tooltipObj.style.MozBorderRadius = '5px';
|
124
126
|
tooltipObj.style.WebkitBorderRadius = '5px';
|
@@ -167,7 +169,7 @@
|
|
167
169
|
|
168
170
|
|
169
171
|
|
170
|
-
tooltipObj.style.top =
|
172
|
+
tooltipObj.style.top = window.event.pageY - height - 5 + 'px';
|
171
173
|
|
172
174
|
/**
|
173
175
|
* If the function exists call the object specific tooltip positioning function
|
@@ -181,9 +183,15 @@
|
|
181
183
|
if (obj.Get('chart.tooltips.coords.page')) {
|
182
184
|
|
183
185
|
tooltipObj.style.left = e.pageX - (width / 2) - 4.25 + 'px';
|
184
|
-
tooltipObj.style.top = e.pageY - height -
|
185
|
-
|
186
|
-
|
186
|
+
tooltipObj.style.top = e.pageY - height - 5 + 'px';
|
187
|
+
|
188
|
+
// In case the value is negative - this positions the tooltip
|
189
|
+
// underneath the click
|
190
|
+
//if (obj.type === 'bar' && obj.data_arr[idx] < 0) {
|
191
|
+
//tooltipObj.style.top = e.pageY + 10 + 'px';
|
192
|
+
//}
|
193
|
+
|
194
|
+
//document.getElementById('__rgraph_tooltip_pointer__').style.left = (parseInt(tooltipObj.offsetWidth) / 2) - 8.5 + 'px';
|
187
195
|
}
|
188
196
|
}
|
189
197
|
} else {
|
@@ -226,7 +234,7 @@
|
|
226
234
|
/**
|
227
235
|
* Keep a reference to the tooltip in the registry
|
228
236
|
*/
|
229
|
-
|
237
|
+
RG.Registry.Set('chart.tooltip', tooltipObj);
|
230
238
|
|
231
239
|
/**
|
232
240
|
* Fire the tooltip event
|
@@ -263,16 +271,16 @@
|
|
263
271
|
{
|
264
272
|
var div = document.createElement('DIV');
|
265
273
|
div.className = obj.Get('chart.tooltips.css.class');
|
266
|
-
div.style.paddingLeft =
|
267
|
-
div.style.paddingRight =
|
268
|
-
div.style.fontFamily =
|
269
|
-
div.style.fontSize =
|
274
|
+
div.style.paddingLeft = RG.tooltips.padding;
|
275
|
+
div.style.paddingRight = RG.tooltips.padding;
|
276
|
+
div.style.fontFamily = RG.tooltips.font_face;
|
277
|
+
div.style.fontSize = RG.tooltips.font_size;
|
270
278
|
div.style.visibility = 'hidden';
|
271
279
|
div.style.position = 'absolute';
|
272
280
|
div.style.top = '300px';
|
273
281
|
div.style.left = 0;
|
274
282
|
div.style.display = 'inline';
|
275
|
-
div.innerHTML =
|
283
|
+
div.innerHTML = RG.getTooltipTextFromDIV(text);
|
276
284
|
document.body.appendChild(div);
|
277
285
|
|
278
286
|
return div.offsetWidth;
|
@@ -285,14 +293,14 @@
|
|
285
293
|
RG.hideTooltip =
|
286
294
|
RG.HideTooltip = function ()
|
287
295
|
{
|
288
|
-
var tooltip =
|
296
|
+
var tooltip = RG.Registry.Get('chart.tooltip');
|
289
297
|
var uid = arguments[0] && arguments[0].uid ? arguments[0].uid : null;
|
290
298
|
|
291
299
|
if (tooltip && tooltip.parentNode && (!uid || uid == tooltip.__canvas__.uid)) {
|
292
300
|
tooltip.parentNode.removeChild(tooltip);
|
293
301
|
tooltip.style.display = 'none';
|
294
302
|
tooltip.style.visibility = 'hidden';
|
295
|
-
|
303
|
+
RG.Registry.Set('chart.tooltip', null);
|
296
304
|
}
|
297
305
|
};
|
298
306
|
|
@@ -498,7 +506,7 @@
|
|
498
506
|
{
|
499
507
|
var tooltips = obj.Get('chart.tooltips');
|
500
508
|
|
501
|
-
if (
|
509
|
+
if (RG.hasTooltips(obj)) {
|
502
510
|
|
503
511
|
if (obj.type == 'rscatter') {
|
504
512
|
tooltips = [];
|
@@ -558,7 +566,7 @@
|
|
558
566
|
&& obj.Get('chart.tooltips')[shape['index']]
|
559
567
|
) {
|
560
568
|
|
561
|
-
var text =
|
569
|
+
var text = RG.parseTooltipText(obj.Get('chart.tooltips'), shape['index']);
|
562
570
|
|
563
571
|
if (text) {
|
564
572
|
|
@@ -571,15 +579,15 @@
|
|
571
579
|
|
572
580
|
// Show the tooltip if it's not the same as the one already visible
|
573
581
|
if (
|
574
|
-
!
|
575
|
-
||
|
576
|
-
||
|
582
|
+
!RG.Registry.Get('chart.tooltip')
|
583
|
+
|| RG.Registry.Get('chart.tooltip').__object__.uid != obj.uid
|
584
|
+
|| RG.Registry.Get('chart.tooltip').__index__ != shape['index']
|
577
585
|
) {
|
578
586
|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
587
|
+
RG.hideTooltip();
|
588
|
+
RG.Clear(obj.canvas);
|
589
|
+
RG.redraw();
|
590
|
+
RG.tooltip(obj, text, e.pageX, e.pageY, shape['index']);
|
583
591
|
obj.Highlight(shape);
|
584
592
|
}
|
585
593
|
}
|
@@ -590,7 +598,7 @@
|
|
590
598
|
*/
|
591
599
|
} else if (shape && typeof(shape['index']) == 'number') {
|
592
600
|
|
593
|
-
var text =
|
601
|
+
var text = RG.parseTooltipText(obj.Get('chart.tooltips'), shape['index']);
|
594
602
|
|
595
603
|
if (text) {
|
596
604
|
changeCursor_tooltips = true
|