rgraph-rails 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- 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 is just
|
10
|
+
* | the terms of the GPL. The commercial license is just 99 GBP and you can |
|
11
11
|
* | read about it here: |
|
12
12
|
* | http://www.rgraph.net/license |
|
13
13
|
* o--------------------------------------------------------------------------------o
|
@@ -88,8 +88,11 @@
|
|
88
88
|
'chart.gutter.bottom': 15,
|
89
89
|
'chart.ticksize': 3,
|
90
90
|
'chart.text.color': 'black',
|
91
|
-
'chart.text.font': 'Arial',
|
91
|
+
'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
92
92
|
'chart.text.size': 12,
|
93
|
+
'chart.text.accessible': true,
|
94
|
+
'chart.text.accessible.overflow': 'visible',
|
95
|
+
'chart.text.accessible.pointerevents': false,
|
93
96
|
'chart.units.pre': '',
|
94
97
|
'chart.units.post': '',
|
95
98
|
'chart.zoom.factor': 1.5,
|
@@ -130,7 +133,8 @@
|
|
130
133
|
'chart.tooltips.effect': 'fade',
|
131
134
|
'chart.tooltips.event': 'onclick',
|
132
135
|
'chart.highlight.stroke': 'rgba(0,0,0,0)',
|
133
|
-
'chart.highlight.fill': 'rgba(255,255,255,0.7)'
|
136
|
+
'chart.highlight.fill': 'rgba(255,255,255,0.7)',
|
137
|
+
'chart.clearto': 'rgba(0,0,0,0)'
|
134
138
|
}
|
135
139
|
|
136
140
|
|
@@ -167,7 +171,6 @@
|
|
167
171
|
ca = this.canvas,
|
168
172
|
co = ca.getContext('2d'),
|
169
173
|
prop = this.properties,
|
170
|
-
pa = RG.Path,
|
171
174
|
pa2 = RG.path2,
|
172
175
|
win = window,
|
173
176
|
doc = document,
|
@@ -219,10 +222,9 @@
|
|
219
222
|
|
220
223
|
|
221
224
|
// Convert uppercase letters to dot+lower case letter
|
222
|
-
name
|
223
|
-
|
224
|
-
|
225
|
-
});
|
225
|
+
while(name.match(/([A-Z])/)) {
|
226
|
+
name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
|
227
|
+
}
|
226
228
|
|
227
229
|
|
228
230
|
|
@@ -776,17 +778,25 @@
|
|
776
778
|
this.Highlight = function (shape)
|
777
779
|
{
|
778
780
|
if (prop['chart.tooltips.highlight']) {
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
781
|
+
|
782
|
+
if (typeof prop['chart.highlight.style'] === 'function') {
|
783
|
+
(prop['chart.highlight.style'])(shape);
|
784
|
+
return;
|
785
|
+
}
|
786
|
+
|
787
|
+
pa2(co, 'b r % % % % a % % % % % false s % f %',
|
788
|
+
shape['x'],
|
789
|
+
shape['y'],
|
790
|
+
shape['width'],
|
791
|
+
shape['height'] + this.bulbBottomRadius,
|
792
|
+
this.bulbBottomCenterX,
|
793
|
+
this.bulbBottomCenterY,
|
794
|
+
this.bulbBottomRadius - 1,
|
795
|
+
0,
|
796
|
+
RG.TWOPI,
|
797
|
+
prop['chart.highlight.stroke'],
|
798
|
+
prop['chart.highlight.fill']
|
799
|
+
);
|
790
800
|
}
|
791
801
|
};
|
792
802
|
|
@@ -864,6 +874,7 @@
|
|
864
874
|
var coordW = obj.coords[tooltip.__index__][2];
|
865
875
|
var coordH = obj.coords[tooltip.__index__][3];
|
866
876
|
var canvasXY = RGraph.getCanvasXY(ca);
|
877
|
+
var mouseXY = RG.getMouseXY(window.event);
|
867
878
|
var gutterLeft = obj.gutterLeft;
|
868
879
|
var gutterTop = obj.gutterTop;
|
869
880
|
var width = tooltip.offsetWidth;
|
@@ -871,35 +882,24 @@
|
|
871
882
|
|
872
883
|
// Set the top position
|
873
884
|
tooltip.style.left = 0;
|
874
|
-
tooltip.style.top =
|
885
|
+
tooltip.style.top = window.event.pageY - height - 5 + 'px';
|
875
886
|
|
876
887
|
// By default any overflow is hidden
|
877
888
|
tooltip.style.overflow = '';
|
878
|
-
|
879
|
-
// The arrow
|
880
|
-
var img = new Image();
|
881
|
-
img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
|
882
|
-
img.style.position = 'absolute';
|
883
|
-
img.id = '__rgraph_tooltip_pointer__';
|
884
|
-
img.style.top = (tooltip.offsetHeight - 2) + 'px';
|
885
|
-
tooltip.appendChild(img);
|
886
889
|
|
887
890
|
// Reposition the tooltip if at the edges:
|
888
891
|
|
889
892
|
// LEFT edge
|
890
|
-
if (
|
891
|
-
tooltip.style.left =
|
892
|
-
img.style.left = ((width * 0.1) - 8.5) + 'px';
|
893
|
+
if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
|
894
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
|
893
895
|
|
894
896
|
// RIGHT edge
|
895
|
-
} else if (
|
896
|
-
tooltip.style.left = canvasXY[0] +
|
897
|
-
img.style.left = ((width * 0.9) - 8.5) + 'px';
|
897
|
+
} else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
|
898
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
|
898
899
|
|
899
900
|
// Default positioning - CENTERED
|
900
901
|
} else {
|
901
|
-
tooltip.style.left =
|
902
|
-
img.style.left = ((width * 0.5) - 8.5) + 'px';
|
902
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
|
903
903
|
}
|
904
904
|
};
|
905
905
|
|
@@ -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 is just
|
10
|
+
* | the terms of the GPL. The commercial license is just 99 GBP and you can |
|
11
11
|
* | read about it here: |
|
12
12
|
* | http://www.rgraph.net/license |
|
13
13
|
* o--------------------------------------------------------------------------------o
|
@@ -91,7 +91,7 @@
|
|
91
91
|
'chart.gutter.bottom': 25,
|
92
92
|
'chart.numticks': 10,
|
93
93
|
'chart.numticks.inner': 50,
|
94
|
-
'chart.background.color': '#eee',
|
94
|
+
'chart.background.color': 'Gradient(#ccc:#eee:#efefef)',
|
95
95
|
'chart.shadow': false,
|
96
96
|
'chart.shadow.color': 'rgba(0,0,0,0.5)',
|
97
97
|
'chart.shadow.blur': 3,
|
@@ -103,13 +103,16 @@
|
|
103
103
|
'chart.title.size': null,
|
104
104
|
'chart.title.color': 'black',
|
105
105
|
'chart.title.side': null,
|
106
|
-
'chart.title.side.font': 'Arial',
|
106
|
+
'chart.title.side.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
107
107
|
'chart.title.side.size': 12,
|
108
108
|
'chart.title.side.color': 'black',
|
109
109
|
'chart.title.side.bold': true,
|
110
110
|
'chart.text.size': 12,
|
111
111
|
'chart.text.color': 'black',
|
112
|
-
'chart.text.font': 'Arial',
|
112
|
+
'chart.text.font': 'Segoe UI, Arial, Verdana, sans-serif',
|
113
|
+
'chart.text.accessible': true,
|
114
|
+
'chart.text.accessible.overflow': 'visible',
|
115
|
+
'chart.text.accessible.pointerevents': false,
|
113
116
|
'chart.contextmenu': null,
|
114
117
|
'chart.units.pre': '',
|
115
118
|
'chart.units.post': '',
|
@@ -140,6 +143,8 @@
|
|
140
143
|
'chart.label.inner': false,
|
141
144
|
'chart.labels.count': 10,
|
142
145
|
'chart.labels.position': 'right',
|
146
|
+
'chart.labels.offsetx': 0,
|
147
|
+
'chart.labels.offsety': 0,
|
143
148
|
'chart.adjustable': false,
|
144
149
|
'chart.scale.decimals': 0,
|
145
150
|
'chart.scale.thousand': ',',
|
@@ -167,7 +172,8 @@
|
|
167
172
|
'chart.key.text.color': 'black',
|
168
173
|
'chart.events.click': null,
|
169
174
|
'chart.events.mousemove': null,
|
170
|
-
'chart.border.inner': true
|
175
|
+
'chart.border.inner': true,
|
176
|
+
'chart.clearto': 'rgba(0,0,0,0)'
|
171
177
|
}
|
172
178
|
|
173
179
|
// Check for support
|
@@ -204,7 +210,6 @@
|
|
204
210
|
ca = this.canvas,
|
205
211
|
co = ca.getContext('2d'),
|
206
212
|
prop = this.properties,
|
207
|
-
pa = RG.Path,
|
208
213
|
pa2 = RG.path2,
|
209
214
|
win = window,
|
210
215
|
doc = document,
|
@@ -264,10 +269,9 @@
|
|
264
269
|
|
265
270
|
|
266
271
|
// Convert uppercase letters to dot+lower case letter
|
267
|
-
name
|
268
|
-
|
269
|
-
|
270
|
-
});
|
272
|
+
while(name.match(/([A-Z])/)) {
|
273
|
+
name = name.replace(/([A-Z])/, '.' + RegExp.$1.toLowerCase());
|
274
|
+
}
|
271
275
|
|
272
276
|
|
273
277
|
|
@@ -446,79 +450,120 @@
|
|
446
450
|
/**
|
447
451
|
* First get the scale
|
448
452
|
*/
|
449
|
-
this.scale2 =
|
450
|
-
'max':this.max,
|
451
|
-
'min':this.min,
|
452
|
-
'strict':true,
|
453
|
-
'scale.thousand':prop['chart.scale.thousand'],
|
454
|
-
'scale.point':prop['chart.scale.point'],
|
455
|
-
'scale.decimals':prop['chart.scale.decimals'],
|
456
|
-
'ylabels.count':prop['chart.labels.count'],
|
457
|
-
'scale.round':prop['chart.scale.round'],
|
458
|
-
'units.pre':
|
459
|
-
'units.post':
|
453
|
+
this.scale2 = RG.getScale2(this, {
|
454
|
+
'max': this.max,
|
455
|
+
'min': this.min,
|
456
|
+
'strict': true,
|
457
|
+
'scale.thousand': prop['chart.scale.thousand'],
|
458
|
+
'scale.point': prop['chart.scale.point'],
|
459
|
+
'scale.decimals': prop['chart.scale.decimals'],
|
460
|
+
'ylabels.count': prop['chart.labels.count'],
|
461
|
+
'scale.round': prop['chart.scale.round'],
|
462
|
+
'units.pre': prop['chart.units.pre'],
|
463
|
+
'units.post': prop['chart.units.post']
|
460
464
|
});
|
461
465
|
|
462
|
-
|
466
|
+
|
463
467
|
// Set a shadow if requested
|
464
468
|
if (prop['chart.shadow']) {
|
465
|
-
RG.
|
466
|
-
}
|
467
|
-
|
468
|
-
// Draw the shadow for MSIE
|
469
|
-
if (RGraph.ISOLD && prop['chart.shadow']) {
|
470
|
-
co.fillStyle = prop['chart.shadow.color'];
|
471
|
-
co.fillRect(this.gutterLeft + prop['chart.shadow.offsetx'], this.gutterTop + prop['chart.shadow.offsety'], this.width, this.height);
|
469
|
+
RG.setShadow(this, prop['chart.shadow.color'], prop['chart.shadow.offsetx'], prop['chart.shadow.offsety'], prop['chart.shadow.blur']);
|
472
470
|
}
|
473
471
|
|
474
472
|
// Draw the outline
|
475
473
|
co.fillStyle = prop['chart.background.color'];
|
476
474
|
co.strokeStyle = prop['chart.strokestyle.outer'];
|
477
|
-
|
478
|
-
co.
|
475
|
+
|
476
|
+
co.strokeRect(
|
477
|
+
this.gutterLeft,
|
478
|
+
this.gutterTop,
|
479
|
+
this.width,
|
480
|
+
this.height
|
481
|
+
);
|
482
|
+
|
483
|
+
co.fillRect(
|
484
|
+
this.gutterLeft,
|
485
|
+
this.gutterTop,
|
486
|
+
this.width,
|
487
|
+
this.height
|
488
|
+
);
|
479
489
|
|
480
490
|
// Turn off any shadow
|
481
|
-
RG.
|
491
|
+
RG.noShadow(this);
|
482
492
|
|
483
493
|
co.strokeStyle = prop['chart.strokestyle.outer'];
|
484
494
|
co.fillStyle = prop['chart.colors'][0];
|
485
495
|
var margin = prop['chart.margin'];
|
486
496
|
var barHeight = (ca.height - this.gutterTop - this.gutterBottom) * ((RG.arraySum(this.value) - this.min) / (this.max - this.min));
|
487
|
-
|
497
|
+
|
488
498
|
// Draw the actual bar itself
|
489
|
-
if (typeof this.value
|
490
|
-
|
499
|
+
if (typeof this.value === 'number') {
|
500
|
+
|
491
501
|
co.lineWidth = 1;
|
492
502
|
co.strokeStyle = prop['chart.strokestyle.inner'];
|
493
|
-
|
503
|
+
if (prop['chart.border.inner']) {
|
504
|
+
this.drawCurvedBar({
|
505
|
+
x: this.gutterLeft + margin,
|
506
|
+
y: this.gutterTop + (this.height - barHeight),
|
507
|
+
width: this.width - margin - margin,
|
508
|
+
height: barHeight,
|
509
|
+
stroke: prop['chart.strokestyle.inner']
|
510
|
+
});
|
511
|
+
}
|
512
|
+
|
513
|
+
this.drawCurvedBar({
|
514
|
+
x: this.gutterLeft + margin,
|
515
|
+
y: this.gutterTop + (this.height - barHeight),
|
516
|
+
width: this.width - margin - margin,
|
517
|
+
height: barHeight,
|
518
|
+
fill: prop['chart.colors'][0]
|
519
|
+
});
|
520
|
+
|
494
521
|
} else if (typeof this.value == 'object') {
|
495
|
-
|
522
|
+
|
496
523
|
co.beginPath();
|
497
524
|
co.strokeStyle = prop['chart.strokestyle.inner'];
|
498
525
|
|
499
526
|
var startPoint = ca.height - this.gutterBottom;
|
500
527
|
|
501
|
-
for (var i=0
|
502
|
-
|
528
|
+
for (var i=0,len=this.value.length; i<len; ++i) {
|
529
|
+
|
503
530
|
var segmentHeight = ( (this.value[i] - this.min) / (this.max - this.min) ) * (ca.height - this.gutterBottom - this.gutterTop);
|
504
531
|
|
505
532
|
co.fillStyle = prop['chart.colors'][i];
|
506
|
-
|
533
|
+
|
534
|
+
co.beginPath();
|
507
535
|
if (prop['chart.border.inner']) {
|
508
|
-
|
536
|
+
this.drawCurvedBar({
|
537
|
+
x: this.gutterLeft + margin,
|
538
|
+
y: startPoint - segmentHeight,
|
539
|
+
width: this.width - margin - margin,
|
540
|
+
height: segmentHeight,
|
541
|
+
stroke: co.strokeStyle
|
542
|
+
});
|
509
543
|
}
|
510
|
-
|
544
|
+
|
545
|
+
this.drawCurvedBar({
|
546
|
+
x: this.gutterLeft + margin,
|
547
|
+
y: startPoint - segmentHeight,
|
548
|
+
width: this.width - margin - margin,
|
549
|
+
height: segmentHeight,
|
550
|
+
fill: co.fillStyle
|
551
|
+
});
|
511
552
|
|
512
553
|
|
513
554
|
|
514
555
|
// Store the coords
|
515
|
-
this.coords.push([
|
556
|
+
this.coords.push([
|
557
|
+
this.gutterLeft + margin,
|
558
|
+
startPoint - segmentHeight,
|
559
|
+
this.width - margin - margin,
|
560
|
+
segmentHeight
|
561
|
+
]);
|
516
562
|
|
517
563
|
startPoint -= segmentHeight;
|
518
564
|
}
|
519
|
-
|
520
|
-
|
521
|
-
co.stroke();
|
565
|
+
|
566
|
+
//co.stroke();
|
522
567
|
co.fill();
|
523
568
|
}
|
524
569
|
|
@@ -547,23 +592,34 @@
|
|
547
592
|
|
548
593
|
co.beginPath();
|
549
594
|
co.strokeStyle = prop['chart.strokestyle.inner'];
|
550
|
-
|
595
|
+
|
551
596
|
if (typeof this.value == 'number') {
|
552
597
|
|
553
598
|
if (prop['chart.border.inner']) {
|
554
|
-
|
599
|
+
this.drawCurvedBar({
|
600
|
+
x: this.gutterLeft + margin,
|
601
|
+
y: this.gutterTop + this.height - barHeight,
|
602
|
+
width: this.width - margin - margin,
|
603
|
+
height: barHeight
|
604
|
+
});
|
555
605
|
}
|
556
|
-
|
606
|
+
|
607
|
+
this.drawCurvedBar({
|
608
|
+
x: this.gutterLeft + margin,
|
609
|
+
y: this.gutterTop + this.height - barHeight,
|
610
|
+
width: this.width - margin - margin,
|
611
|
+
height: barHeight
|
612
|
+
});
|
613
|
+
|
614
|
+
// Store the coords
|
615
|
+
this.coords.push([
|
557
616
|
this.gutterLeft + margin,
|
558
617
|
this.gutterTop + this.height - barHeight,
|
559
618
|
this.width - margin - margin,
|
560
619
|
barHeight
|
561
|
-
);
|
562
|
-
|
563
|
-
// Store the coords
|
564
|
-
this.coords.push([this.gutterLeft + margin, this.gutterTop + this.height - barHeight, this.width - margin - margin, barHeight]);
|
620
|
+
]);
|
565
621
|
}
|
566
|
-
|
622
|
+
|
567
623
|
|
568
624
|
/**
|
569
625
|
* Draw the arrows indicating the level if requested
|
@@ -605,15 +661,16 @@
|
|
605
661
|
*/
|
606
662
|
if (prop['chart.label.inner']) {
|
607
663
|
co.fillStyle = 'black';
|
608
|
-
RG.
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
664
|
+
RG.text2(this, {
|
665
|
+
'font':prop['chart.text.font'],
|
666
|
+
'size':prop['chart.text.size'],
|
667
|
+
'x':((ca.width - this.gutterLeft - this.gutterRight) / 2) + this.gutterLeft,'y':this.coords[this.coords.length - 1][1] - 5,'text':RGraph.number_format(this, (typeof(this.value) == 'number' ? this.value : RG.array_sum(this.value)).toFixed(prop['chart.scale.decimals'])),
|
668
|
+
'valign':'bottom',
|
669
|
+
'halign':'center',
|
670
|
+
'bounding':true,
|
671
|
+
'boundingFill':'white',
|
672
|
+
'tag': 'label.inner'
|
673
|
+
});
|
617
674
|
}
|
618
675
|
};
|
619
676
|
|
@@ -658,7 +715,7 @@
|
|
658
715
|
|
659
716
|
co.fillStyle = prop['chart.text.color'];
|
660
717
|
|
661
|
-
var position = prop['chart.labels.position'];
|
718
|
+
var position = prop['chart.labels.position'].toLowerCase();
|
662
719
|
var xAlignment = position == 'left' ? 'right' : 'left';
|
663
720
|
var yAlignment = 'center';
|
664
721
|
var count = prop['chart.labels.count'];
|
@@ -667,48 +724,54 @@
|
|
667
724
|
var text_size = prop['chart.text.size'];
|
668
725
|
var text_font = prop['chart.text.font'];
|
669
726
|
var decimals = prop['chart.scale.decimals'];
|
727
|
+
var offsetx = prop['chart.labels.offsetx'];
|
728
|
+
var offsety = prop['chart.labels.offsety'];
|
670
729
|
|
671
730
|
if (prop['chart.tickmarks']) {
|
672
731
|
|
673
732
|
for (var i=0; i<count ; ++i) {
|
674
|
-
RG.
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
733
|
+
RG.text2(this, {
|
734
|
+
font:text_font,
|
735
|
+
size:text_size,
|
736
|
+
x:position == 'left' ? (this.gutterLeft - 7 + offsetx) : (ca.width - this.gutterRight + 7) + offsetx,
|
737
|
+
y:(((ca.height - this.gutterTop - this.gutterBottom) / count) * i) + this.gutterTop + offsety,
|
738
|
+
text:this.scale2.labels[this.scale2.labels.length - (i+1)],
|
739
|
+
valign:yAlignment,
|
740
|
+
halign:xAlignment,
|
741
|
+
tag: 'scale'
|
742
|
+
});
|
683
743
|
}
|
684
744
|
|
685
745
|
/**
|
686
746
|
* Show zero?
|
687
747
|
*/
|
688
748
|
if (prop['chart.tickmarks.zerostart'] && this.min == 0) {
|
689
|
-
RG.
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
749
|
+
RG.text2(this, {
|
750
|
+
font: text_font,
|
751
|
+
size: text_size,
|
752
|
+
x: position == 'left' ? (this.gutterLeft - 5 + offsetx) : (ca.width - this.gutterRight + 5 + offsetx),
|
753
|
+
y: ca.height - this.gutterBottom + offsety,
|
754
|
+
'text': RG.numberFormat(this, this.min.toFixed(decimals), units_pre, units_post),
|
755
|
+
valign: yAlignment,
|
756
|
+
halign: xAlignment,
|
757
|
+
tag: 'scale'
|
758
|
+
});
|
697
759
|
}
|
698
760
|
|
699
761
|
/**
|
700
762
|
* min is set
|
701
763
|
*/
|
702
764
|
if (this.min != 0) {
|
703
|
-
RG.
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
765
|
+
RG.text2(this, {
|
766
|
+
font: text_font,
|
767
|
+
size: text_size,
|
768
|
+
x: position == 'left' ? (this.gutterLeft - 5 + offsetx) : (ca.width - this.gutterRight + 5 + offsetx),
|
769
|
+
y: ca.height - this.gutterBottom + offsety,
|
770
|
+
text: RG.number_format(this, this.min.toFixed(decimals), units_pre, units_post),
|
771
|
+
valign: yAlignment,
|
772
|
+
halign: xAlignment,
|
773
|
+
tag: 'scale'
|
774
|
+
});
|
712
775
|
}
|
713
776
|
}
|
714
777
|
};
|
@@ -731,16 +794,17 @@
|
|
731
794
|
|
732
795
|
co.fillStyle = prop['chart.title.color'];
|
733
796
|
|
734
|
-
RG.
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
797
|
+
RG.text2(this, {
|
798
|
+
'font':prop['chart.title.font'] ? prop['chart.title.font'] : text_font,
|
799
|
+
'size':title_size,
|
800
|
+
'x':this.gutterLeft + ((ca.width - this.gutterLeft - this.gutterRight) / 2),
|
801
|
+
'y':this.gutterTop - 5,
|
802
|
+
'text':prop['chart.title'],
|
803
|
+
'valign':'bottom',
|
804
|
+
'halign':'center',
|
805
|
+
'bold': prop['chart.title.bold'],
|
806
|
+
'tag': 'title'
|
807
|
+
});
|
744
808
|
}
|
745
809
|
|
746
810
|
// Draw side title
|
@@ -773,30 +837,39 @@
|
|
773
837
|
this.getShape =
|
774
838
|
this.getBar = function (e)
|
775
839
|
{
|
776
|
-
var
|
777
|
-
|
840
|
+
var mouseXY = RG.getMouseXY(e),
|
841
|
+
mouseX = mouseXY[0],
|
842
|
+
mouseY = mouseXY[1]
|
843
|
+
|
778
844
|
for (var i=0,len=this.coords.length; i<len; i++) {
|
779
|
-
|
780
|
-
var
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
845
|
+
|
846
|
+
var x = this.coords[i][0],
|
847
|
+
y = this.coords[i][1],
|
848
|
+
w = this.coords[i][2],
|
849
|
+
h = this.coords[i][3],
|
850
|
+
idx = i;
|
851
|
+
|
852
|
+
co.beginPath();
|
853
|
+
this.drawCurvedBar({
|
854
|
+
x: x,
|
855
|
+
y: y,
|
856
|
+
width: w,
|
857
|
+
height: h
|
858
|
+
});
|
859
|
+
|
860
|
+
if (co.isPointInPath(mouseX, mouseY)) {
|
790
861
|
|
791
862
|
var tooltip = RG.parseTooltipText(prop['chart.tooltips'], i);
|
792
863
|
|
793
|
-
return {
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
864
|
+
return {
|
865
|
+
0: this, 'object': this,
|
866
|
+
1: x, 'x': x,
|
867
|
+
2: y, 'y': y,
|
868
|
+
3: w, 'width': w,
|
869
|
+
4: h, 'height': h,
|
870
|
+
5: i, 'index': i,
|
871
|
+
'tooltip': tooltip
|
872
|
+
};
|
800
873
|
}
|
801
874
|
}
|
802
875
|
};
|
@@ -838,8 +911,21 @@
|
|
838
911
|
this.highlight =
|
839
912
|
this.Highlight = function (shape)
|
840
913
|
{
|
841
|
-
|
842
|
-
|
914
|
+
if (typeof prop['chart.highlight.style'] === 'function') {
|
915
|
+
(prop['chart.highlight.style'])(shape);
|
916
|
+
} else {
|
917
|
+
|
918
|
+
var last = shape.index === this.coords.length - 1;
|
919
|
+
|
920
|
+
this.drawCurvedBar({
|
921
|
+
x: shape.x,
|
922
|
+
y: shape.y,
|
923
|
+
width: shape.width,
|
924
|
+
height: shape.height,
|
925
|
+
stroke: prop['chart.highlight.stroke'],
|
926
|
+
fill: prop['chart.highlight.fill']
|
927
|
+
});
|
928
|
+
}
|
843
929
|
};
|
844
930
|
|
845
931
|
|
@@ -963,6 +1049,7 @@
|
|
963
1049
|
var coordW = obj.coords[tooltip.__index__][2];
|
964
1050
|
var coordH = obj.coords[tooltip.__index__][3];
|
965
1051
|
var canvasXY = RG.getCanvasXY(obj.canvas);
|
1052
|
+
var mouseXY = RG.getMouseXY(window.event);
|
966
1053
|
var gutterLeft = obj.gutterLeft;
|
967
1054
|
var gutterTop = obj.gutterTop;
|
968
1055
|
var width = tooltip.offsetWidth;
|
@@ -970,35 +1057,24 @@
|
|
970
1057
|
|
971
1058
|
// Set the top position
|
972
1059
|
tooltip.style.left = 0;
|
973
|
-
tooltip.style.top =
|
1060
|
+
tooltip.style.top = window.event.pageY - height - 5 + 'px';
|
974
1061
|
|
975
1062
|
// By default any overflow is hidden
|
976
1063
|
tooltip.style.overflow = '';
|
977
|
-
|
978
|
-
// The arrow
|
979
|
-
var img = new Image();
|
980
|
-
img.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';
|
981
|
-
img.style.position = 'absolute';
|
982
|
-
img.id = '__rgraph_tooltip_pointer__';
|
983
|
-
img.style.top = (tooltip.offsetHeight - 2) + 'px';
|
984
|
-
tooltip.appendChild(img);
|
985
1064
|
|
986
1065
|
// Reposition the tooltip if at the edges:
|
987
1066
|
|
988
1067
|
// LEFT edge
|
989
|
-
if (
|
990
|
-
tooltip.style.left =
|
991
|
-
img.style.left = ((width * 0.1) - 8.5) + 'px';
|
1068
|
+
if (canvasXY[0] + mouseXY[0] - (width / 2) < 0) {
|
1069
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.1) + 'px';
|
992
1070
|
|
993
1071
|
// RIGHT edge
|
994
|
-
} else if (
|
995
|
-
tooltip.style.left = canvasXY[0] +
|
996
|
-
img.style.left = ((width * 0.9) - 8.5) + 'px';
|
1072
|
+
} else if (canvasXY[0] + mouseXY[0] + (width / 2) > doc.body.offsetWidth) {
|
1073
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width * 0.9) + 'px';
|
997
1074
|
|
998
1075
|
// Default positioning - CENTERED
|
999
1076
|
} else {
|
1000
|
-
tooltip.style.left =
|
1001
|
-
img.style.left = ((width * 0.5) - 8.5) + 'px';
|
1077
|
+
tooltip.style.left = canvasXY[0] + mouseXY[0] - (width / 2) + 'px';
|
1002
1078
|
}
|
1003
1079
|
};
|
1004
1080
|
|
@@ -1135,27 +1211,51 @@
|
|
1135
1211
|
this.DrawBevel = function ()
|
1136
1212
|
{
|
1137
1213
|
// In case of multiple segments - this adds up all the lengths
|
1138
|
-
for (var i=0,
|
1214
|
+
for (var i=0,height=0; i<this.coords.length; ++i) {
|
1215
|
+
height += this.coords[i][3];
|
1216
|
+
}
|
1139
1217
|
|
1140
1218
|
co.save();
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1219
|
+
co.beginPath();
|
1220
|
+
co.rect(
|
1221
|
+
this.coords[0][0],
|
1222
|
+
this.coords[this.coords.length - 1][1] - 1,
|
1223
|
+
this.coords[0][2],
|
1224
|
+
height
|
1225
|
+
);
|
1226
|
+
co.clip();
|
1227
|
+
|
1228
|
+
co.save();
|
1229
|
+
// Draw a path to clip to
|
1230
|
+
co.beginPath();
|
1231
|
+
this.drawCurvedBar({
|
1232
|
+
x: this.coords[0][0],
|
1233
|
+
y: this.coords[this.coords.length - 1][1] - 1,
|
1234
|
+
width: this.coords[0][2],
|
1235
|
+
height: height
|
1236
|
+
});
|
1237
|
+
co.clip();
|
1148
1238
|
|
1149
|
-
|
1150
|
-
co.
|
1151
|
-
|
1152
|
-
|
1239
|
+
// Now draw the rect with a shadow
|
1240
|
+
co.beginPath();
|
1241
|
+
|
1242
|
+
co.shadowColor = 'black';
|
1243
|
+
co.shadowOffsetX = 0;
|
1244
|
+
co.shadowOffsetY = 0;
|
1245
|
+
co.shadowBlur = 15;
|
1246
|
+
|
1247
|
+
co.lineWidth = 2;
|
1248
|
+
|
1249
|
+
this.drawCurvedBar({
|
1250
|
+
x: this.coords[0][0] - 1,
|
1251
|
+
y: this.coords[this.coords.length - 1][1] - 1,
|
1252
|
+
width: this.coords[0][2] + 2,
|
1253
|
+
height: height + 2 + 100
|
1254
|
+
});
|
1153
1255
|
|
1154
|
-
co.
|
1155
|
-
|
1156
|
-
|
1157
|
-
co.stroke();
|
1158
|
-
|
1256
|
+
co.stroke();
|
1257
|
+
|
1258
|
+
co.restore();
|
1159
1259
|
co.restore();
|
1160
1260
|
};
|
1161
1261
|
|
@@ -1209,6 +1309,34 @@
|
|
1209
1309
|
|
1210
1310
|
|
1211
1311
|
|
1312
|
+
/**
|
1313
|
+
* Draws a bar with a curved end
|
1314
|
+
*
|
1315
|
+
* DOESN'T DRAW A CURVED BAR ANY MORE - JUST A REGULAR SQUARE ENDED BAR
|
1316
|
+
*
|
1317
|
+
* @param object opt The coords and colours
|
1318
|
+
*/
|
1319
|
+
this.drawCurvedBar = function (opt)
|
1320
|
+
{
|
1321
|
+
pa2(co, 'b r % % % %',
|
1322
|
+
opt.x, opt.y,
|
1323
|
+
opt.width, opt.height
|
1324
|
+
);
|
1325
|
+
|
1326
|
+
if (opt.stroke) {
|
1327
|
+
co.strokeStyle = opt.stroke;
|
1328
|
+
co.stroke();
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
if (opt.fill) {
|
1332
|
+
co.fillStyle = opt.fill;
|
1333
|
+
co.fill();
|
1334
|
+
}
|
1335
|
+
}
|
1336
|
+
|
1337
|
+
|
1338
|
+
|
1339
|
+
|
1212
1340
|
/**
|
1213
1341
|
* This function runs once only
|
1214
1342
|
* (put at the end of the file (before any effects))
|