rgraph-rails 1.0.8 → 4.62
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/javascripts/RGraph.bar.js +16 -8
- data/vendor/assets/javascripts/RGraph.bipolar.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.annotate.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.context.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.core.js +84 -7
- data/vendor/assets/javascripts/RGraph.common.csv.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.effects.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.key.js +3 -3
- data/vendor/assets/javascripts/RGraph.common.resizing.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.sheets.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +1 -1
- data/vendor/assets/javascripts/RGraph.common.zoom.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.background.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.image.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.text.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +1 -1
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +1 -1
- data/vendor/assets/javascripts/RGraph.fuel.js +1 -1
- data/vendor/assets/javascripts/RGraph.funnel.js +1 -1
- data/vendor/assets/javascripts/RGraph.gantt.js +1 -1
- data/vendor/assets/javascripts/RGraph.gauge.js +1 -1
- data/vendor/assets/javascripts/RGraph.hbar.js +228 -2
- data/vendor/assets/javascripts/RGraph.hprogress.js +1 -1
- data/vendor/assets/javascripts/RGraph.line.js +27 -5
- data/vendor/assets/javascripts/RGraph.meter.js +1 -1
- data/vendor/assets/javascripts/RGraph.modaldialog.js +1 -1
- data/vendor/assets/javascripts/RGraph.odo.js +1 -1
- data/vendor/assets/javascripts/RGraph.pie.js +1 -1
- data/vendor/assets/javascripts/RGraph.radar.js +1 -1
- data/vendor/assets/javascripts/RGraph.rose.js +1 -1
- data/vendor/assets/javascripts/RGraph.rscatter.js +1 -1
- data/vendor/assets/javascripts/RGraph.scatter.js +161 -34
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.bar.js +772 -103
- data/vendor/assets/javascripts/RGraph.svg.common.ajax.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.common.core.js +806 -231
- data/vendor/assets/javascripts/RGraph.svg.common.csv.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.common.fx.js +24 -24
- data/vendor/assets/javascripts/RGraph.svg.common.key.js +206 -0
- data/vendor/assets/javascripts/RGraph.svg.common.sheets.js +1 -1
- data/vendor/assets/javascripts/RGraph.svg.common.tooltips.js +63 -22
- data/vendor/assets/javascripts/RGraph.svg.hbar.js +351 -91
- data/vendor/assets/javascripts/RGraph.svg.line.js +159 -64
- data/vendor/assets/javascripts/RGraph.svg.pie.js +402 -51
- data/vendor/assets/javascripts/RGraph.svg.radar.js +320 -143
- data/vendor/assets/javascripts/RGraph.svg.rose.js +1818 -0
- data/vendor/assets/javascripts/RGraph.svg.scatter.js +1262 -0
- data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +106 -57
- data/vendor/assets/javascripts/RGraph.svg.waterfall.js +1253 -0
- data/vendor/assets/javascripts/RGraph.thermometer.js +7 -6
- data/vendor/assets/javascripts/RGraph.vprogress.js +1 -1
- data/vendor/assets/javascripts/RGraph.waterfall.js +1 -1
- data/vendor/assets/javascripts/financial-data.js +1067 -0
- metadata +8 -5
- data/vendor/assets/javascripts/RGraph.cornergauge.js +0 -71
- data/vendor/assets/javascripts/RGraph.thermometer.old.js +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5471b9fdc42af6ff337cbb054d17d429988f0a70
|
4
|
+
data.tar.gz: e5f810be4ea5a6e12694e4bc1ea94d1db02ddec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9891ca07216930af157c217f7c9ec9a28c27494e89a0128988b065d884247844cd49bea5349c950d5656120dc3eebb10281c6d7f8155371f7cdc47a78605ca52
|
7
|
+
data.tar.gz: b2dcef340aadc3e9e128b1365cbe1cf7f855551f1e985b6866e6d6e8c8222fa27b576c6eee24ac0860b44fb800e23f9a547cdbc9d181e8c494dd4fc90b014a72
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/dsgriffin/rgraph-rails.svg?branch=master)](https://travis-ci.org/dsgriffin/rgraph-rails)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/rgraph-rails.svg)](https://badge.fury.io/rb/rgraph-rails)
|
5
|
-
![](https://img.shields.io/badge/rgraph-4.
|
5
|
+
![](https://img.shields.io/badge/rgraph-4.62-red.svg)
|
6
6
|
|
7
7
|
Use the [rgraph](http://www.rgraph.net/) chart/graph library with the Rails asset pipeline.
|
8
8
|
|
@@ -11,7 +11,7 @@ Use the [rgraph](http://www.rgraph.net/) chart/graph library with the Rails asse
|
|
11
11
|
Include the gem in your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'rgraph-rails', '~>
|
14
|
+
gem 'rgraph-rails', '~> 4.62'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -65,7 +65,7 @@ Automatically on tagged release to master. Reading: https://docs.travis-ci.com/u
|
|
65
65
|
|
66
66
|
## Versioning
|
67
67
|
|
68
|
-
rgraph itself doesn't use semantic versioning - you can find out about breaking changes by release on the [Backwards Compatibility section on the official site](http://www.rgraph.net/docs/backwards-compatibility.html).
|
68
|
+
rgraph itself doesn't use semantic versioning (and therefore neither does this gem; it keeps the same version as it's less confusing) - you can find out about breaking changes by release on the [Backwards Compatibility section on the official site](http://www.rgraph.net/docs/backwards-compatibility.html).
|
69
69
|
|
70
70
|
## Issues
|
71
71
|
|
data/lib/rgraph-rails/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2017-
|
1
|
+
// version: 2017-05-08
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -97,7 +97,7 @@
|
|
97
97
|
'chart.axis.color': 'black',
|
98
98
|
'chart.axis.linewidth': 1,
|
99
99
|
'chart.gutter.top': 25,
|
100
|
-
'chart.gutter.bottom':
|
100
|
+
'chart.gutter.bottom': 35,
|
101
101
|
'chart.gutter.left': 25,
|
102
102
|
'chart.gutter.right': 25,
|
103
103
|
'chart.labels': null,
|
@@ -613,6 +613,14 @@
|
|
613
613
|
if (prop['chart.labels.ingraph']) {
|
614
614
|
RG.DrawInGraphLabels(this);
|
615
615
|
}
|
616
|
+
|
617
|
+
|
618
|
+
//
|
619
|
+
// Add the attribution (if textAccessible is enabled
|
620
|
+
//
|
621
|
+
//RG.attribution(this);
|
622
|
+
|
623
|
+
|
616
624
|
|
617
625
|
|
618
626
|
/**
|
@@ -3721,13 +3729,13 @@ co.lineTo(
|
|
3721
3729
|
for (var i=0; i<this.objects.length; ++i) {
|
3722
3730
|
if (this.objects[i].properties['chart.combinedchart.effect']) {
|
3723
3731
|
|
3724
|
-
|
3732
|
+
// The options must be given as a string because of the
|
3733
|
+
// RGraph configuration system
|
3734
|
+
var options = this.objects[i].properties['chart.combinedchart.effect.options'] ? eval('(' + this.objects[i].properties['chart.combinedchart.effect.options'] + ')') : null,
|
3735
|
+
callback = this.objects[i].properties['chart.combinedchart.effect.callback'],
|
3736
|
+
func = this.objects[i].properties['chart.combinedchart.effect'];
|
3725
3737
|
|
3726
|
-
(this.objects[i][
|
3727
|
-
(
|
3728
|
-
options,
|
3729
|
-
this.objects[i].properties['chart.combinedchart.effect.callback']
|
3730
|
-
)
|
3738
|
+
(this.objects[i][func])(options, callback);
|
3731
3739
|
} else {
|
3732
3740
|
this.objects[i].draw();
|
3733
3741
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
// version: 2017-
|
1
|
+
// version: 2017-05-08
|
2
|
+
/**
|
2
3
|
/**
|
3
4
|
* o--------------------------------------------------------------------------------o
|
4
5
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -3718,19 +3719,29 @@
|
|
3718
3719
|
// clearing to that canvas.
|
3719
3720
|
RG.text2.domNodeCache.reset = function ()
|
3720
3721
|
{
|
3722
|
+
|
3721
3723
|
// Limit the clearing to a single canvas tag
|
3722
3724
|
if (arguments[0]) {
|
3723
|
-
|
3724
|
-
|
3725
|
+
|
3726
|
+
if (typeof arguments[0] === 'string') {
|
3727
|
+
var ca = document.getElementById(arguments[0])
|
3728
|
+
} else {
|
3729
|
+
var ca = arguments[0];
|
3730
|
+
}
|
3731
|
+
|
3732
|
+
var nodes = RG.text2.domNodeCache[ca.id];
|
3725
3733
|
|
3726
3734
|
for (j in nodes) {
|
3727
3735
|
|
3728
|
-
var node = RG.text2.domNodeCache[
|
3736
|
+
var node = RG.text2.domNodeCache[ca.id][j];
|
3729
3737
|
|
3730
3738
|
if (node && node.parentNode) {
|
3731
3739
|
node.parentNode.removeChild(node);
|
3732
3740
|
}
|
3733
3741
|
}
|
3742
|
+
|
3743
|
+
RG.text2.domNodeCache[ca.id] = [];
|
3744
|
+
RG.text2.domNodeDimensionCache[ca.id] = [];
|
3734
3745
|
|
3735
3746
|
// Clear all DOM text from all tags
|
3736
3747
|
} else {
|
@@ -3741,6 +3752,9 @@
|
|
3741
3752
|
}
|
3742
3753
|
}
|
3743
3754
|
}
|
3755
|
+
|
3756
|
+
RG.text2.domNodeCache = [];
|
3757
|
+
RG.text2.domNodeDimensionCache = [];
|
3744
3758
|
}
|
3745
3759
|
};
|
3746
3760
|
|
@@ -4710,7 +4724,7 @@
|
|
4710
4724
|
|
4711
4725
|
|
4712
4726
|
/**
|
4713
|
-
* Generates logs for...
|
4727
|
+
* Generates logs for... log charts
|
4714
4728
|
*
|
4715
4729
|
* @param number n The number to generate the log for
|
4716
4730
|
* @param number base The base to use
|
@@ -4849,10 +4863,73 @@
|
|
4849
4863
|
|
4850
4864
|
|
4851
4865
|
|
4866
|
+
|
4867
|
+
|
4868
|
+
|
4869
|
+
|
4852
4870
|
/**
|
4853
|
-
*
|
4871
|
+
* Put the attribution on the canvas IF textAccessible is enabled.
|
4872
|
+
* By default it adds the attribution in the bottom right corner.
|
4873
|
+
*
|
4874
|
+
* @param object obj The chart object
|
4854
4875
|
*/
|
4855
|
-
RG.att =
|
4876
|
+
RG.att =
|
4877
|
+
RG.attribution = function (obj)
|
4878
|
+
{
|
4879
|
+
var ca = obj.canvas,
|
4880
|
+
co = obj.context,
|
4881
|
+
prop = obj.properties;
|
4882
|
+
|
4883
|
+
if (!ca || !co) {
|
4884
|
+
return;
|
4885
|
+
}
|
4886
|
+
|
4887
|
+
// Needs to be a new var... statement here
|
4888
|
+
var width = ca.width,
|
4889
|
+
height = ca.height,
|
4890
|
+
wrapper = document.getElementById('cvs').__object__.canvas.parentNode,
|
4891
|
+
text = prop['chart.attribution.text'] || 'Free Charts with RGraph.net',
|
4892
|
+
x = prop['chart.attribution.x'], // null
|
4893
|
+
y = prop['chart.attribution.y'], // null
|
4894
|
+
bold = prop['chart.attribution.bold'], // false
|
4895
|
+
italic = prop['chart.attribution.italic'], // true
|
4896
|
+
font = prop['chart.attribution.font'] || 'sans-serif', // sans-serif
|
4897
|
+
size = prop['chart.attribution.size'] || 8, // 8
|
4898
|
+
underline = prop['chart.attribution.underline'] ? 'underline' : 'none', // false
|
4899
|
+
color = typeof prop['chart.attribution.color'] === 'string' ? prop['chart.attribution.color'] : '',
|
4900
|
+
href = typeof prop['chart.attribution.href'] === 'string' ? prop['chart.attribution.href'] : 'http://www.rgraph.net/canvas/index.html';
|
4901
|
+
|
4902
|
+
if (wrapper.attribution_node) {
|
4903
|
+
return;
|
4904
|
+
}
|
4905
|
+
|
4906
|
+
|
4907
|
+
// Take some measurements
|
4908
|
+
var measurements = RG.measureText(text, bold, font, size);
|
4909
|
+
|
4910
|
+
// Create the link
|
4911
|
+
var a = document.createElement('A');
|
4912
|
+
a.href = href;
|
4913
|
+
a.innerHTML = text;
|
4914
|
+
a.target = '_blank';
|
4915
|
+
a.style.position = 'absolute';
|
4916
|
+
a.style.left = typeof x === 'number' ? x : wrapper.offsetWidth - measurements[0] - 5 + 'px';
|
4917
|
+
a.style.top = typeof y === 'number' ? y : wrapper.offsetHeight - measurements[1] + 'px';
|
4918
|
+
a.style.fontSize = size + 'pt';
|
4919
|
+
a.style.fontStyle = typeof italic === 'boolean' ? (italic ? 'italic' : '') : 'italic',
|
4920
|
+
a.style.fontWeight = bold ? 'bold' : '',
|
4921
|
+
a.style.textDecoration = underline;
|
4922
|
+
a.style.fontFamily = font;
|
4923
|
+
a.style.color = color;
|
4924
|
+
wrapper.appendChild(a);
|
4925
|
+
|
4926
|
+
wrapper.attribution_node = a;
|
4927
|
+
};
|
4928
|
+
|
4929
|
+
|
4930
|
+
|
4931
|
+
|
4932
|
+
|
4856
4933
|
|
4857
4934
|
|
4858
4935
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2017-
|
1
|
+
// version: 2017-05-08
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -716,7 +716,7 @@
|
|
716
716
|
}
|
717
717
|
|
718
718
|
return style;
|
719
|
-
})() + 'display: inline-block; margin-right: 5px; margin-top: 4px; width: 15px; height: 15px; background-color: ' + prop.colors[i] + '"' + (prop.blobClass ? 'class="' + prop.blobClass + '"' : '') + '> </div><td>' + (prop.links && prop.links[i] ? '<a href="' + prop.links[i] + '">' : '') + '<span ' + (prop.labelClass ? 'class="' + prop.labelClass + '"' : '') + '" ' + (function ()
|
719
|
+
})() + 'display: inline-block; margin-right: 5px; margin-top: 4px; width: 15px; height: 15px; background-color: ' + prop.colors[i] + '"' + (prop.blobClass ? 'class="' + prop.blobClass + '"' : '') + '> </div><td>' + (prop.links && prop.links[i] ? '<a href="' + prop.links[i] + '">' : '') + '<span ' + (prop.labelClass ? 'class="' + prop.labelClass + '"' : '') + '" style="' + (function ()
|
720
720
|
{
|
721
721
|
var style = '';
|
722
722
|
|
@@ -727,7 +727,7 @@
|
|
727
727
|
}
|
728
728
|
|
729
729
|
return style;
|
730
|
-
})() + (function ()
|
730
|
+
})() + '" ' + (function ()
|
731
731
|
{
|
732
732
|
var style = '';
|
733
733
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// version: 2017-
|
1
|
+
// version: 2017-05-08
|
2
2
|
/**
|
3
3
|
* o--------------------------------------------------------------------------------o
|
4
4
|
* | This file is part of the RGraph package - you can learn more at: |
|
@@ -2360,7 +2360,7 @@
|
|
2360
2360
|
obj.original_data = RG.arrayClone(obj.data);
|
2361
2361
|
|
2362
2362
|
|
2363
|
-
// Stop the scale from changing by setting chart.
|
2363
|
+
// Stop the scale from changing by setting chart.xmax (if it's not already set)
|
2364
2364
|
if (prop['chart.xmax'] == 0) {
|
2365
2365
|
|
2366
2366
|
var xmax = 0;
|
@@ -2422,6 +2422,232 @@
|
|
2422
2422
|
|
2423
2423
|
|
2424
2424
|
|
2425
|
+
|
2426
|
+
|
2427
|
+
|
2428
|
+
|
2429
|
+
/**
|
2430
|
+
* Grow
|
2431
|
+
*
|
2432
|
+
* The HBar chart Grow effect gradually increases the values of the bars
|
2433
|
+
*
|
2434
|
+
* @param object An object of options - eg: {frames: 30}
|
2435
|
+
* @param function A function to call when the effect is complete
|
2436
|
+
*/
|
2437
|
+
this.grow = function ()
|
2438
|
+
{
|
2439
|
+
// Callback
|
2440
|
+
var opt = arguments[0] || {},
|
2441
|
+
frames = opt.frames || 30,
|
2442
|
+
frame = 0,
|
2443
|
+
callback = arguments[1] || function () {},
|
2444
|
+
obj = this,
|
2445
|
+
labelsAbove = this.get('labelsAbove')
|
2446
|
+
|
2447
|
+
|
2448
|
+
|
2449
|
+
|
2450
|
+
this.original_data = RG.arrayClone(this.data);
|
2451
|
+
|
2452
|
+
|
2453
|
+
|
2454
|
+
// Stop the scale from changing by setting chart.xmax (if it's not already set)
|
2455
|
+
if (prop['chart.xmax'] == 0) {
|
2456
|
+
|
2457
|
+
var xmax = 0;
|
2458
|
+
|
2459
|
+
for (var i=0; i<obj.data.length; ++i) {
|
2460
|
+
if (RG.isArray(obj.data[i]) && prop['chart.grouping'] == 'stacked') {
|
2461
|
+
xmax = ma.max(xmax, RG.arraySum(obj.data[i]));
|
2462
|
+
} else if (RG.isArray(obj.data[i]) && prop['chart.grouping'] == 'grouped') {
|
2463
|
+
xmax = ma.max(xmax, RG.arrayMax(obj.data[i]));
|
2464
|
+
} else {
|
2465
|
+
xmax = ma.max(xmax, ma.abs(RG.arrayMax(obj.data[i])));
|
2466
|
+
}
|
2467
|
+
}
|
2468
|
+
|
2469
|
+
var scale2 = RG.getScale2(obj, {'max':xmax});
|
2470
|
+
obj.Set('chart.xmax', scale2.max);
|
2471
|
+
}
|
2472
|
+
|
2473
|
+
|
2474
|
+
// Go through the data and change string arguments of the format +/-[0-9]
|
2475
|
+
// to absolute numbers
|
2476
|
+
if (RG.isArray(opt.data)) {
|
2477
|
+
|
2478
|
+
var xmax = 0;
|
2479
|
+
|
2480
|
+
for (var i=0; i<opt.data.length; ++i) {
|
2481
|
+
if (typeof opt.data[i] === 'object') {
|
2482
|
+
for (var j=0; j<opt.data[i].length; ++j) {
|
2483
|
+
if (typeof opt.data[i][j] === 'string'&& opt.data[i][j].match(/(\+|\-)([0-9]+)/)) {
|
2484
|
+
if (RegExp.$1 === '+') {
|
2485
|
+
opt.data[i][j] = this.original_data[i][j] + parseInt(RegExp.$2);
|
2486
|
+
} else {
|
2487
|
+
opt.data[i][j] = this.original_data[i][j] - parseInt(RegExp.$2);
|
2488
|
+
}
|
2489
|
+
}
|
2490
|
+
|
2491
|
+
xmax = ma.max(xmax, opt.data[i][j]);
|
2492
|
+
}
|
2493
|
+
} else if (typeof opt.data[i] === 'string' && opt.data[i].match(/(\+|\-)([0-9]+)/)) {
|
2494
|
+
if (RegExp.$1 === '+') {
|
2495
|
+
opt.data[i] = this.original_data[i] + parseFloat(RegExp.$2);
|
2496
|
+
} else {
|
2497
|
+
opt.data[i] = this.original_data[i] - parseFloat(RegExp.$2);
|
2498
|
+
}
|
2499
|
+
|
2500
|
+
xmax = ma.max(xmax, opt.data[i]);
|
2501
|
+
} else {
|
2502
|
+
xmax = ma.max(xmax, opt.data[i]);
|
2503
|
+
}
|
2504
|
+
}
|
2505
|
+
|
2506
|
+
|
2507
|
+
var scale = RG.getScale2(this, {'max':xmax});
|
2508
|
+
if (typeof this.get('chart.xmax') === 'null') {
|
2509
|
+
this.set('chart.xmax', scale.max);
|
2510
|
+
}
|
2511
|
+
}
|
2512
|
+
|
2513
|
+
|
2514
|
+
|
2515
|
+
|
2516
|
+
|
2517
|
+
|
2518
|
+
//
|
2519
|
+
// turn off the labelsAbove option whilst animating
|
2520
|
+
//
|
2521
|
+
this.set('labelsAbove', false);
|
2522
|
+
|
2523
|
+
|
2524
|
+
|
2525
|
+
|
2526
|
+
|
2527
|
+
|
2528
|
+
// Stop the scale from changing by setting chart.xmax (if it's not already set)
|
2529
|
+
if (RG.isNull(prop['chart.xmax'])) {
|
2530
|
+
|
2531
|
+
var xmax = 0;
|
2532
|
+
|
2533
|
+
for (var i=0; i<obj.data.length; ++i) {
|
2534
|
+
if (RG.isArray(this.data[i]) && prop['chart.grouping'] === 'stacked') {
|
2535
|
+
xmax = ma.max(xmax, ma.abs(RG.arraySum(this.data[i])));
|
2536
|
+
|
2537
|
+
} else if (RG.isArray(this.data[i]) && prop['chart.grouping'] === 'grouped') {
|
2538
|
+
|
2539
|
+
for (var j=0,group=[]; j<this.data[i].length; j++) {
|
2540
|
+
group.push(ma.abs(this.data[i][j]));
|
2541
|
+
}
|
2542
|
+
|
2543
|
+
xmax = ma.max(xmax, ma.abs(RG.arrayMax(group)));
|
2544
|
+
|
2545
|
+
} else {
|
2546
|
+
xmax = ma.max(xmax, ma.abs(this.data[i]));
|
2547
|
+
}
|
2548
|
+
}
|
2549
|
+
|
2550
|
+
var scale = RG.getScale2(this, {'max':xmax});
|
2551
|
+
this.Set('chart.xmax', scale.max);
|
2552
|
+
}
|
2553
|
+
|
2554
|
+
// You can give an xmax to the grow function
|
2555
|
+
if (typeof opt.xmax === 'number') {
|
2556
|
+
obj.set('xmax', opt.xmax);
|
2557
|
+
}
|
2558
|
+
|
2559
|
+
|
2560
|
+
|
2561
|
+
var iterator = function ()
|
2562
|
+
{
|
2563
|
+
var easingMultiplier = RG.Effects.getEasingMultiplier(frames, frame);
|
2564
|
+
|
2565
|
+
// Alter the Bar chart data depending on the frame
|
2566
|
+
for (var j=0,len=obj.original_data.length; j<len; ++j) {
|
2567
|
+
if (typeof obj.data[j] === 'object' && !RG.isNull(obj.data[j])) {
|
2568
|
+
for (var k=0,len2=obj.data[j].length; k<len2; ++k) {
|
2569
|
+
if (obj.firstDraw || !opt.data) {
|
2570
|
+
obj.data[j][k] = easingMultiplier * obj.original_data[j][k];
|
2571
|
+
} else if (opt.data && opt.data.length === obj.original_data.length) {
|
2572
|
+
var diff = opt.data[j][k] - obj.original_data[j][k];
|
2573
|
+
obj.data[j][k] = (easingMultiplier * diff) + obj.original_data[j][k];
|
2574
|
+
}
|
2575
|
+
}
|
2576
|
+
} else {
|
2577
|
+
|
2578
|
+
if (obj.firstDraw || !opt.data) {
|
2579
|
+
obj.data[j] = easingMultiplier * obj.original_data[j];
|
2580
|
+
} else if (opt.data && opt.data.length === obj.original_data.length) {
|
2581
|
+
var diff = opt.data[j] - obj.original_data[j];
|
2582
|
+
obj.data[j] = (easingMultiplier * diff) + obj.original_data[j];
|
2583
|
+
}
|
2584
|
+
}
|
2585
|
+
}
|
2586
|
+
|
2587
|
+
|
2588
|
+
|
2589
|
+
|
2590
|
+
//RGraph.clear(obj.canvas);
|
2591
|
+
RG.redrawCanvas(obj.canvas);
|
2592
|
+
|
2593
|
+
|
2594
|
+
|
2595
|
+
|
2596
|
+
if (frame < frames) {
|
2597
|
+
frame += 1;
|
2598
|
+
|
2599
|
+
RG.Effects.updateCanvas(iterator);
|
2600
|
+
|
2601
|
+
// Call the callback function
|
2602
|
+
} else {
|
2603
|
+
|
2604
|
+
|
2605
|
+
|
2606
|
+
|
2607
|
+
|
2608
|
+
// Do some housekeeping if new data was specified thats done in
|
2609
|
+
// the constructor - but needs to be redone because new data
|
2610
|
+
// has been specified
|
2611
|
+
if (RG.isArray(opt.data)) {
|
2612
|
+
|
2613
|
+
var linear_data = RG.arrayLinearize(data);
|
2614
|
+
|
2615
|
+
for (var i=0; i<linear_data.length; ++i) {
|
2616
|
+
if (!obj['$' + i]) {
|
2617
|
+
obj['$' + i] = {};
|
2618
|
+
}
|
2619
|
+
}
|
2620
|
+
}
|
2621
|
+
|
2622
|
+
|
2623
|
+
|
2624
|
+
obj.data = data;
|
2625
|
+
obj.original_data = RG.arrayClone(data);
|
2626
|
+
|
2627
|
+
|
2628
|
+
|
2629
|
+
|
2630
|
+
|
2631
|
+
if (labelsAbove) {
|
2632
|
+
obj.set('labelsAbove', true);
|
2633
|
+
RG.redraw();
|
2634
|
+
}
|
2635
|
+
callback(obj);
|
2636
|
+
}
|
2637
|
+
};
|
2638
|
+
|
2639
|
+
iterator();
|
2640
|
+
|
2641
|
+
return this;
|
2642
|
+
};
|
2643
|
+
|
2644
|
+
|
2645
|
+
|
2646
|
+
|
2647
|
+
|
2648
|
+
|
2649
|
+
|
2650
|
+
|
2425
2651
|
/**
|
2426
2652
|
* (new) Bar chart Wave effect. This is a rewrite that should be smoother
|
2427
2653
|
* because it just uses a single loop and not setTimeout
|