rgraph-rails 4.67 → 5.00
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/license.txt +1 -1
- data/vendor/assets/javascripts/RGraph.bar.js +101 -105
- data/vendor/assets/javascripts/RGraph.bipolar.js +61 -64
- data/vendor/assets/javascripts/RGraph.common.annotate.js +15 -15
- data/vendor/assets/javascripts/RGraph.common.context.js +10 -10
- data/vendor/assets/javascripts/RGraph.common.core.js +104 -103
- data/vendor/assets/javascripts/RGraph.common.csv.js +12 -5
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +2 -3
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +17 -17
- data/vendor/assets/javascripts/RGraph.common.effects.js +2 -3
- data/vendor/assets/javascripts/RGraph.common.key.js +14 -13
- data/vendor/assets/javascripts/RGraph.common.resizing.js +4 -4
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +8 -8
- data/vendor/assets/javascripts/RGraph.drawing.background.js +8 -7
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +6 -5
- data/vendor/assets/javascripts/RGraph.drawing.image.js +8 -7
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +6 -5
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +8 -7
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +6 -5
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +6 -5
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +6 -5
- data/vendor/assets/javascripts/RGraph.drawing.text.js +8 -7
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +24 -22
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +22 -22
- data/vendor/assets/javascripts/RGraph.fuel.js +20 -19
- data/vendor/assets/javascripts/RGraph.funnel.js +19 -18
- data/vendor/assets/javascripts/RGraph.gantt.js +45 -40
- data/vendor/assets/javascripts/RGraph.gauge.js +30 -26
- data/vendor/assets/javascripts/RGraph.hbar.js +79 -82
- data/vendor/assets/javascripts/RGraph.hprogress.js +32 -31
- data/vendor/assets/javascripts/RGraph.line.js +117 -122
- data/vendor/assets/javascripts/RGraph.meter.js +27 -22
- data/vendor/assets/javascripts/RGraph.odo.js +26 -29
- data/vendor/assets/javascripts/RGraph.pie.js +46 -54
- data/vendor/assets/javascripts/RGraph.radar.js +34 -36
- data/vendor/assets/javascripts/RGraph.rose.js +43 -37
- data/vendor/assets/javascripts/RGraph.rscatter.js +26 -26
- data/vendor/assets/javascripts/RGraph.scatter.js +73 -74
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +15 -16
- data/vendor/assets/javascripts/RGraph.svg.bar.js +18 -16
- data/vendor/assets/javascripts/RGraph.svg.bipolar.js +48 -45
- data/vendor/assets/javascripts/RGraph.svg.common.core.js +57 -54
- data/vendor/assets/javascripts/RGraph.svg.common.csv.js +10 -2
- data/vendor/assets/javascripts/RGraph.svg.common.key.js +5 -5
- data/vendor/assets/javascripts/RGraph.svg.funnel.js +8 -7
- data/vendor/assets/javascripts/RGraph.svg.gauge.js +13 -11
- data/vendor/assets/javascripts/RGraph.svg.hbar.js +24 -21
- data/vendor/assets/javascripts/RGraph.svg.line.js +22 -20
- data/vendor/assets/javascripts/RGraph.svg.pie.js +10 -9
- data/vendor/assets/javascripts/RGraph.svg.radar.js +8 -7
- data/vendor/assets/javascripts/RGraph.svg.rose.js +37 -20
- data/vendor/assets/javascripts/RGraph.svg.scatter.js +18 -17
- data/vendor/assets/javascripts/RGraph.svg.semicircularprogress.js +10 -9
- data/vendor/assets/javascripts/RGraph.svg.waterfall.js +16 -14
- data/vendor/assets/javascripts/RGraph.thermometer.js +12 -11
- data/vendor/assets/javascripts/RGraph.vprogress.js +29 -31
- data/vendor/assets/javascripts/RGraph.waterfall.js +44 -38
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8effdfda1dce3edb9f030557f6ad79473f273ec32952d1324b8a3592c9d48b
|
4
|
+
data.tar.gz: 9e9f8b86800d0bf0fc7cbb9b8afcb14c59335e07ae402956594c32c0d0c1d9e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec100cfacd606df556b3983ac3b785b091d086eb298ee5ad505d6c09cfa215844dfe6c00e03fd5b19ded72ed2e61d7d082d1535fd84caf4001e11899098045d6
|
7
|
+
data.tar.gz: c870f8a07c1db8b5278b7c17187f7e7cb461d7b870760c280fba169002bad95cff67b1ddd81cca3a57af922860e06cf5bd14cebc69b05e6ed2a2ff0caf53052b
|
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-
|
5
|
+
![](https://img.shields.io/badge/rgraph-5.00-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', '~> 5.00'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -67,7 +67,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
|
|
67
67
|
|
68
68
|
## Versioning
|
69
69
|
|
70
|
-
rgraph itself doesn't use semantic versioning (and therefore neither does this gem; it keeps the same version as it's less confusing) -
|
70
|
+
rgraph itself doesn't use semantic versioning (and therefore neither does this gem; it keeps the same version as the library so that 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).
|
71
71
|
|
72
72
|
## Issues
|
73
73
|
|
data/lib/rgraph-rails/version.rb
CHANGED
data/license.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2019 Daniel Griffin
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
4
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Bar=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.data==='object'&&typeof conf.id==='string'){var id=conf.id,canvas=document.getElementById(id),data=conf.data,parseConfObjectForOptions=true}else{var id=conf,canvas=document.getElementById(id),data=arguments[1]}
|
4
|
-
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.type='bar';this.max=0;this.stackedOrGrouped=false;this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.original_colors=[];this.cachedBackgroundCanvas=null;this.firstDraw=true;this.properties={'chart.background.
|
4
|
+
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.type='bar';this.max=0;this.stackedOrGrouped=false;this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.original_colors=[];this.cachedBackgroundCanvas=null;this.firstDraw=true;this.propertyNameAliases={};this.properties={'chart.background.bars.count':null,'chart.background.bars.color1':'rgba(0,0,0,0)','chart.background.bars.color2':'rgba(0,0,0,0)','chart.background.grid':true,'chart.background.grid.color':'#ddd','chart.background.grid.linewidth':1,'chart.background.grid.hsize':20,'chart.background.grid.vsize':20,'chart.background.grid.vlines':true,'chart.background.grid.hlines':true,'chart.background.grid.border':true,'chart.background.grid.autofit':true,'chart.background.grid.autofit.align':true,'chart.background.grid.hlines.count':5,'chart.background.grid.dashed':false,'chart.background.grid.dotted':false,'chart.background.image':null,'chart.background.image.stretch':true,'chart.background.image.x':null,'chart.background.image.y':null,'chart.background.image.w':null,'chart.background.image.h':null,'chart.background.image.align':null,'chart.background.color':null,'chart.background.hbars':null,'chart.hmargin':5,'chart.hmargin.grouped':1,'chart.axes':true,'chart.axes.color':'black','chart.axes.linewidth':1,'chart.margin.top':35,'chart.margin.bottom':35,'chart.margin.left':35,'chart.margin.right':35,'chart.labels.ingraph':null,'chart.labels.ingraph.font':null,'chart.labels.ingraph.size':null,'chart.labels.ingraph.color':null,'chart.labels.ingraph.bold':null,'chart.labels.ingraph.italic':null,'chart.labels.above':false,'chart.labels.above.decimals':0,'chart.labels.above.size':null,'chart.labels.above.color':null,'chart.labels.above.bold':null,'chart.labels.above.italic':null,'chart.labels.above.font':null,'chart.labels.above.point':'.','chart.labels.above.thousand':',','chart.labels.above.background':'rgba(0,0,0,0)','chart.labels.above.angle':null,'chart.labels.above.offset':4,'chart.labels.above.units.pre':'','chart.labels.above.units.post':'','chart.yaxis':true,'chart.yaxis.tickmarks.count':10,'chart.yaxis.scale.min':0,'chart.yaxis.scale.max':null,'chart.yaxis.scale.units.pre':'','chart.yaxis.scale.units.post':'','chart.yaxis.scale.decimals':0,'chart.yaxis.scale.point':'.','chart.yaxis.scale.thousand':',','chart.yaxis.scale.round':false,'chart.yaxis.scale.zerostart':true,'chart.yaxis.labels':true,'chart.yaxis.labels.count':5,'chart.yaxis.labels.inside':false,'chart.yaxis.labels.offsetx':0,'chart.yaxis.labels.offsety':0,'chart.yaxis.labels.font':null,'chart.yaxis.labels.size':null,'chart.yaxis.labels.color':null,'chart.yaxis.labels.bold':null,'chart.yaxis.labels.italic':null,'chart.yaxis.position':'left','chart.yaxis.title':'','chart.yaxis.title.bold':null,'chart.yaxis.title.size':null,'chart.yaxis.title.font':null,'chart.yaxis.title.color':null,'chart.yaxis.title.italic':null,'chart.yaxis.title.pos':null,'chart.yaxis.title.x':null,'chart.yaxis.title.y':null,'chart.xaxis':true,'chart.xaxis.tickmarks.count':null,'chart.xaxis.labels':null,'chart.xaxis.labels.size':null,'chart.xaxis.labels.font':null,'chart.xaxis.labels.italic':null,'chart.xaxis.labels.bold':null,'chart.xaxis.labels.color':null,'chart.xaxis.labels.offsetx':0,'chart.xaxis.labels.offsety':0,'chart.xaxis.position':'bottom','chart.xaxis.labels.angle':0,'chart.xaxis.title':'','chart.xaxis.title.bold':null,'chart.xaxis.title.size':null,'chart.xaxis.title.font':null,'chart.xaxis.title.color':null,'chart.xaxis.title.italic':null,'chart.xaxis.title.pos':null,'chart.xaxis.title.x':null,'chart.xaxis.title.y':null,'chart.text.italic':false,'chart.text.bold':false,'chart.text.color':'black','chart.text.size':12,'chart.text.font':'Arial, Verdana, sans-serif','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.title':'','chart.title.x':null,'chart.title.y':null,'chart.title.halign':null,'chart.title.valign':null,'chart.title.background':null,'chart.title.hpos':null,'chart.title.vpos':null,'chart.title.font':null,'chart.title.size':null,'chart.title.color':null,'chart.title.bold':null,'chart.title.italic':null,'chart.colors.stroke':'rgba(0,0,0,0)','chart.colors':['red','#0f0','blue','pink','orange','cyan','black','white','green','magenta'],'chart.colors.sequential':false,'chart.colors.reverse':false,'chart.grouping':'grouped','chart.variant':'bar','chart.variant.sketch.verticals':true,'chart.variant.threed.xaxis':true,'chart.variant.threed.yaxis':true,'chart.variant.threed.angle':0.1,'chart.variant.threed.offsetx':10,'chart.variant.threed.offsety':5,'chart.shadow':false,'chart.shadow.color':'#aaa','chart.shadow.offsetx':0,'chart.shadow.offsety':0,'chart.shadow.blur':15,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.tooltips.highlight':true,'chart.tooltips.hotspot.xonly':false,'chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.key':null,'chart.key.background':'white','chart.key.position':'graph','chart.key.shadow':false,'chart.key.shadow.color':'#666','chart.key.shadow.blur':3,'chart.key.shadow.offsetx':2,'chart.key.shadow.offsety':2,'chart.key.position.margin.boxed':false,'chart.key.position.x':null,'chart.key.position.y':null,'chart.key.interactive':false,'chart.key.interactive.highlight.chart.stroke':'black','chart.key.interactive.highlight.chart.fill':'rgba(255,255,255,0.7)','chart.key.interactive.highlight.label':'rgba(255,0,0,0.2)','chart.key.halign':'right','chart.key.color.shape':'square','chart.key.rounded':true,'chart.key.linewidth':1,'chart.key.colors':null,'chart.key.labels.color':null,'chart.key.labels.size':null,'chart.key.labels.font':null,'chart.key.labels.bold':null,'chart.key.labels.italic':null,'chart.key.labels.offsetx':0,'chart.key.labels.offsety':0,'chart.contextmenu':null,'chart.crosshairs':false,'chart.crosshairs.color':'#333','chart.crosshairs.hline':true,'chart.crosshairs.vline':true,'chart.linewidth':1,'chart.annotatable':false,'chart.annotatable.linewidth':1,'chart.annotatable.color':'black','chart.resizable':false,'chart.resizable.handle.background':null,'chart.adjustable':false,'chart.adjustable.only':null,'chart.events.click':null,'chart.events.mousemove':null,'chart.bevelled':false,'chart.errorbars':false,'chart.errorbars.color':'black','chart.errorbars.capped':true,'chart.errorbars.capped.width':14,'chart.errorbars.linewidth':1,'chart.combined.effect':null,'chart.combined.effect.options':null,'chart.combined.effect.callback':null,'chart.clearto':'rgba(0,0,0,0)'}
|
5
5
|
if(!this.canvas){alert('[BAR] No canvas support');return;}
|
6
6
|
for(var i=0;i<data.length;++i){if(typeof data[i]==='string'){data[i]=parseFloat(data[i]);}else if(typeof data[i]==='object'&&data[i]){for(var j=0;j<data[i].length;++j){if(typeof data[i][j]==='string'){data[i][j]=parseFloat(data[i][j]);}}}else if(typeof data[i]==='undefined'){data[i]=null;}}
|
7
7
|
for(var i=0;i<data.length;++i){if(typeof data[i]==='object'&&!RGraph.is_null(data[i])){this.stackedOrGrouped=true;}}
|
@@ -13,68 +13,66 @@ this.set=this.Set=function(name)
|
|
13
13
|
{var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof arguments[0]==='object'){RG.parseObjectStyleConfig(this,arguments[0]);return this;}
|
14
14
|
if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
15
15
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
16
|
-
if(name==='chart.xlabels.offset'){name='chart.labels.offsety';}
|
16
|
+
if(name==='chart.xlabels.offset'){name='chart.xaxis.labels.offsety';}
|
17
17
|
if(name=='chart.labels.abovebar'){name='chart.labels.above';}
|
18
|
-
if(name=='chart.
|
19
|
-
if(
|
20
|
-
if(value=='top'){for(var i=0;i<this.data.length;++i){if(typeof(this.data[i])=='number'&&this.data[i]>0){alert('[BAR] The data element with index '+i+' should be negative');}}}}
|
18
|
+
if(name=='chart.xaxis.position'){if(value!='bottom'&&value!='center'&&value!='top'){alert('[BAR] ('+this.id+') xaxisPosition should be top, center or bottom. Tried to set it to: '+value+' Changing it to center');value='center';}
|
19
|
+
if(value=='top'){for(var i=0;i<this.data.length;++i){if(typeof this.data[i]==='number'&&this.data[i]>0){alert('[BAR] The data element with index '+i+' should be negative');}}}}
|
21
20
|
if(name.toLowerCase()=='chart.linewidth'&&value==0){value=0.0001;}
|
22
21
|
prop[name]=value;return this;};this.get=this.Get=function(name)
|
23
22
|
{if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
24
23
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
25
24
|
return prop[name];};this.draw=this.Draw=function()
|
26
25
|
{if(typeof(prop['chart.background.image'])=='string'){RG.DrawBackgroundImage(this);}
|
27
|
-
RG.
|
26
|
+
RG.fireCustomEvent(this,'onbeforedraw');if(prop['chart.variant']==='3d'){if(prop['chart.text.accessible']){}else{co.setTransform(1,prop['chart.variant.threed.angle'],0,1,0.5,0.5);}}
|
28
27
|
if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
29
|
-
this.
|
30
|
-
this.coords=[];this.coords2=[];this.coordsText=[];this.max=0;this.grapharea=ca.height-this.
|
31
|
-
if(prop['chart.key']&&prop['chart.key'].length){RG.
|
28
|
+
this.marginLeft=prop['chart.margin.left'];this.marginRight=prop['chart.margin.right'];this.marginTop=prop['chart.margin.top'];this.marginBottom=prop['chart.margin.bottom'];this.marginLeft=prop['chart.margin.left'];this.marginRight=prop['chart.margin.right'];this.marginTop=prop['chart.margin.top'];this.marginBottom=prop['chart.margin.bottom'];if((prop['chart.variant']=='pyramid'||prop['chart.variant']=='dot')&&typeof(prop['chart.tooltips'])=='object'&&prop['chart.tooltips']&&prop['chart.tooltips'].length>0){alert('[BAR] ('+this.id+') Sorry, tooltips are not supported with dot or pyramid charts');}
|
29
|
+
this.coords=[];this.coords2=[];this.coordsText=[];this.max=0;this.grapharea=ca.height-this.marginTop-this.marginBottom;this.halfgrapharea=this.grapharea/2;this.halfTextHeight=prop['chart.text.size']/2;RG.background.draw(this);this.drawbars();this.drawAxes();this.DrawLabels();if(prop['chart.bevelled']||prop['chart.bevelled']){this.DrawBevel();}
|
30
|
+
if(prop['chart.key']&&prop['chart.key'].length){RG.drawKey(this,prop['chart.key'],prop['chart.colors']);}
|
32
31
|
if(prop['chart.contextmenu']){RG.ShowContext(this);}
|
33
32
|
if(prop['chart.errorbars']){this.drawErrorbars();}
|
34
|
-
if(prop['chart.labels.ingraph']){RG.
|
33
|
+
if(prop['chart.labels.ingraph']){RG.drawInGraphLabels(this);}
|
35
34
|
if(prop['chart.resizable']){RG.AllowResizing(this);}
|
36
|
-
RG.
|
35
|
+
RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
37
36
|
RG.fireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
38
37
|
{func(this);return this;};this.drawAxes=this.DrawAxes=function()
|
39
|
-
{if(prop['chart.
|
40
|
-
var xaxispos=prop['chart.
|
41
|
-
if(prop['chart.
|
42
|
-
if(prop['chart.
|
43
|
-
var numYTicks=prop['chart.
|
44
|
-
if(xaxispos=='top'&&y==this.
|
38
|
+
{if(!prop['chart.axes']){return;}
|
39
|
+
var xaxispos=prop['chart.xaxis.position'];var yaxispos=prop['chart.yaxis.position'];var isSketch=prop['chart.variant']=='sketch';co.beginPath();co.strokeStyle=prop['chart.axes.color'];co.lineWidth=prop['chart.axes.linewidth']+0.001;if(RG.ISSAFARI==-1){co.lineCap='square';}
|
40
|
+
if(prop['chart.yaxis']){if(yaxispos=='right'){co.moveTo(ca.width-this.marginRight+(isSketch?3:0),this.marginTop-(isSketch?3:0));co.lineTo(ca.width-this.marginRight-(isSketch?2:0),ca.height-this.marginBottom+(isSketch?5:0));}else{co.moveTo(this.marginLeft-(isSketch?2:0),this.marginTop-(isSketch?5:0));co.lineTo(this.marginLeft-(isSketch?1:0),ca.height-this.marginBottom+(isSketch?5:0));}}
|
41
|
+
if(prop['chart.xaxis']){if(xaxispos=='center'){co.moveTo(this.marginLeft-(isSketch?5:0),Math.round(((ca.height-this.marginTop-this.marginBottom)/2)+this.marginTop+(isSketch?2:0)));co.lineTo(ca.width-this.marginRight+(isSketch?5:0),Math.round(((ca.height-this.marginTop-this.marginBottom)/2)+this.marginTop-(isSketch?2:0)));}else if(xaxispos=='top'){co.moveTo(this.marginLeft-(isSketch?3:0),this.marginTop-(isSketch?3:0));co.lineTo(ca.width-this.marginRight+(isSketch?5:0),this.marginTop+(isSketch?2:0));}else{co.moveTo(this.marginLeft-(isSketch?5:0),ma.round(this.getYCoord(0)-(isSketch?2:0)));co.lineTo(ca.width-this.marginRight+(isSketch?8:0),ma.round(this.getYCoord(0)+(isSketch?2:0)));}}
|
42
|
+
var numYTicks=prop['chart.yaxis.tickmarks.count'];if(prop['chart.yaxis']&&!isSketch){var yTickGap=(ca.height-this.marginTop-this.marginBottom)/numYTicks;var xpos=yaxispos=='left'?this.marginLeft:ca.width-this.marginRight;if(this.properties['chart.yaxis.tickmarks.count']>0){for(y=this.marginTop;xaxispos=='center'?y<=(ca.height-this.marginBottom):y<(ca.height-this.marginBottom+(xaxispos=='top'?1:0));y+=yTickGap){if(xaxispos=='center'&&y==(this.marginTop+(this.grapharea/2))){continue;}
|
43
|
+
if(xaxispos=='top'&&y==this.marginTop){continue;}
|
45
44
|
co.moveTo(xpos+(yaxispos=='left'?0:0),ma.round(y));co.lineTo(xpos+(yaxispos=='left'?-3:3),ma.round(y));}
|
46
|
-
if(xaxispos==='bottom'&&prop['chart.
|
47
|
-
if(prop['chart.
|
48
|
-
if(prop['chart.
|
49
|
-
if(xaxispos=='bottom'){yStart=prop['chart.
|
50
|
-
var
|
51
|
-
if(prop['chart.
|
52
|
-
if(prop['chart.
|
45
|
+
if(xaxispos==='bottom'&&prop['chart.yaxis.scale.min']!==0){co.moveTo(xpos+(yaxispos=='left'?0:0),ma.round(ca.height-prop['chart.margin.bottom']));co.lineTo(xpos+(yaxispos=='left'?-3:3),ma.round(ca.height-prop['chart.margin.bottom']));}}
|
46
|
+
if(!prop['chart.xaxis']){if(xaxispos=='center'){co.moveTo(xpos+(yaxispos=='left'?-3:3),Math.round(ca.height/2));co.lineTo(xpos,Math.round(ca.height/2));}else if(xaxispos=='top'){co.moveTo(xpos+(yaxispos=='left'?-3:3),Math.round(this.marginTop));co.lineTo(xpos,Math.round(this.marginTop));}else{co.moveTo(xpos+(yaxispos=='left'?-3:3),Math.round(ca.height-this.marginBottom));co.lineTo(xpos,Math.round(ca.height-this.marginBottom));}}}
|
47
|
+
if(prop['chart.xaxis']&&!isSketch){if(typeof(prop['chart.xaxis.tickmarks.count'])=='number'){var xTickGap=(ca.width-this.marginLeft-this.marginRight)/prop['chart.xaxis.tickmarks.count'];}else{var xTickGap=(ca.width-this.marginLeft-this.marginRight)/this.data.length;}
|
48
|
+
if(xaxispos=='bottom'){yStart=prop['chart.yaxis.scale.min']<0?this.getYCoord(0)-3:this.getYCoord(0);yEnd=this.getYCoord(0)+3;}else if(xaxispos=='top'){yStart=this.marginTop-3;yEnd=this.marginTop;}else if(xaxispos=='center'){yStart=((ca.height-this.marginTop-this.marginBottom)/2)+this.marginTop+3;yEnd=((ca.height-this.marginTop-this.marginBottom)/2)+this.marginTop-3;}
|
49
|
+
var endXTick=prop['chart.xaxis.tickmarks.last'];for(x=this.marginLeft+(yaxispos=='left'?xTickGap:0),len=(ca.width-this.marginRight+(yaxispos=='left'?5:0));x<len;x+=xTickGap){if(yaxispos=='left'&&endXTick&&x>this.marginLeft){co.moveTo(ma.round(x),yStart);co.lineTo(ma.round(x),yEnd);}else if(yaxispos=='left'&&!endXTick&&x>this.marginLeft&&x<(ca.width-this.marginRight)){co.moveTo(ma.round(x),yStart);co.lineTo(ma.round(x),yEnd);}else if(yaxispos=='right'&&x<(ca.width-this.marginRight)&&endXTick){co.moveTo(ma.round(x),yStart);co.lineTo(ma.round(x),yEnd);}else if(yaxispos=='right'&&x<(ca.width-this.marginRight)&&x>(this.marginLeft)&&!endXTick){co.moveTo(ma.round(x),yStart);co.lineTo(ma.round(x),yEnd);}}
|
50
|
+
if(!prop['chart.yaxis']||prop['chart.xaxis.tickmarks.count']==null){if(typeof(prop['chart.xaxis.tickmarks.count'])=='number'&&prop['chart.xaxis.tickmarks.count']>0){co.moveTo(Math.round(this.marginLeft),yStart);co.lineTo(Math.round(this.marginLeft),yEnd);}}}
|
51
|
+
if(!prop['chart.yaxis']&&prop['chart.xaxis']&&RGraph.isNull(prop['chart.xaxis.tickmarks.count'])){if(xaxispos=='center'){co.moveTo(ma.round(this.marginLeft),(ca.height/2)-3);co.lineTo(ma.round(this.marginLeft),(ca.height/2)+3);}else{co.moveTo(ma.round(this.marginLeft),ca.height-this.marginBottom);co.lineTo(ma.round(this.marginLeft),ca.height-this.marginBottom+3);}}
|
53
52
|
co.stroke();};this.drawbars=this.Drawbars=function()
|
54
|
-
{co.lineWidth=prop['chart.linewidth'];co.strokeStyle=prop['chart.
|
53
|
+
{co.lineWidth=prop['chart.linewidth'];co.strokeStyle=prop['chart.colors.stroke'];co.fillStyle=prop['chart.colors'][0];var prevX=0,prevY=0,decimals=prop['chart.yaxis.scale.decimals'];if(prop['chart.yaxis.scale.max']){this.scale2=RG.getScale2(this,{'scale.max':prop['chart.yaxis.scale.max'],'scale.strict':prop['chart.yaxis.scale.round']?false:true,'scale.min':prop['chart.yaxis.scale.min'],'scale.thousand':prop['chart.yaxis.scale.thousand'],'scale.point':prop['chart.yaxis.scale.point'],'scale.decimals':prop['chart.yaxis.scale.decimals'],'scale.labels.count':prop['chart.yaxis.labels.count'],'scale.round':prop['chart.yaxis.scale.round'],'scale.units.pre':prop['chart.yaxis.scale.units.pre'],'scale.units.post':prop['chart.yaxis.scale.units.post']});}else{var errorbars=prop['chart.errorbars'];if(typeof errorbars==='number'){var value=errorbars;prop['chart.errorbars']=[];for(var i=0;i<this.data.length;++i){if(typeof this.data[i]==='number'){prop['chart.errorbars'].push([value,null]);}else if(typeof this.data[i]==='object'&&!RG.isNull(this.data[i])){for(var j=0;j<this.data[i].length;++j){prop['chart.errorbars'].push([value,null]);}}}
|
55
54
|
errorbars=prop['chart.errorbars'];}
|
56
55
|
for(i=0;i<this.data.length;++i){if(typeof(this.data[i])=='object'){var value=prop['chart.grouping']==='grouped'?Number(RG.arrayMax(this.data[i],true)):Number(RG.array_sum(this.data[i]));}else{var value=Number(this.data[i]);}
|
57
56
|
this.max=ma.max(ma.abs(this.max),ma.abs(value)+
|
58
57
|
Number((typeof prop['chart.errorbars']==='object'&&typeof prop['chart.errorbars'][i]==='object'&&!RG.isNull(prop['chart.errorbars'][i])&&typeof prop['chart.errorbars'][i][0]==='number')?prop['chart.errorbars'][i][0]:0));}
|
59
|
-
this.scale2=RGraph.getScale2(this,{'max':this.max,'min':prop['chart.
|
60
|
-
if(prop['chart.adjustable']&&!prop['chart.
|
58
|
+
this.scale2=RGraph.getScale2(this,{'scale.max':this.max,'scale.min':prop['chart.yaxis.scale.min'],'scale.thousand':prop['chart.yaxis.scale.thousand'],'scale.point':prop['chart.yaxis.scale.point'],'scale.decimals':prop['chart.yaxis.scale.decimals'],'scale.labels.count':prop['chart.yaxis.labels.count'],'scale.round':prop['chart.yaxis.scale.round'],'scale.units.pre':prop['chart.yaxis.scale.units.pre'],'scale.units.post':prop['chart.yaxis.scale.units.post']});this.max=this.scale2.max;}
|
59
|
+
if(prop['chart.adjustable']&&!prop['chart.yaxis.scale.max']){this.Set('chart.yaxis.scale.max',this.scale2.max);}
|
61
60
|
if(prop['chart.background.hbars']&&prop['chart.background.hbars'].length>0){RGraph.DrawBars(this);}
|
62
61
|
var variant=prop['chart.variant'];if(variant==='3d'){RG.draw3DAxes(this);}
|
63
|
-
var xaxispos=prop['chart.
|
62
|
+
var xaxispos=prop['chart.xaxis.position'],width=(ca.width-this.marginLeft-this.marginRight)/this.data.length,orig_height=height,hmargin=prop['chart.hmargin'],shadow=prop['chart.shadow'],shadowColor=prop['chart.shadow.color'],shadowBlur=prop['chart.shadow.blur'],shadowOffsetX=prop['chart.shadow.offsetx'],shadowOffsetY=prop['chart.shadow.offsety'],strokeStyle=prop['chart.colors.stroke'],colors=prop['chart.colors'],sequentialColorIndex=0
|
64
63
|
var height;for(i=0,len=this.data.length;i<len;i+=1){if(RG.arraySum(this.data[i])<0){var height=(RG.arraySum(this.data[i])+this.scale2.min)/(this.scale2.max-this.scale2.min);}else{var height=(RG.arraySum(this.data[i])-this.scale2.min)/(this.scale2.max-this.scale2.min);}
|
65
|
-
height*=ma.abs(this.getYCoord(this.scale2.max)-this.getYCoord(this.scale2.min));var x=(i*width)+this.
|
64
|
+
height*=ma.abs(this.getYCoord(this.scale2.max)-this.getYCoord(this.scale2.min));var x=(i*width)+this.marginLeft;var y=xaxispos=='center'?((ca.height-this.marginTop-this.marginBottom)/2)+this.marginTop-height:ca.height-height-this.marginBottom;if(xaxispos=='top'){y=this.marginTop+ma.abs(height);}
|
66
65
|
if(height<0){y+=height;height=ma.abs(height);}
|
67
66
|
if(shadow){co.shadowColor=shadowColor;co.shadowBlur=shadowBlur;co.shadowOffsetX=shadowOffsetX;co.shadowOffsetY=shadowOffsetY;}
|
68
|
-
co.beginPath();if(typeof this.data[i]=='number'){if(xaxispos==='bottom'&&prop['chart.
|
67
|
+
co.beginPath();if(typeof this.data[i]=='number'){if(xaxispos==='bottom'&&prop['chart.yaxis.scale.min']<0){if(this.data[i]>=0){height=ma.abs(this.getYCoord(0)-this.getYCoord(this.data[i]));}else{y=this.getYCoord(0);height=ma.abs(this.getYCoord(0)-this.getYCoord(this.data[i]));}}
|
69
68
|
var barWidth=width-(2*hmargin);if(barWidth<0){alert('[RGRAPH] Warning: you have a negative bar width. This may be caused by the chart.hmargin being too high or the width of the canvas not being sufficient.');}
|
70
69
|
co.strokeStyle=strokeStyle;co.fillStyle=colors[0];if(prop['chart.colors.sequential']){co.fillStyle=colors[i];}
|
71
70
|
if(variant=='sketch'){co.lineCap='round';var sketchOffset=3;co.beginPath();co.strokeStyle=colors[0];if(prop['chart.colors.sequential']){co.strokeStyle=colors[i];}
|
72
71
|
co.moveTo(x+hmargin+2,y+height-2);co.lineTo(x+hmargin-1,y-4);co.moveTo(x+hmargin-3,y+ -2+(this.data[i]<0?height:0));co.bezierCurveTo(x+((hmargin+width)*0.33),y+15+(this.data[i]<0?height-10:0),x+((hmargin+width)*0.66),y+5+(this.data[i]<0?height-10:0),x+hmargin+width+ -1,y+0+(this.data[i]<0?height:0));co.moveTo(x+hmargin+width-5,y-5);co.lineTo(x+hmargin+width-3,y+height-3);if(prop['chart.variant.sketch.verticals']){for(var r=0.2;r<=0.8;r+=0.2){co.moveTo(x+hmargin+width+(r>0.4?-1:3)-(r*width),y-1);co.lineTo(x+hmargin+width-(r>0.4?1:-1)-(r*width),y+height+(r==0.2?1:-2));}}
|
73
|
-
co.stroke();}else if(variant=='bar'||variant=='3d'||variant=='glass'||variant=='bevel'){if(RGraph.
|
74
|
-
if(variant=='glass'){RGraph.filledCurvyRect(co,x+hmargin,y,barWidth,height,3,this.data[i]>0,this.data[i]>0,this.data[i]<0,this.data[i]<0);RGraph.strokedCurvyRect(co,x+hmargin,y,barWidth,height,3,this.data[i]>0,this.data[i]>0,this.data[i]<0,this.data[i]<0);}else{co.beginPath();co.rect(x+hmargin,y,barWidth,height);co.fill();RG.NoShadow(this);co.beginPath();co.rect(x+hmargin,y,barWidth,height);co.stroke();}
|
72
|
+
co.stroke();}else if(variant=='bar'||variant=='3d'||variant=='glass'||variant=='bevel'){if(variant=='glass'){RGraph.filledCurvyRect(co,x+hmargin,y,barWidth,height,3,this.data[i]>0,this.data[i]>0,this.data[i]<0,this.data[i]<0);RGraph.strokedCurvyRect(co,x+hmargin,y,barWidth,height,3,this.data[i]>0,this.data[i]>0,this.data[i]<0,this.data[i]<0);}else{co.beginPath();co.rect(x+hmargin,y,barWidth,height);co.fill();RG.NoShadow(this);co.beginPath();co.lineJoin='miter';co.lineCap='square';co.rect(x+hmargin,y,barWidth,height);co.stroke();}
|
75
73
|
if(variant=='3d'){var prevStrokeStyle=co.strokeStyle;var prevFillStyle=co.fillStyle;if(this.data[i]>=0){co.beginPath();co.moveTo(x+hmargin,y);co.lineTo(x+hmargin+prop['chart.variant.threed.offsetx'],y-prop['chart.variant.threed.offsety']);co.lineTo(x+hmargin+prop['chart.variant.threed.offsetx']+barWidth,y-prop['chart.variant.threed.offsety']);co.lineTo(x+hmargin+barWidth,y);co.closePath();co.stroke();co.fill();}
|
76
|
-
co.beginPath();co.moveTo(x+hmargin+barWidth,y);co.lineTo(x+hmargin+barWidth+prop['chart.variant.threed.offsetx'],this.data[i]<0&&xaxispos==='bottom'?this.getYCoord(0):(this.data[i]<0&&(y-prop['chart.variant.threed.offsety'])<(this.
|
77
|
-
co.beginPath();co.fillStyle='rgba(0,0,0,0.4)';co.moveTo(x+hmargin+barWidth,y);co.lineTo(x+hmargin+barWidth+prop['chart.variant.threed.offsetx'],this.data[i]<0&&xaxispos==='bottom'?this.getYCoord(0):(this.data[i]<0&&(y-prop['chart.variant.threed.offsety'])<(this.
|
74
|
+
co.beginPath();co.moveTo(x+hmargin+barWidth,y);co.lineTo(x+hmargin+barWidth+prop['chart.variant.threed.offsetx'],this.data[i]<0&&xaxispos==='bottom'?this.getYCoord(0):(this.data[i]<0&&(y-prop['chart.variant.threed.offsety'])<(this.marginTop+this.halfgrapharea)?(this.marginTop+this.halfgrapharea):(y-prop['chart.variant.threed.offsety'])));co.lineTo(x+hmargin+barWidth+prop['chart.variant.threed.offsetx'],this.data[i]<0&&(y-prop['chart.variant.threed.offsety']+height)<(this.marginTop+this.getYCoord(0))?this.getYCoord(this.data[i])-prop['chart.variant.threed.offsety']:(this.data[i]>0?y-prop['chart.variant.threed.offsety']+height:ma.min(y-prop['chart.variant.threed.offsety']+height,ca.height-this.marginBottom)));co.lineTo(x+hmargin+barWidth,y+height);co.closePath();co.stroke();co.fill();if(this.data[i]>0){co.beginPath();co.fillStyle='rgba(255,255,255,0.5)';co.moveTo(x+hmargin,y);co.lineTo(x+hmargin+prop['chart.variant.threed.offsetx'],y-prop['chart.variant.threed.offsety']);co.lineTo(x+hmargin+prop['chart.variant.threed.offsetx']+barWidth,y-prop['chart.variant.threed.offsety']);co.lineTo(x+hmargin+barWidth,y);co.lineTo(x+hmargin,y);co.closePath();co.stroke();co.fill();}
|
75
|
+
co.beginPath();co.fillStyle='rgba(0,0,0,0.4)';co.moveTo(x+hmargin+barWidth,y);co.lineTo(x+hmargin+barWidth+prop['chart.variant.threed.offsetx'],this.data[i]<0&&xaxispos==='bottom'?this.getYCoord(0):(this.data[i]<0&&(y-prop['chart.variant.threed.offsety'])<(this.marginTop+this.halfgrapharea)?(this.marginTop+this.halfgrapharea):y-prop['chart.variant.threed.offsety']));co.lineTo(x+hmargin+barWidth+prop['chart.variant.threed.offsetx'],this.data[i]<0&&(y-prop['chart.variant.threed.offsety']+height)<this.getYCoord(0)?this.getYCoord(0):this.data[i]>0?y-prop['chart.variant.threed.offsety']+height:ma.min(y-prop['chart.variant.threed.offsety']+height,ca.height-this.marginBottom));co.lineTo(x+hmargin+barWidth,y+height);co.lineTo(x+hmargin+barWidth,y);co.closePath();co.stroke();co.fill();co.strokeStyle=prevStrokeStyle;co.fillStyle=prevFillStyle;}else if(variant=='glass'){var grad=co.createLinearGradient(x+hmargin,y,x+hmargin+(barWidth/2),y);grad.addColorStop(0,'rgba(255,255,255,0.9)');grad.addColorStop(1,'rgba(255,255,255,0.5)');co.beginPath();co.fillStyle=grad;co.fillRect(x+hmargin+2,y+(this.data[i]>0?2:0),(barWidth/2)-2,height-2);co.fill();}}else if(variant=='dot'){co.beginPath();co.moveTo(x+(width/2),y);co.lineTo(x+(width/2),y+height);co.stroke();co.beginPath();co.fillStyle=this.properties['chart.colors'][i];co.arc(x+(width/2),y+(this.data[i]>0?0:height),2,0,6.28,0);co.fillStyle=prop['chart.colors'][0];if(prop['chart.colors.sequential']){co.fillStyle=colors[i];}
|
78
76
|
co.stroke();co.fill();}else{alert('[BAR] Warning! Unknown chart.variant: '+variant);}
|
79
77
|
this.coords.push([x+hmargin,y,width-(2*hmargin),height]);if(typeof this.coords2[i]=='undefined'){this.coords2[i]=[];}
|
80
78
|
this.coords2[i].push([x+hmargin,y,width-(2*hmargin),height]);}else if(this.data[i]&&typeof(this.data[i])=='object'&&prop['chart.grouping']=='stacked'){if(this.scale2.min){alert("[ERROR] Stacked Bar charts with a Y min are not supported");}
|
@@ -84,10 +82,9 @@ if(this.data[i][j]<0){alert('[BAR] Negative values are not permitted with a stac
|
|
84
82
|
co.strokeStyle=strokeStyle
|
85
83
|
co.fillStyle=colors[j];if(prop['chart.colors.reverse']){co.fillStyle=colors[this.data[i].length-j-1];}
|
86
84
|
if(prop['chart.colors.sequential']&&colors[sequentialColorIndex]){co.fillStyle=colors[sequentialColorIndex++];}else if(prop['chart.colors.sequential']){co.fillStyle=colors[sequentialColorIndex-1];}
|
87
|
-
var height=(dataset[j]/this.scale2.max)*(ca.height-this.
|
88
|
-
var totalHeight=(RGraph.array_sum(dataset)/this.scale2.max)*(ca.height-hmargin-this.
|
89
|
-
this.coords2[i].push([x+hmargin,y,width-(2*hmargin),height]);if(
|
90
|
-
if(height>0){co.strokeRect(x+hmargin,y,width-(2*hmargin),height);co.fillRect(x+hmargin,y,width-(2*hmargin),height);}
|
85
|
+
var height=(dataset[j]/this.scale2.max)*(ca.height-this.marginTop-this.marginBottom);if(xaxispos=='center'){height/=2;}
|
86
|
+
var totalHeight=(RGraph.array_sum(dataset)/this.scale2.max)*(ca.height-hmargin-this.marginTop-this.marginBottom);this.coords.push([x+hmargin,y,width-(2*hmargin),height]);if(typeof this.coords2[i]=='undefined'){this.coords2[i]=[];}
|
87
|
+
this.coords2[i].push([x+hmargin,y,width-(2*hmargin),height]);if(height>0){co.lineJoin='miter';co.lineCap='square';co.strokeRect(x+hmargin,y,width-(2*hmargin),height);co.fillRect(x+hmargin,y,width-(2*hmargin),height);}
|
91
88
|
if(j==0){var startY=y;var startX=x;}
|
92
89
|
if(shadow){redrawCoords.push([x+hmargin,y,width-(2*hmargin),height,co.fillStyle]);}
|
93
90
|
if(variant=='3d'){var prevFillStyle=co.fillStyle;var prevStrokeStyle=co.strokeStyle;if(j==0){co.beginPath();co.moveTo(startX+hmargin,y);co.lineTo(startX+prop['chart.variant.threed.offsetx']+hmargin,y-prop['chart.variant.threed.offsety']);co.lineTo(startX+prop['chart.variant.threed.offsetx']+barWidth+hmargin,y-prop['chart.variant.threed.offsety']);co.lineTo(startX+barWidth+hmargin,y);co.closePath();co.fill();co.stroke();}
|
@@ -96,52 +93,48 @@ co.fillStyle='rgba(0,0,0,0.4)';co.beginPath();co.moveTo(startX+barWidth+hmargin,
|
|
96
93
|
y+=height;}
|
97
94
|
if(shadow){RGraph.NoShadow(this);for(k=0;k<redrawCoords.length;++k){co.strokeStyle=strokeStyle;co.fillStyle=redrawCoords[k][4];co.strokeRect(redrawCoords[k][0],redrawCoords[k][1],redrawCoords[k][2],redrawCoords[k][3]);co.fillRect(redrawCoords[k][0],redrawCoords[k][1],redrawCoords[k][2],redrawCoords[k][3]);co.stroke();co.fill();}
|
98
95
|
redrawCoords=[];}}else if(this.data[i]&&typeof(this.data[i])=='object'&&prop['chart.grouping']=='grouped'){var redrawCoords=[];co.lineWidth=prop['chart.linewidth'];for(j=0;j<this.data[i].length;++j){co.strokeStyle=strokeStyle;co.fillStyle=colors[j];if(prop['chart.colors.sequential']&&colors[sequentialColorIndex]){co.fillStyle=colors[sequentialColorIndex++];}else if(prop['chart.colors.sequential']){co.fillStyle=colors[sequentialColorIndex-1];}
|
99
|
-
var individualBarWidth=(width-(2*hmargin))/this.data[i].length;var height=((this.data[i][j]+(this.data[i][j]<0?this.scale2.min:(-1*this.scale2.min)))/(this.scale2.max-this.scale2.min))*(ca.height-this.
|
96
|
+
var individualBarWidth=(width-(2*hmargin))/this.data[i].length;var height=((this.data[i][j]+(this.data[i][j]<0?this.scale2.min:(-1*this.scale2.min)))/(this.scale2.max-this.scale2.min))*(ca.height-this.marginTop-this.marginBottom);var groupedMargin=prop['chart.hmargin.grouped'];var startX=x+hmargin+(j*individualBarWidth);if(individualBarWidth<0){alert('[RGRAPH] Warning: you have a negative bar width. This may be caused by the chart.hmargin being too high or the width of the canvas not being sufficient.');}
|
100
97
|
if(xaxispos=='center'){height/=2;}
|
101
|
-
if(xaxispos=='top'){var startY=this.
|
102
|
-
co.strokeRect(startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height);co.fillRect(startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height);y+=height;if(variant=='3d'){var prevFillStyle=co.fillStyle;var prevStrokeStyle=co.strokeStyle;var hmarginGrouped=prop['chart.hmargin.grouped'];if(this.data[i][j]>=0){co.beginPath();co.moveTo(startX+hmarginGrouped,startY);co.lineTo(startX+hmarginGrouped+prop['chart.variant.threed.offsetx'],startY-prop['chart.variant.threed.offsety']);co.lineTo(startX+prop['chart.variant.threed.offsetx']+individualBarWidth-hmarginGrouped,startY-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth-hmarginGrouped,startY);co.closePath();co.fill();co.stroke();}
|
103
|
-
co.beginPath();co.moveTo(startX+individualBarWidth-hmarginGrouped-1,startY);co.lineTo(startX+individualBarWidth-hmarginGrouped+prop['chart.variant.threed.offsetx'],this.data[i][j]<0?(this.getYCoord(0)+ma.abs(height)-prop['chart.variant.threed.offsety']):this.getYCoord(0)-height-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth-hmarginGrouped+prop['chart.variant.threed.offsetx'],this.data[i][j]<0&&(startY+height-prop['chart.variant.threed.offsety'])<(this.
|
104
|
-
co.fillStyle='rgba(0,0,0,0.4)';co.beginPath();co.moveTo(startX+individualBarWidth-hmarginGrouped,startY);co.lineTo(startX+individualBarWidth+prop['chart.variant.threed.offsetx']-hmarginGrouped,this.data[i][j]<0?(this.getYCoord(0)+ma.abs(height)-prop['chart.variant.threed.offsety']):this.getYCoord(0)-height-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth+prop['chart.variant.threed.offsetx']-hmarginGrouped,this.data[i][j]<0&&(startY+height-5)<(this.
|
98
|
+
if(xaxispos=='top'){var startY=this.marginTop;var height=Math.abs(height);}else if(xaxispos=='center'){var startY=this.marginTop+(this.grapharea/2)-height;}else{var startY=this.getYCoord(0);var height=ma.abs(ma.abs(this.getYCoord(this.data[i][j]))-this.getYCoord(0));if(this.data[i][j]>=0){startY-=height;}}
|
99
|
+
co.lineJoin='miter';co.lineCap='square';co.strokeRect(startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height);co.fillRect(startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height);y+=height;if(variant=='3d'){var prevFillStyle=co.fillStyle;var prevStrokeStyle=co.strokeStyle;var hmarginGrouped=prop['chart.hmargin.grouped'];if(this.data[i][j]>=0){co.beginPath();co.moveTo(startX+hmarginGrouped,startY);co.lineTo(startX+hmarginGrouped+prop['chart.variant.threed.offsetx'],startY-prop['chart.variant.threed.offsety']);co.lineTo(startX+prop['chart.variant.threed.offsetx']+individualBarWidth-hmarginGrouped,startY-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth-hmarginGrouped,startY);co.closePath();co.fill();co.stroke();}
|
100
|
+
co.beginPath();co.moveTo(startX+individualBarWidth-hmarginGrouped-1,startY);co.lineTo(startX+individualBarWidth-hmarginGrouped+prop['chart.variant.threed.offsetx'],this.data[i][j]<0?(this.getYCoord(0)+ma.abs(height)-prop['chart.variant.threed.offsety']):this.getYCoord(0)-height-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth-hmarginGrouped+prop['chart.variant.threed.offsetx'],this.data[i][j]<0&&(startY+height-prop['chart.variant.threed.offsety'])<(this.marginTop+this.halfgrapharea)?(this.marginTop+this.halfgrapharea):(startY+height-prop['chart.variant.threed.offsety']));co.lineTo(startX+individualBarWidth-hmarginGrouped-1,startY+height);co.closePath();co.fill();co.stroke();if(this.data[i][j]>=0){co.fillStyle='rgba(255,255,255,0.5)';co.beginPath();co.moveTo(startX+hmarginGrouped,startY);co.lineTo(startX+hmarginGrouped+prop['chart.variant.threed.offsetx'],startY-prop['chart.variant.threed.offsety']);co.lineTo(startX+prop['chart.variant.threed.offsetx']+individualBarWidth-hmarginGrouped,startY-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth-hmarginGrouped,startY);co.closePath();co.fill();co.stroke();}
|
101
|
+
co.fillStyle='rgba(0,0,0,0.4)';co.beginPath();co.moveTo(startX+individualBarWidth-hmarginGrouped,startY);co.lineTo(startX+individualBarWidth+prop['chart.variant.threed.offsetx']-hmarginGrouped,this.data[i][j]<0?(this.getYCoord(0)+ma.abs(height)-prop['chart.variant.threed.offsety']):this.getYCoord(0)-height-prop['chart.variant.threed.offsety']);co.lineTo(startX+individualBarWidth+prop['chart.variant.threed.offsetx']-hmarginGrouped,this.data[i][j]<0&&(startY+height-5)<(this.marginTop+this.halfgrapharea)?(this.marginTop+this.halfgrapharea):(startY+height-prop['chart.variant.threed.offsety']));co.lineTo(startX+individualBarWidth-hmarginGrouped,startY+height);co.closePath();co.fill();co.stroke();co.strokeStyle=prevStrokeStyle;co.fillStyle=prevFillStyle;}
|
105
102
|
if(height<0){height=Math.abs(height);startY=startY-height;}
|
106
103
|
this.coords.push([startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height]);if(typeof this.coords2[i]=='undefined'){this.coords2[i]=[];}
|
107
104
|
this.coords2[i].push([startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height]);if(prop['chart.shadow']){redrawCoords.push([startX+groupedMargin,startY,individualBarWidth-(2*groupedMargin),height,co.fillStyle]);}}
|
108
|
-
if(redrawCoords.length){RGraph.NoShadow(this);co.lineWidth=prop['chart.linewidth'];co.beginPath();for(var j=0;j<redrawCoords.length;++j){co.fillStyle=redrawCoords[j][4];co.strokeStyle=prop['chart.
|
105
|
+
if(redrawCoords.length){RGraph.NoShadow(this);co.lineWidth=prop['chart.linewidth'];co.beginPath();for(var j=0;j<redrawCoords.length;++j){co.fillStyle=redrawCoords[j][4];co.strokeStyle=prop['chart.colors.stroke'];co.fillRect(redrawCoords[j][0],redrawCoords[j][1],redrawCoords[j][2],redrawCoords[j][3]);co.strokeRect(redrawCoords[j][0],redrawCoords[j][1],redrawCoords[j][2],redrawCoords[j][3]);}
|
109
106
|
co.fill();co.stroke();redrawCoords=[];}}else{this.coords.push([]);}
|
110
107
|
co.closePath();}
|
111
|
-
if(prop['chart.variant']==='3d'&&prop['chart.
|
108
|
+
if(prop['chart.variant']==='3d'&&prop['chart.yaxis.position']==='right'){RG.draw3DYAxis(this);}
|
112
109
|
RGraph.noShadow(this);};this.drawLabels=this.DrawLabels=function()
|
113
|
-
{var context=co;var text_angle=prop['chart.
|
114
|
-
if(prop['chart.
|
115
|
-
|
116
|
-
|
117
|
-
co.fillStyle=prop['chart.labels.color']||prop['chart.text.color'];var barWidth=(ca.width-this.gutterRight-this.gutterLeft)/labels.length;xTickGap=(ca.width-this.gutterRight-this.gutterLeft)/labels.length
|
118
|
-
var i=0;var font=prop['chart.text.font'];for(x=this.gutterLeft+(xTickGap/2);x<=ca.width-this.gutterRight;x+=xTickGap){RG.text2(this,{'font':font,'size':text_size,'x':x+xOffset,'y':prop['chart.xaxispos']=='top'?this.gutterTop+yOffset-5:(ca.height-this.gutterBottom)+yOffset+3,'bold':bold,'text':String(labels[i++]),'valign':prop['chart.xaxispos']=='top'?'bottom':valign,'halign':halign,'tag':'label','marker':false,'angle':angle,'tag':'labels'});}}
|
110
|
+
{var context=co;var text_angle=prop['chart.xaxis.labels.angle'],text_size=prop['chart.xaxis.labels.size']?prop['chart.xaxis.labels.size']:prop['chart.text.size'],labels=prop['chart.xaxis.labels'];if(prop['chart.yaxis.labels']){if(prop['chart.xaxis.position']=='top')this.Drawlabels_top();if(prop['chart.xaxis.position']=='center')this.Drawlabels_center();if(prop['chart.xaxis.position']=='bottom')this.Drawlabels_bottom();}
|
111
|
+
if(typeof labels=='object'&&labels){var yOffset=Number(prop['chart.xaxis.labels.offsety']),xOffset=Number(prop['chart.xaxis.labels.offsetx']),bold=typeof prop['chart.xaxis.labels.bold']==='boolean'?prop['chart.xaxis.labels.bold']:prop['chart.text.bold'],italic=typeof prop['chart.xaxis.labels.italic']==='boolean'?prop['chart.xaxis.labels.italic']:prop['chart.text.italic'],font=prop['chart.xaxis.labels.font']||prop['chart.text.font'],size=typeof prop['chart.xaxis.labels.size']==='number'?prop['chart.xaxis.labels.size']:prop['chart.text.size'];if(prop['chart.xaxis.labels.angle']!=0){var valign='center';var halign='right';var angle=0-prop['chart.xaxis.labels.angle'];}else{var valign='top';var halign='center';var angle=0;}
|
112
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.xaxis.labels'});co.fillStyle=textConf.color;var barWidth=(ca.width-this.marginRight-this.marginLeft)/labels.length;xTickGap=(ca.width-this.marginRight-this.marginLeft)/labels.length
|
113
|
+
var i=0;for(x=this.marginLeft+(xTickGap/2);x<=ca.width-this.marginRight;x+=xTickGap){RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:x+xOffset,y:prop['chart.xaxis.position']=='top'?this.marginTop+yOffset-5:(ca.height-this.marginBottom)+yOffset+3,text:String(labels[i++]),valign:prop['chart.xaxis.position']=='top'?'bottom':valign,halign:halign,tag:'label',marker:false,angle:angle,tag:'labels'});}}
|
119
114
|
this.drawAboveLabels();};this.drawlabels_top=this.Drawlabels_top=function()
|
120
|
-
{var ca=this.canvas;var co=this.context;var prop=this.properties;co.beginPath();co.fillStyle=prop['chart.text.color'];co.strokeStyle='black';if(prop['chart.
|
121
|
-
if(typeof(prop['chart.
|
115
|
+
{var ca=this.canvas;var co=this.context;var prop=this.properties;co.beginPath();co.fillStyle=prop['chart.text.color'];co.strokeStyle='black';if(prop['chart.xaxis.position']=='top'){var context=co;var text_size=prop['chart.text.size'];var units_pre=prop['chart.yaxis.scale.units.pre'];var units_post=prop['chart.yaxis.scale.units.post'];var align=prop['chart.yaxis.position']=='left'?'right':'left';var font=prop['chart.text.font'];var numYLabels=prop['chart.yaxis.labels.count'];var ymin=prop['chart.yaxis.scale.min'];var offsetx=prop['chart.yaxis.labels.offsetx'];var offsety=prop['chart.yaxis.labels.offsety'];var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.labels'});if(prop['chart.yaxis.labels.inside']==true){var xpos=prop['chart.yaxis.position']=='left'?this.marginLeft+5:ca.width-this.marginRight-5;var align=prop['chart.yaxis.position']=='left'?'left':'right';var boxed=true;}else{var xpos=prop['chart.yaxis.position']=='left'?this.marginLeft-5:ca.width-this.marginRight+5;var boxed=false;}
|
116
|
+
if(typeof(prop['chart.yaxis.labels.specific'])=='object'&&prop['chart.yaxis.labels.specific']){var labels=RGraph.array_reverse(prop['chart.yaxis.labels.specific']);var grapharea=ca.height-this.marginTop-this.marginBottom;for(var i=0;i<labels.length;++i){var y=this.marginTop+(grapharea*(i/labels.length))+(grapharea/labels.length);RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:xpos+offsetx,y:y+offsety,text:String(labels[i]),valign:'center',halign:align,bordered:boxed,tag:'scale'});}
|
122
117
|
return;}
|
123
|
-
var labels=this.scale2.labels;for(var i=0;i<labels.length;++i){RGraph.
|
124
|
-
if(prop['chart.
|
118
|
+
var labels=this.scale2.labels;for(var i=0;i<labels.length;++i){RGraph.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:xpos+offsetx,y:this.marginTop+((this.grapharea/labels.length)*(i+1))+offsety,text:'-'+labels[i],valign:'center',halign:align,bordered:boxed,tag:'scale'});}
|
119
|
+
if(prop['chart.yaxis.scale.min']!=0||!prop['chart.xaxis']||prop['chart.yaxis.scale.zerostart']){RGraph.Text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:xpos+offsetx,y:this.marginTop+offsety,text:(this.scale2.min!=0?'-':'')+RG.numberFormat({object:this,number:(this.scale2.min.toFixed((this.scale2.min===0?0:prop['chart.yaxis.scale.decimals']))),unitspre:units_pre,unitspost:units_post}),valign:'center',halign:align,bordered:boxed,tag:'scale'});}}
|
125
120
|
co.fill();};this.drawlabels_center=this.Drawlabels_center=function()
|
126
|
-
{var ca=this.canvas;var co=this.context;var prop=this.properties;var
|
127
|
-
if(typeof(prop['chart.
|
128
|
-
for(var i=labels.length-1;i>=1;--i){var y=this.
|
121
|
+
{var ca=this.canvas;var co=this.context;var prop=this.properties;var textConf=RG.getTextConf({object:this,prefix:'chart.scale'});var numYLabels=prop['chart.yaxis.labels.count'];co.fillStyle=textConf.color;if(prop['chart.xaxis.position']=='center'){var text_size=textConf.size;var units_pre=prop['chart.yaxis.scale.units.pre'];var units_post=prop['chart.yaxis.scale.units.post'];var context=co;var align='';var xpos=0;var boxed=false;var ymin=prop['chart.yaxis.scale.min'];var offsetx=prop['chart.yaxis.labels.offsetx'];var offsety=prop['chart.yaxis.labels.offsety'];co.fillStyle=textConf.color;co.strokeStyle='black';if(prop['chart.yaxis.labels.inside']==true){var xpos=prop['chart.yaxis.position']=='left'?this.marginLeft+5:ca.width-this.marginRight-5;var align=prop['chart.yaxis.position']=='left'?'left':'right';var boxed=true;}else{var xpos=prop['chart.yaxis.position']=='left'?this.marginLeft-5:ca.width-this.marginRight+5;var align=prop['chart.yaxis.position']=='left'?'right':'left';var boxed=false;}
|
122
|
+
if(typeof(prop['chart.yaxis.labels.specific'])=='object'&&prop['chart.yaxis.labels.specific']){var labels=prop['chart.yaxis.labels.specific'];var grapharea=ca.height-this.marginTop-this.marginBottom;for(var i=0;i<labels.length;++i){var y=this.marginTop+((grapharea/2)/(labels.length-1))*i;RGraph.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:xpos+offsetx,y:y+offsety,text:String(labels[i]),valign:'center',halign:align,bordered:boxed,tag:'scale'});}
|
123
|
+
for(var i=labels.length-1;i>=1;--i){var y=this.marginTop+(grapharea*(i/((labels.length-1)*2)))+(grapharea/2);RG.Text2(this,{font:textConf.font,size:textConf.size,italic:textConf.italic,bold:textConf.bold,color:textConf.color,'x':xpos+offsetx,'y':y+offsety,'text':String(labels[labels.length-i-1]),'valign':'center','halign':align,'bordered':boxed,'tag':'scale'});}
|
129
124
|
return;}
|
130
|
-
for(var i=0;i<this.scale2.labels.length;++i){var y=this.
|
131
|
-
for(var i=(this.scale2.labels.length-1);i>=0;--i){var y=this.
|
132
|
-
if(this.scale2.min!=0||prop['chart.scale.zerostart']){RG.Text2(this,{
|
133
|
-
{var text_size=prop['chart.text.size'],units_pre=prop['chart.units.pre'],units_post=prop['chart.units.post'],context=this.context,align=prop['chart.
|
134
|
-
|
135
|
-
if(prop['chart.ylabels.specific']&&typeof(prop['chart.ylabels.specific'])=='object'){var labels=prop['chart.ylabels.specific'];var grapharea=ca.height-this.gutterTop-this.gutterBottom;for(var i=0;i<labels.length;++i){var y=this.gutterTop+(grapharea*(i/(labels.length-1)));RGraph.Text2(this,{'font':font,'size':text_size,'x':xpos+offsetx,'y':y+offsety,'text':labels[i],'valign':'center','halign':align,'bordered':boxed,'tag':'scale'});}
|
125
|
+
for(var i=0;i<this.scale2.labels.length;++i){var y=this.marginTop+this.halfgrapharea-((this.halfgrapharea/numYLabels)*(i+1));var text=this.scale2.labels[i];RG.text2(this,{font:textConf.font,size:textConf.size,italic:textConf.italic,bold:textConf.bold,color:textConf.color,'x':xpos+offsetx,'y':y+offsety,'text':text,'valign':'center','halign':align,'bordered':boxed,'tag':'scale'});}
|
126
|
+
for(var i=(this.scale2.labels.length-1);i>=0;--i){var y=this.marginTop+((this.halfgrapharea/numYLabels)*(i+1))+this.halfgrapharea;var text=this.scale2.labels[i];RG.Text2(this,{font:textConf.font,size:textConf.size,italic:textConf.italic,bold:textConf.bold,color:textConf.color,'x':xpos+offsetx,'y':y+offsety,'text':'-'+text,'valign':'center','halign':align,'bordered':boxed,'tag':'scale'});}
|
127
|
+
if(this.scale2.min!=0||prop['chart.yaxis.scale.zerostart']){RG.Text2(this,{font:textConf.font,size:textConf.size,italic:textConf.italic,bold:textConf.bold,color:textConf.color,x:xpos+offsetx,y:this.marginTop+this.halfgrapharea+offsety,text:RG.numberFormat({object:this,number:(this.scale2.min.toFixed((this.scale2.min===0?0:prop['chart.yaxis.scale.decimals']))),unitspre:units_pre,unitspost:units_post}),valign:'center',valign:'center',halign:align,bordered:boxed,tag:'scale'});}}};this.drawlabels_bottom=this.Drawlabels_bottom=function()
|
128
|
+
{var text_size=prop['chart.text.size'],units_pre=prop['chart.yaxis.scale.units.pre'],units_post=prop['chart.yaxis.scale.units.post'],context=this.context,align=prop['chart.yaxis.position']=='left'?'right':'left',numYLabels=prop['chart.yaxis.labels.count'],ymin=prop['chart.yaxis.scale.min'],offsetx=prop['chart.yaxis.labels.offsetx'],offsety=prop['chart.yaxis.labels.offsety'];var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.labels'});co.beginPath();co.fillStyle=textConf.color;co.strokeStyle='black';if(prop['chart.yaxis.labels.inside']==true){var xpos=prop['chart.yaxis.position']=='left'?this.marginLeft+5:ca.width-this.marginRight-5;var align=prop['chart.yaxis.position']=='left'?'left':'right';var boxed=true;}else{var xpos=prop['chart.yaxis.position']=='left'?this.marginLeft-5:ca.width-this.marginRight+5;var boxed=false;}
|
129
|
+
if(prop['chart.yaxis.labels.specific']&&typeof(prop['chart.yaxis.labels.specific'])=='object'){var labels=prop['chart.yaxis.labels.specific'];var grapharea=ca.height-this.marginTop-this.marginBottom;for(var i=0;i<labels.length;++i){var y=this.marginTop+(grapharea*(i/(labels.length-1)));RGraph.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:xpos+offsetx,y:y+offsety,text:labels[i],valign:'center',halign:align,bordered:boxed,tag:'scale'});}
|
136
130
|
return;}
|
137
|
-
var
|
138
|
-
if(prop['chart.
|
139
|
-
co.fill();};this.
|
140
|
-
{var co=this.context;var ca=this.canvas;var prop=this.properties;var prevFillStyle=co.fillStyle;var offsetx=prop['chart.shadow.offsetx'];var offsety=prop['chart.shadow.offsety'];co.lineWidth=prop['chart.linewidth'];co.fillStyle=prop['chart.shadow.color'];co.beginPath();co.fillRect(coords[0]+offsetx,coords[1]+offsety,coords[2],coords[3]);co.fill();co.fillStyle=prevFillStyle;};this.getShape=this.getBar=function(e)
|
131
|
+
var marginTop=this.marginTop;var halfTextHeight=this.halfTextHeight;var scale=this.scale;for(var i=0;i<numYLabels;++i){var text=this.scale2.labels[i];RGraph.Text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,italic:textConf.italic,bold:textConf.bold,x:xpos+offsetx,y:this.marginTop+this.grapharea-((this.grapharea/numYLabels)*(i+1))+offsety,text:text,valign:'center',halign:align,bordered:boxed,tag:'scale'});}
|
132
|
+
if(prop['chart.yaxis.scale.min']!=0||!prop['chart.xaxis']||prop['chart.yaxis.scale.zerostart']){RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,italic:textConf.italic,bold:textConf.bold,x:xpos+offsetx,y:ca.height-this.marginBottom+offsety,text:RG.numberFormat({object:this,number:(this.scale2.min.toFixed((this.scale2.min===0?0:prop['chart.yaxis.scale.decimals']))),unitspre:units_pre,unitspost:units_post}),valign:'center',halign:align,bordered:boxed,tag:'scale'});}
|
133
|
+
co.fill();};this.getShape=this.getBar=function(e)
|
141
134
|
{var obj=arguments[1]?arguments[1]:this;var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1],canvas=obj.canvas,context=obj.context,coords=obj.coords
|
142
135
|
for(var i=0,len=coords.length;i<len;i+=1){if(obj.coords[i].length==0){continue;}
|
143
136
|
var left=coords[i][0],top=coords[i][1],width=coords[i][2],height=coords[i][3],prop=obj.properties
|
144
|
-
if(prop['chart.tooltips.hotspot.xonly']){pa2(co,'b r % % % %',left,this.
|
137
|
+
if(prop['chart.tooltips.hotspot.xonly']){pa2(co,'b r % % % %',left,this.marginTop,width,ca.height-this.marginBottom);}else{pa2(co,'b r % % % %',left,top,width,height);}
|
145
138
|
if(co.isPointInPath(mouseX,mouseY)){if(prop['chart.tooltips']){var tooltip=RG.parseTooltipText?RG.parseTooltipText(prop['chart.tooltips'],i):prop['chart.tooltips'][i];}
|
146
139
|
var dataset=0,idx=i
|
147
140
|
while(idx>=(typeof obj.data[dataset]==='object'&&obj.data[dataset]?obj.data[dataset].length:1)){if(typeof obj.data[dataset]==='number'){idx-=1;}else if(obj.data[dataset]){idx-=obj.data[dataset].length;}else{idx-=1;}
|
@@ -154,33 +147,34 @@ var mouseX=mouseCoords[0];var mouseY=mouseCoords[1];var left=obj.coords[i][0];va
|
|
154
147
|
return{0:obj,1:left,2:top,3:width,4:height,5:i,'object':obj,'x':left,'y':top,'width':width,'height':height,'index':i,'tooltip':tooltip};}}
|
155
148
|
return null;};this.getValue=function(arg)
|
156
149
|
{var co=this.context;var ca=this.canvas;var prop=this.properties;if(arg.length==2){var mouseX=arg[0];var mouseY=arg[1];}else{var mouseCoords=RG.getMouseXY(arg);var mouseX=mouseCoords[0];var mouseY=mouseCoords[1];}
|
157
|
-
if(mouseY<prop['chart.
|
158
|
-
if(prop['chart.
|
159
|
-
value*=2;if(value>=0){value+=this.scale2.min;}else{value-=this.scale2.min;}}else if(prop['chart.
|
160
|
-
value=this.scale2.max-value;value=ma.abs(value)* -1;}else{var value=((this.grapharea-(mouseY-prop['chart.
|
150
|
+
if(mouseY<prop['chart.margin.top']||mouseY>(ca.height-prop['chart.margin.bottom'])||mouseX<prop['chart.margin.left']||mouseX>(ca.width-prop['chart.margin.right'])){return null;}
|
151
|
+
if(prop['chart.xaxis.position']=='center'){var value=(((this.grapharea/2)-(mouseY-prop['chart.margin.top']))/this.grapharea)*(this.scale2.max-this.scale2.min)
|
152
|
+
value*=2;if(value>=0){value+=this.scale2.min;}else{value-=this.scale2.min;}}else if(prop['chart.xaxis.position']=='top'){var value=((this.grapharea-(mouseY-prop['chart.margin.top']))/this.grapharea)*(this.scale2.max-this.scale2.min)
|
153
|
+
value=this.scale2.max-value;value=ma.abs(value)* -1;}else{var value=((this.grapharea-(mouseY-prop['chart.margin.top']))/this.grapharea)*(this.scale2.max-this.scale2.min)
|
161
154
|
value+=this.scale2.min;}
|
162
155
|
return value;};this.getYCoord=function(value)
|
163
156
|
{if(value>this.scale2.max){return null;}
|
164
|
-
var co=this.context,ca=this.canvas,prop=this.properties;var y,xaxispos=prop['chart.
|
165
|
-
y=((value-this.scale2.min)/(this.scale2.max-this.scale2.min))*this.grapharea;y=y+this.
|
166
|
-
y=((value-this.scale2.min)/(this.scale2.max-this.scale2.min));y*=(ca.height-this.
|
157
|
+
var co=this.context,ca=this.canvas,prop=this.properties;var y,xaxispos=prop['chart.xaxis.position'];if(xaxispos=='top'){if(value<0){value=ma.abs(value);}
|
158
|
+
y=((value-this.scale2.min)/(this.scale2.max-this.scale2.min))*this.grapharea;y=y+this.marginTop}else if(xaxispos=='center'){y=((value-this.scale2.min)/(this.scale2.max-this.scale2.min))*(this.grapharea/2);y=(this.grapharea/2)-y;y+=this.marginTop;}else{if(value<this.scale2.min){value=this.scale2.min;}
|
159
|
+
y=((value-this.scale2.min)/(this.scale2.max-this.scale2.min));y*=(ca.height-this.marginTop-this.marginBottom);y=ca.height-this.marginBottom-y;}
|
167
160
|
return y;};this.highlight=this.Highlight=function(shape)
|
168
161
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{RG.Highlight.Rect(this,shape);}};this.getObjectByXY=function(e)
|
169
162
|
{var mouseXY=RG.getMouseXY(e);if(prop['chart.variant']==='3d'){var adjustment=prop['chart.variant.threed.angle']*mouseXY[0];mouseXY[1]-=adjustment;}
|
170
|
-
if(mouseXY[0]>=prop['chart.
|
171
|
-
{if(prop['chart.adjustable']&&RG.Registry.
|
172
|
-
if(shape){RG.Registry.
|
163
|
+
if(mouseXY[0]>=prop['chart.margin.left']&&mouseXY[0]<=(ca.width-prop['chart.margin.right'])&&mouseXY[1]>=prop['chart.margin.top']&&mouseXY[1]<=(ca.height-prop['chart.margin.bottom'])){return this;}};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
|
164
|
+
{if(prop['chart.adjustable']&&RG.Registry.get('chart.adjusting')&&RG.Registry.get('chart.adjusting').uid==this.uid){var value=Number(this.getValue(e));var shape=RG.Registry.get('chart.adjusting.shape')
|
165
|
+
if(shape){RG.Registry.set('chart.adjusting.shape',shape);if(this.stackedOrGrouped&&prop['chart.grouping']=='grouped'){var indexes=RG.sequentialIndexToGrouped(shape['index'],this.data);if(typeof this.data[indexes[0]]=='number'){this.data[indexes[0]]=Number(value);}else if(!RG.isNull(this.data[indexes[0]])){this.data[indexes[0]][indexes[1]]=Number(value);}}else if(typeof this.data[shape['index']]=='number'){this.data[shape['index']]=Number(value);}
|
173
166
|
RG.redrawCanvas(e.target);RG.fireCustomEvent(this,'onadjust');}}};this.parseColors=function()
|
174
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=
|
167
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);this.original_colors['chart.key.colors']=RG.arrayClone(prop['chart.key.colors']);this.original_colors['chart.crosshairs.color']=prop['chart.crosshairs.color'];this.original_colors['chart.highlight.stroke']=prop['chart.highlight.stroke'];this.original_colors['chart.highlight.fill']=prop['chart.highlight.fill'];this.original_colors['chart.text.color']=prop['chart.text.color'];this.original_colors['chart.background.bars.color1']=prop['chart.background.bars.color1'];this.original_colors['chart.background.bars.color2']=prop['chart.background.bars.color2'];this.original_colors['chart.background.grid.color']=prop['chart.background.grid.color'];this.original_colors['chart.background.color']=prop['chart.background.color'];this.original_colors['chart.colors.stroke']=prop['chart.colors.stroke'];this.original_colors['chart.axes.color']=prop['chart.axes.color'];}
|
175
168
|
var colors=prop['chart.colors'];if(colors){for(var i=0;i<colors.length;++i){colors[i]=this.parseSingleColorForGradient(colors[i]);}}
|
176
169
|
var colors=prop['chart.key.colors'];if(colors){for(var i=0;i<colors.length;++i){colors[i]=this.parseSingleColorForGradient(colors[i]);}}
|
177
|
-
prop['chart.crosshairs.color']=this.parseSingleColorForGradient(prop['chart.crosshairs.color']);prop['chart.highlight.stroke']=this.parseSingleColorForGradient(prop['chart.highlight.stroke']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);prop['chart.text.color']=this.parseSingleColorForGradient(prop['chart.text.color']);prop['chart.background.
|
170
|
+
prop['chart.crosshairs.color']=this.parseSingleColorForGradient(prop['chart.crosshairs.color']);prop['chart.highlight.stroke']=this.parseSingleColorForGradient(prop['chart.highlight.stroke']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);prop['chart.text.color']=this.parseSingleColorForGradient(prop['chart.text.color']);prop['chart.background.bars.color1']=this.parseSingleColorForGradient(prop['chart.background.bars.color1']);prop['chart.background.bars.color2']=this.parseSingleColorForGradient(prop['chart.background.bars.color2']);prop['chart.background.grid.color']=this.parseSingleColorForGradient(prop['chart.background.grid.color']);prop['chart.background.color']=this.parseSingleColorForGradient(prop['chart.background.color']);prop['chart.color.stroke']=this.parseSingleColorForGradient(prop['chart.color.stroke']);prop['chart.axes.color']=this.parseSingleColorForGradient(prop['chart.axes.color']);};this.reset=function()
|
178
171
|
{};this.parseSingleColorForGradient=function(color)
|
179
172
|
{if(!color||typeof(color)!='string'){return color;}
|
180
|
-
if(color.match(/^gradient\((.*)\)$/i)){
|
173
|
+
if(color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
174
|
+
var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(0,ca.height-prop['chart.margin.bottom'],0,prop['chart.margin.top']);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RGraph.trim(parts[j]));}}
|
181
175
|
return grad?grad:color;};this.drawBevel=this.DrawBevel=function()
|
182
|
-
{var coords=this.coords
|
183
|
-
var h=RGraph.array_sum(arr);co.save();co.strokeStyle='black';co.beginPath();co.rect(x,y,w,h);co.clip();co.shadowColor='black';co.shadowOffsetX=0;co.shadowOffsetY=0;co.shadowBlur=20;co.beginPath();co.rect(x-3,y-3,w+6,h+100);co.lineWidth=5;co.stroke();co.restore();}}}else{for(var i=0;i<coords.length;++i){if(coords[i]){var x=coords[i][0];var y=coords[i][1];var w=coords[i][2];var h=coords[i][3];var xaxispos=prop['chart.
|
176
|
+
{var coords=this.coords,coords2=this.coords2,prop=this.properties,co=this.context,ca=this.canvas;if(prop['chart.grouping']=='stacked'){for(var i=0;i<coords2.length;++i){if(coords2[i]&&coords2[i][0]&&coords2[i][0][0]){var x=coords2[i][0][0];var y=coords2[i][0][1];var w=coords2[i][0][2];var arr=[];for(var j=0;j<coords2[i].length;++j){arr.push(coords2[i][j][3]);}
|
177
|
+
var h=RGraph.array_sum(arr);co.save();co.strokeStyle='black';co.beginPath();co.rect(x,y,w,h);co.clip();co.shadowColor='black';co.shadowOffsetX=0;co.shadowOffsetY=0;co.shadowBlur=20;co.beginPath();co.rect(x-3,y-3,w+6,h+100);co.lineWidth=5;co.stroke();co.restore();}}}else{for(var i=0;i<coords.length;++i){if(coords[i]){var x=coords[i][0];var y=coords[i][1];var w=coords[i][2];var h=coords[i][3];var xaxispos=prop['chart.xaxis.position'];var xaxis_ycoord=((ca.height-this.marginTop-this.marginBottom)/2)+this.marginTop;co.save();co.strokeStyle='black';co.beginPath();co.rect(x,y,w,h);co.clip();co.shadowColor='black';co.shadowOffsetX=0;co.shadowOffsetY=0;co.shadowBlur=20;if(xaxispos=='top'||(xaxispos=='center'&&(y+h)>xaxis_ycoord)){y=y-100;h=h+100;}else{y=y;h=h+100;}
|
184
178
|
co.beginPath();co.rect(x-3,y-3,w+6,h+6);co.lineWidth=5;co.stroke();co.restore();}}}};this.interactiveKeyHighlight=function(index)
|
185
179
|
{this.coords2.forEach(function(value,idx,arr)
|
186
180
|
{if(typeof value[index]=='object'&&value[index]){var x=value[index][0]
|
@@ -190,14 +184,13 @@ var h=value[index][3]
|
|
190
184
|
co.fillStyle=prop['chart.key.interactive.highlight.chart.fill'];co.strokeStyle=prop['chart.key.interactive.highlight.chart.stroke'];co.lineWidth=2;co.strokeRect(x,y,w,h);co.fillRect(x,y,w,h);}});};this.on=function(type,func)
|
191
185
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
192
186
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
193
|
-
return this;};this.drawAboveLabels=function()
|
194
|
-
{var labels=prop['chart.labels.above'],specific=prop['chart.labels.above.specific'],
|
195
|
-
RG.noShadow(this);co.fillStyle=typeof color==='string'?color:prop['chart.text.color'];if(labels&&grouping==='grouped'){for(var i=0,len=data.length,sequentialIndex=0;i<len;i+=1){if(typeof data[i]==='number'&&data[i]>=0){var angle=angle;var halign=(angle?'left':'center');var valign=angle!==0?'center':'bottom';RG.text2(this,{'font':text_font,'size':typeof size==='number'?size:text_size-3,'x':coords2[i][0][0]+(coords2[i][0][2]/2),'y':coords2[i][0][1]-offset,'text':specific?(specific[sequentialIndex]||''):RG.numberFormat(this,Number(typeof data[i]==='object'?data[i][0]:data[i]).toFixed(decimals),unitsPre,unitsPost),'halign':halign,'valign':valign,'angle':angle,'marker':false,'bounding':true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)','tag':'labels.above'});sequentialIndex++;}else if(typeof data[i]==='number'&&data[i]<0){var angle=angle;var halign=angle?'right':'center';var valign=angle!==0?'center':'top';RG.text2(this,{'font':text_font,'size':typeof size==='number'?size:text_size-3,'x':coords2[i][0][0]+(coords2[i][0][2]/2),'y':coords2[i][0][1]+coords2[i][0][3]+offset,'text':specific?(specific[sequentialIndex]||''):RG.numberFormat(this,Number(typeof data[i]==='object'?data[i][0]:data[i]).toFixed(decimals),unitsPre,unitsPost),'halign':halign,'valign':valign,'angle':angle,'bounding':true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)','marker':false,'tag':'labels.above'});sequentialIndex++;}else if(typeof data[i]==='object'){for(var j=0,len2=data[i].length;j<len2;j+=1){var angle=angle;var halign=data[i][j]<0?'right':'left';halign=angle===0?'center':halign;var valign=data[i][j]<0?'top':'bottom';valign=angle!=0?'center':valign;RG.text2(this,{'font':text_font,'size':typeof size==='number'?size:text_size-3,'x':coords2[i][j][0]+(coords2[i][j][2]/2),'y':coords2[i][j][1]+(data[i][j]<0?coords2[i][j][3]+offset:-offset),'text':specific?(specific[sequentialIndex]||''):RG.numberFormat(this,Number(data[i][j]).toFixed(decimals),unitsPre,unitsPost),'halign':halign,'valign':valign,'angle':angle,'bounding':true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)','marker':false,'tag':'labels.above'});sequentialIndex++;}}}}else if(labels&&grouping==='stacked'){for(var i=0,len=data.length,sequentialIndex=0;i<len;i+=1){if(typeof data[i]==='object'){var angle=angle;var halign=angle!=0?'left':'center';var valign=angle!=0?'center':'bottom';RG.text2(this,{'font':text_font,'size':typeof size==='number'?size:text_size-3,'x':coords2[i][0][0]+(coords2[i][0][2]/2),'y':coords2[i][0][1]+(data[i][0]<0?coords2[i][0][3]:0)-offset,'text':specific?(specific[sequentialIndex]||''):RG.numberFormat(this,Number(RG.arraySum(data[i])).toFixed(decimals),unitsPre,unitsPost),'halign':halign,'valign':valign,'angle':angle,'bounding':true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)','marker':false,'tag':'labels.above'});sequentialIndex+=data[i].length;}else{var angle=angle;var halign=angle!=0?'left':'center';var valign=angle!=0?'center':'bottom';RG.text2(this,{'font':text_font,'size':typeof size==='number'?size:text_size-3,'x':coords2[i][0][0]+(coords2[i][0][2]/2),'y':coords2[i][0][1]+(data[i][0]<0?coords2[i][0][3]:0)-offset,'text':specific?(specific[sequentialIndex]||''):RG.numberFormat(this,Number(data[i]).toFixed(decimals),unitsPre,unitsPost),'halign':halign,'valign':valign,'angle':angle,'bounding':true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)','marker':false,'tag':'labels.above'});sequentialIndex++;}}}};this.firstDrawFunc=function()
|
187
|
+
return this;};this.drawLabelsAbove=this.drawAboveLabels=function()
|
188
|
+
{var labels=prop['chart.labels.above'],specific=prop['chart.labels.above.specific'],bold=typeof prop['chart.labels.above.bold']==='boolean'?prop['chart.labels.above.bold']:prop['chart.text.bold'],italic=typeof prop['chart.labels.above.italic']==='boolean'?prop['chart.labels.above.italic']:prop['chart.text.italic'],color=prop['chart.labels.above.color']||prop['chart.text.color'],font=prop['chart.labels.above.font']||prop['chart.labels.above.font'],size=typeof prop['chart.labels.above.size']==='number'?prop['chart.labels.above.size']:prop['chart.text.size'],background=prop['chart.labels.above.background'],decimals=prop['chart.labels.above.decimals'],angle=-1*prop['chart.labels.above.angle'],unitsPre=prop['chart.labels.above.units.pre'],unitsPost=prop['chart.labels.above.units.post'],point=prop['chart.labels.above.point'],thousand=prop['chart.labels.above.thousand'],coords=this.coords,coords2=this.coords2,data=this.data,ldata=RG.arrayLinearize(this.data),offset=prop['chart.labels.above.offset'],text_italic=prop['chart.text.italic'],text_bold=prop['chart.text.bold'],text_color=prop['chart.text.color'],text_font=prop['chart.text.font'],text_size=prop['chart.text.size'],grouping=prop['chart.grouping'];var textConf=RG.getTextConf({object:this,prefix:'chart.labels.above'});RG.noShadow(this);co.fillStyle=textConf.color;if(labels&&grouping==='grouped'){for(var i=0,len=data.length,sequentialIndex=0;i<len;i+=1){if(typeof data[i]==='number'&&data[i]>=0){var angle=angle;var halign=(angle?'left':'center');var valign=angle!==0?'center':'bottom';RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:coords2[i][0][0]+(coords2[i][0][2]/2),y:coords2[i][0][1]-offset,text:specific?(specific[sequentialIndex]||''):RG.numberFormat({object:this,number:Number(typeof data[i]==='object'?data[i][0]:data[i]).toFixed(decimals),unitspre:unitsPre,unitspost:unitsPost,point:point,thousand:thousand}),halign:halign,valign:valign,angle:angle,marker:false,bounding:true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)',tag:'labels.above'});sequentialIndex++;}else if(typeof data[i]==='number'&&data[i]<0){var angle=angle;var halign=angle?'right':'center';var valign=angle!==0?'center':'top';RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:coords2[i][0][0]+(coords2[i][0][2]/2),y:coords2[i][0][1]+coords2[i][0][3]+offset,text:specific?(specific[sequentialIndex]||''):RG.numberFormat({object:this,number:Number(typeof data[i]==='object'?data[i][0]:data[i]).toFixed(decimals),unitspre:unitsPre,unitspost:unitsPost}),halign:halign,valign:valign,angle:angle,bounding:true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)',marker:false,tag:'labels.above'});sequentialIndex++;}else if(typeof data[i]==='object'){for(var j=0,len2=data[i].length;j<len2;j+=1){var angle=angle;var halign=data[i][j]<0?'right':'left';halign=angle===0?'center':halign;var valign=data[i][j]<0?'top':'bottom';valign=angle!=0?'center':valign;RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:coords2[i][j][0]+(coords2[i][j][2]/2),y:coords2[i][j][1]+(data[i][j]<0?coords2[i][j][3]+offset:-offset),text:specific?(specific[sequentialIndex]||''):RG.numberFormat({object:this,number:Number(data[i][j]).toFixed(decimals),unitspre:unitsPre,unitspost:unitsPost}),halign:halign,valign:valign,angle:angle,bounding:true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)',marker:false,tag:'labels.above'});sequentialIndex++;}}}}else if(labels&&grouping==='stacked'){for(var i=0,len=data.length,sequentialIndex=0;i<len;i+=1){if(typeof data[i]==='object'){var angle=angle;var halign=angle!=0?'left':'center';var valign=angle!=0?'center':'bottom';RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:coords2[i][0][0]+(coords2[i][0][2]/2),y:coords2[i][0][1]+(data[i][0]<0?coords2[i][0][3]:0)-offset,text:specific?(specific[sequentialIndex]||''):RG.numberFormat({object:this,number:Number(RG.arraySum(data[i])).toFixed(decimals),unitspre:unitsPre,unitspost:unitsPost}),halign:halign,valign:valign,angle:angle,bounding:true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)',marker:false,tag:'labels.above'});sequentialIndex+=data[i].length;}else{var angle=angle;var halign=angle!=0?'left':'center';var valign=angle!=0?'center':'bottom';RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:coords2[i][0][0]+(coords2[i][0][2]/2),y:coords2[i][0][1]+(data[i][0]<0?coords2[i][0][3]:0)-offset,text:specific?(specific[sequentialIndex]||''):RG.numberFormat({object:this,number:Number(data[i]).toFixed(decimals),unitspre:unitsPre,unitspost:unitsPost}),halign:halign,valign:valign,angle:angle,bounding:true,'bounding.fill':background,'bounding.stroke':'rgba(0,0,0,0)',marker:false,tag:'labels.above'});sequentialIndex++;}}}};this.firstDrawFunc=function()
|
196
189
|
{};this.wave=function()
|
197
|
-
{var obj=this,opt=arguments[0]||{},labelsAbove=this.get('
|
198
|
-
obj.draw();obj.
|
190
|
+
{var obj=this,opt=arguments[0]||{},labelsAbove=this.get('chart.labels.above');opt.frames=opt.frames||60;opt.startFrames=[];opt.counters=[];var framesperbar=opt.frames/3,frame=-1,callback=arguments[1]||function(){},original=RG.arrayClone(this.original_data);this.set('labelsAbove',false);for(var i=0,len=obj.data.length;i<len;i+=1){opt.startFrames[i]=((opt.frames/2)/(obj.data.length-1))*i;if(typeof obj.data[i]==='object'&&obj.data[i]){opt.counters[i]=[];for(var j=0;j<obj.data[i].length;j++){opt.counters[i][j]=0;}}else{opt.counters[i]=0;}}
|
191
|
+
obj.draw();obj.set('chart.yaxis.scale.max',obj.scale2.max);RG.clear(obj.canvas);function iterator()
|
199
192
|
{++frame;for(var i=0,len=obj.data.length;i<len;i+=1){if(frame>opt.startFrames[i]){if(typeof obj.data[i]==='number'){obj.data[i]=ma.min(ma.abs(original[i]),ma.abs(original[i]*((opt.counters[i]++)/framesperbar)));if(original[i]<0){obj.data[i]*=-1;}}else if(!RG.isNull(obj.data[i])){for(var j=0,len2=obj.data[i].length;j<len2;j+=1){obj.data[i][j]=ma.min(ma.abs(original[i][j]),ma.abs(original[i][j]*((opt.counters[i][j]++)/framesperbar)));if(original[i][j]<0){obj.data[i][j]*=-1;}}}}else{obj.data[i]=typeof obj.data[i]==='object'&&obj.data[i]?RG.arrayPad([],obj.data[i].length,0):(RG.isNull(obj.data[i])?null:0);}}
|
200
|
-
if(frame>=opt.frames){if(labelsAbove){obj.set('
|
193
|
+
if(frame>=opt.frames){if(labelsAbove){obj.set('chart.labels.above',true);RG.redraw();}
|
201
194
|
callback(obj);}else{RG.redrawCanvas(obj.canvas);RG.Effects.updateCanvas(iterator);}}
|
202
195
|
iterator();return this;};this.colorWave=function()
|
203
196
|
{var obj=this,opt=arguments[0]||{};opt.frames=opt.frames||60;opt.startFrames=[];opt.counters=[],colors=obj.properties['chart.colors'];if(colors.length<=obj.data.length){obj.set('chart.colors.sequential',true);colors=RG.arrayPad(colors,obj.data.length,colors[colors.length-1]);}
|
@@ -206,36 +199,39 @@ function iterator()
|
|
206
199
|
{++frame;for(var i=0,len=colors.length;i<len;i+=1){if(frame>opt.startFrames[i]&&colors[i].match(/^rgba?\(([0-9 ]+),([0-9 ]+),([0-9 ]+)(,([ 0-9.]+)?)\)/)){colors[i]='rgba({1},{2},{3},{4})'.format(RegExp.$1,RegExp.$2,RegExp.$3,(frame-opt.startFrames[i])/framesperbar);}else{colors[i]=colors[i].replace(/,[0-9. ]+\)/,',0)');}}
|
207
200
|
if(frame>=opt.frames){callback(obj);}else{RG.redrawCanvas(obj.canvas);RG.Effects.updateCanvas(iterator);}}
|
208
201
|
iterator();return this;};this.grow=function()
|
209
|
-
{var opt=arguments[0]||{},frames=opt.frames||30,frame=0,callback=arguments[1]||function(){},obj=this,labelsAbove=this.get('
|
202
|
+
{var opt=arguments[0]||{},frames=opt.frames||30,frame=0,callback=arguments[1]||function(){},obj=this,labelsAbove=this.get('chart.labels.above')
|
210
203
|
if(RG.isArray(opt.data)){var ymax=0;for(var i=0;i<opt.data.length;++i){if(typeof opt.data[i]==='object'){for(var j=0;j<opt.data[i].length;++j){if(typeof opt.data[i][j]==='string'&&opt.data[i][j].match(/(\+|\-)([0-9]+)/)){if(RegExp.$1==='+'){opt.data[i][j]=this.original_data[i][j]+parseInt(RegExp.$2);}else{opt.data[i][j]=this.original_data[i][j]-parseInt(RegExp.$2);}}
|
211
204
|
ymax=ma.max(ymax,opt.data[i][j]);}}else if(typeof opt.data[i]==='string'&&opt.data[i].match(/(\+|\-)([0-9]+)/)){if(RegExp.$1==='+'){opt.data[i]=this.original_data[i]+parseInt(RegExp.$2);}else{opt.data[i]=this.original_data[i]-parseInt(RegExp.$2);}
|
212
205
|
ymax=ma.max(ymax,opt.data[i]);}else{ymax=ma.max(ymax,opt.data[i]);}}
|
213
|
-
var scale=RG.getScale2(this,{'max':ymax});this.Set('chart.
|
214
|
-
this.set('
|
206
|
+
var scale=RG.getScale2(this,{'scale.max':ymax});this.Set('chart.yaxis.scale.max',scale.max);}
|
207
|
+
this.set('chart.labels.above',false);if(prop['chart.yaxis.scale.max']==null){var ymax=0;for(var i=0;i<obj.data.length;++i){if(RG.isArray(this.data[i])&&prop['chart.grouping']==='stacked'){ymax=ma.max(ymax,ma.abs(RG.arraySum(this.data[i])));}else if(RG.isArray(this.data[i])&&prop['chart.grouping']==='grouped'){for(var j=0,group=[];j<this.data[i].length;j++){group.push(ma.abs(this.data[i][j]));}
|
215
208
|
ymax=ma.max(ymax,ma.abs(RG.arrayMax(group)));}else{ymax=ma.max(ymax,ma.abs(this.data[i]));}}
|
216
|
-
var scale=RG.getScale2(this,{'max':ymax});this.Set('chart.
|
209
|
+
var scale=RG.getScale2(this,{'scale.max':ymax});this.Set('chart.yaxis.scale.max',scale.max);}
|
217
210
|
if(typeof opt.ymax==='number'){obj.set('ymax',opt.ymax);}
|
218
211
|
var iterator=function()
|
219
212
|
{var easingMultiplier=RG.Effects.getEasingMultiplier(frames,frame);for(var j=0,len=obj.original_data.length;j<len;++j){if(typeof obj.data[j]==='object'&&!RG.isNull(obj.data[j])){for(var k=0,len2=obj.data[j].length;k<len2;++k){if(obj.firstDraw||!opt.data){obj.data[j][k]=easingMultiplier*obj.original_data[j][k];}else if(opt.data&&opt.data.length===obj.original_data.length){var diff=opt.data[j][k]-obj.original_data[j][k];obj.data[j][k]=(easingMultiplier*diff)+obj.original_data[j][k];}}}else{if(obj.firstDraw||!opt.data){obj.data[j]=easingMultiplier*obj.original_data[j];}else if(opt.data&&opt.data.length===obj.original_data.length){var diff=opt.data[j]-obj.original_data[j];obj.data[j]=(easingMultiplier*diff)+obj.original_data[j];}}}
|
220
213
|
RG.redrawCanvas(obj.canvas);if(frame<frames){frame+=1;RG.Effects.updateCanvas(iterator);}else{if(RG.isArray(opt.data)){var linear_data=RG.arrayLinearize(data);for(var i=0;i<linear_data.length;++i){if(!obj['$'+i]){obj['$'+i]={};}}}
|
221
|
-
obj.data=data;obj.original_data=RG.arrayClone(data);if(labelsAbove){obj.set('
|
214
|
+
obj.data=data;obj.original_data=RG.arrayClone(data);if(labelsAbove){obj.set('chart.labels.above',true);RG.redraw();}
|
222
215
|
callback(obj);}};iterator();return this;};this.drawErrorbars=function()
|
223
216
|
{var coords=this.coords,color=prop['chart.errorbars.color']||'black',default_halfwidth=ma.min(prop['chart.errorbars.capped.width'],coords[0][2])/2,x=0,errorbars=prop['chart.errorbars'],length=0;if(!prop['chart.errorbars.capped']){prop['chart.errorbars.capped.width']=0;halfwidth=0;}
|
224
|
-
co.lineWidth=prop['chart.errorbars.linewidth'];for(var i=0;i<coords.length;++i){
|
217
|
+
co.lineWidth=prop['chart.errorbars.linewidth'];for(var i=0;i<coords.length;++i){var barX=coords[i][0],barY=coords[i][1],barW=coords[i][2],barH=coords[i][3];var groupedIndexes=RG.sequentialIndexToGrouped(i,this.data);if(typeof this.data[groupedIndexes[0]]==='object'&&!RG.isNull(this.data[groupedIndexes[0]])){var isGrouped=true,group=groupedIndexes[0],subgroup=groupedIndexes[1];}
|
218
|
+
color=prop['chart.errorbars.color']||'black';if(errorbars[i]&&typeof errorbars[i][3]==='number'){co.lineWidth=errorbars[i][3];}
|
225
219
|
var halfwidth=(errorbars[i]&&typeof errorbars[i][4]==='number')?errorbars[i][4]/2:default_halfwidth;if(!prop['chart.errorbars.capped']){halfwidth=0;}
|
226
|
-
if(typeof errorbars[i]==='number'){length=ma.abs(this.getYCoord(errorbars[i])-this.getYCoord(0));if(length){pa2(co,'b m % % l % % l % % l % % s %',
|
220
|
+
if(typeof errorbars[i]==='number'){length=ma.abs(this.getYCoord(errorbars[i])-this.getYCoord(0));if(length){pa2(co,'b m % % l % % l % % l % % s %',barX+(barW/2),(typeof this.data[i]==='number'&&this.data[i]<0||(isGrouped&&this.data[group][subgroup]<0))?barY+barH:barY,barX+(barW/2),(typeof this.data[i]==='number'&&this.data[i]<0||(isGrouped&&this.data[group][subgroup]<0))?barY+barH+length:barY-length,barX+(barW/2)-halfwidth,(typeof this.data[i]==='number'&&this.data[i]<0||(isGrouped&&this.data[group][subgroup]<0))?ma.round(barY+barH+length):ma.round(barY-length),barX+(barW/2)+halfwidth,(typeof this.data[i]==='number'&&this.data[i]<0||(isGrouped&&this.data[group][subgroup]<0))?ma.round(barY+barH+length):ma.round(barY-length),color);}}else if(typeof errorbars[i]==='object'&&!RG.isNull(errorbars[i])){var positiveLength=ma.abs(this.getYCoord(errorbars[i][0])-this.getYCoord(0));if(typeof errorbars[i][1]==='string'){color=errorbars[i][1];}else if(typeof errorbars[i][2]==='string'){color=errorbars[i][2];}
|
227
221
|
halfwidth=typeof errorbars[i][4]==='number'?errorbars[i][4]/2:default_halfwidth;if(!prop['chart.errorbars.capped']){halfwidth=0;}
|
228
|
-
if(!RG.isNull(errorbars[i][0])){pa2(co,'b m % % l % % l % % l % % s %',
|
229
|
-
if(typeof errorbars[i][1]==='number'){var negativeLength=ma.abs(this.getYCoord(errorbars[i][1])-this.getYCoord(0));pa2(co,'b m % % l % % l % % l % % s %',
|
222
|
+
if(!RG.isNull(errorbars[i][0])){pa2(co,'b m % % l % % l % % l % % s %',barX+(barW/2),barY+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),barX+(barW/2),barY-positiveLength+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),barX+(barW/2)-halfwidth,ma.round(barY-positiveLength)+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),barX+(barW/2)+halfwidth,ma.round(barY-positiveLength)+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),color);}
|
223
|
+
if(typeof errorbars[i][1]==='number'){var negativeLength=ma.abs(this.getYCoord(errorbars[i][1])-this.getYCoord(0));pa2(co,'b m % % l % % l % % l % % s %',barX+(barW/2),barY+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),barX+(barW/2),barY+negativeLength+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),barX+(barW/2)-halfwidth,ma.round(coords[i][1]+negativeLength)+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),barX+(barW/2)+halfwidth,ma.round(barY+negativeLength)+(this.data[i]<0?barH:0)+((isGrouped&&this.data[group][subgroup]<0)?barH:0),color);}}
|
230
224
|
if(errorbars[i]&&typeof errorbars[i][3]==='number'){co.lineWidth=prop['chart.errorbars.linewidth'];}}};this.isAdjustable=function(shape)
|
231
225
|
{if(RG.isNull(prop['chart.adjustable.only'])||!RG.isArray(prop['chart.adjustable.only'])){return true;}
|
232
226
|
if(RG.isArray(prop['chart.adjustable.only'])&&prop['chart.adjustable.only'][shape.index]){return true;}
|
233
|
-
return false;};RG.register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};RGraph.CombinedChart=function()
|
227
|
+
return false;};RG.register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};RGraph.Combined=RGraph.CombinedChart=function()
|
234
228
|
{this.objects=[];var objects=[];if(RGraph.isArray(arguments[0])){objects=arguments[0];}else{for(var i=0;i<arguments.length;i+=1){objects[i]=arguments[i];}}
|
235
|
-
for(var i=0;i<objects.length;++i){this.objects[i]=objects[i];this.objects[i].set({
|
229
|
+
for(var i=0;i<objects.length;++i){this.objects[i]=objects[i];this.objects[i].set({marginLeft:this.objects[0].get('chart.margin.left'),marginRight:this.objects[0].get('chart.margin.right'),marginTop:this.objects[0].get('chart.margin.top'),marginBottom:this.objects[0].get('chart.margin.bottom')});if(this.objects[i].type=='line'){var obj=this.objects[i];obj.set('hmargin',((this.objects[0].canvas.width-this.objects[0].get('chart.margin.right')-this.objects[0].get('chart.margin.left'))/this.objects[0].data.length)/2);obj.set('axes',false);obj.set('chart.background.grid',false);obj.set('chart.yaxis.labels',false);}
|
236
230
|
if(this.objects[i].get('chart.resizable')){var resizable_object=obj;}}
|
237
231
|
if(resizable_object){function myOnresizebeforedraw(obj)
|
238
|
-
{var
|
239
|
-
RGraph.AddCustomEventListener(resizable_object,'onresizebeforedraw',myOnresizebeforedraw);}
|
240
|
-
|
241
|
-
{
|
232
|
+
{var marginLeft=obj.get('chart.margin.left');var marginRight=obj.get('chart.margin.right');obj.set('hmargin',(obj.canvas.width-marginLeft-marginRight)/(obj.original_data[0].length*2));}
|
233
|
+
RGraph.AddCustomEventListener(resizable_object,'onresizebeforedraw',myOnresizebeforedraw);}
|
234
|
+
return this;};RGraph.Combined.prototype.add=RGraph.CombinedChart.prototype.add=RGraph.CombinedChart.prototype.Add=function(obj)
|
235
|
+
{this.objects.push(obj);return this;};RGraph.Combined.prototype.draw=RGraph.CombinedChart.prototype.draw=RGraph.CombinedChart.prototype.Draw=function()
|
236
|
+
{if(RGraph.isArray(this.objects)){for(var i=0;i<this.objects.length;++i){if(this.objects[i].properties['chart.combined.effect']){var options=this.objects[i].properties['chart.combined.effect.options']?eval('('+this.objects[i].properties['chart.combined.effect.options']+')'):null,callback=this.objects[i].properties['chart.combined.effect.callback'],func=this.objects[i].properties['chart.combined.effect'];(this.objects[i][func])(options,callback);}else{this.objects[i].draw();}}}
|
237
|
+
return this;};
|
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Bipolar=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.left==='object'&&typeof conf.right==='object'&&typeof conf.id==='string'){var id=conf.id,canvas=document.getElementById(id),left=conf.left,right=conf.right,parseConfObjectForOptions=true}else{var id=conf,canvas=document.getElementById(id),left=arguments[1],right=arguments[2]}
|
4
|
-
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.type='bipolar';this.coords=[];this.coords2=[];this.coordsLeft=[];this.coordsRight=[];this.coords2Left=[];this.coords2Right=[];this.max=0;this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.coordsText=[];this.original_colors=[];this.firstDraw=true;var data=[left,right];for(var i=0;i<2;++i){data[i].forEach(function(v,k,arr)
|
4
|
+
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.type='bipolar';this.coords=[];this.coords2=[];this.coordsLeft=[];this.coordsRight=[];this.coords2Left=[];this.coords2Right=[];this.max=0;this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.propertyNameAliases={};var data=[left,right];for(var i=0;i<2;++i){data[i].forEach(function(v,k,arr)
|
5
5
|
{if(RGraph.isNull(v)){}else if(typeof v==='object'){v.forEach(function(v2,k2,arr2)
|
6
6
|
{arr[k][k2]=parseFloat(v2);});}else{arr[k]=parseFloat(v);}
|
7
7
|
arr[k]=RGraph.stringsToNumbers(arr[k]);});}
|
8
|
-
this.left=left;this.right=right;this.data=[left,right];this.properties={'chart.background.grid':true,'chart.background.grid.color':'#ddd','chart.background.grid.vlines':true,'chart.background.grid.hlines':true,'chart.background.grid.linewidth':1,'chart.background.grid.
|
9
|
-
this.properties['chart.
|
8
|
+
this.left=left;this.right=right;this.data=[left,right];this.properties={'chart.background.grid':true,'chart.background.grid.color':'#ddd','chart.background.grid.vlines':true,'chart.background.grid.hlines':true,'chart.background.grid.linewidth':1,'chart.background.grid.vlines.count':null,'chart.background.grid.hlines.count':null,'chart.vmargin':5,'chart.vmargin.grouped':3,'chart.xaxis':true,'chart.xaxis.tickmarks.count':5,'chart.xaxis.tickmarks.interval':null,'chart.xaxis.scale.units.pre':'','chart.xaxis.scale.units.post':'','chart.xaxis.scale.max':null,'chart.xaxis.scale.min':0,'chart.xaxis.scale.zerostart':true,'chart.xaxis.scale.decimals':null,'chart.xaxis.scale.point':'.','chart.xaxis.scale.thousand':',','chart.xaxis.labels':true,'chart.xaxis.labels.font':null,'chart.xaxis.labels.size':null,'chart.xaxis.labels.color':null,'chart.xaxis.labels.bold':null,'chart.xaxis.labels.italic':null,'chart.xaxis.labels.count':5,'chart.yaxis':true,'chart.yaxis.tickmarks.count':null,'chart.yaxis.labels':[],'chart.yaxis.labels.font':null,'chart.yaxis.labels.size':null,'chart.yaxis.labels.color':null,'chart.yaxis.labels.bold':null,'chart.yaxis.labels.italic':null,'chart.labels.above':false,'chart.labels.above.font':null,'chart.labels.above.size':null,'chart.labels.above.bold':null,'chart.labels.above.italic':null,'chart.labels.above.color':null,'chart.labels.above.units.pre':'','chart.labels.above.units.post':'','chart.labels.above.decimals':0,'chart.labels.above.formatter':null,'chart.text.bold':false,'chart.text.italic':false,'chart.text.size':12,'chart.text.color':'black','chart.text.font':'Arial, Verdana, sans-serif','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.title.left':null,'chart.title.left.font':null,'chart.title.left.size':null,'chart.title.left.bold':null,'chart.title.left.italic':null,'chart.title.left.color':null,'chart.title.right':null,'chart.title.right.font':null,'chart.title.right.size':null,'chart.title.right.bold':null,'chart.title.right.italic':null,'chart.title.right.color':null,'chart.margin.center':0,'chart.margin.center.auto':true,'chart.margin.left':25,'chart.margin.right':25,'chart.margin.top':25,'chart.margin.bottom':30,'chart.title':null,'chart.title.font':null,'chart.title.size':null,'chart.title.bold':null,'chart.title.italic':null,'chart.title.color':null,'chart.title.background':null,'chart.title.hpos':null,'chart.title.vpos':null,'chart.title.x':null,'chart.title.y':null,'chart.title.halign':null,'chart.title.valign':null,'chart.colors.stroke':'rgba(0,0,0,0)','chart.colors':['#afa','#faa','#aaf','#aff','#ffa','#faf','cyan','brown','gray','black','pink','#afa','#faa','#aaf','#aff','#ffa','#faf','cyan','brown','gray','black','pink'],'chart.colors.sequential':false,'chart.contextmenu':null,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.highlight':true,'chart.tooltips.event':'onclick','chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.shadow':false,'chart.shadow.color':'#ccc','chart.shadow.offsetx':3,'chart.shadow.offsety':3,'chart.shadow.blur':3,'chart.annotatable':false,'chart.annotatable.color':'black','chart.axes':true,'chart.axes.color':'black','chart.axes.linewidth':1,'chart.resizable':false,'chart.resizable.handle.background':null,'chart.events.mousemove':null,'chart.events.click':null,'chart.linewidth':1,'chart.variant.threed.offsetx':10,'chart.variant.threed.offsety':5,'chart.variant.threed.angle':0.1,'chart.grouping':'grouped','chart.clearto':'rgba(0,0,0,0)'}
|
9
|
+
this.properties['chart.yaxis.tickmarks.count']=this.left.length;var linear_data=RGraph.arrayLinearize(this.left,this.right);for(var i=0;i<linear_data.length;++i){this['$'+i]={};}
|
10
10
|
if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
11
11
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
12
12
|
if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
|
@@ -14,50 +14,48 @@ this.set=this.Set=function(name)
|
|
14
14
|
{var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
|
15
15
|
if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
16
16
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
17
|
-
if(name==='chart.vmargin'){name='chart.margin';}
|
18
|
-
if(name==='chart.vmargin.grouped'){name='chart.margin.grouped';}
|
19
17
|
prop[name]=value;return this;};this.get=this.Get=function(name)
|
20
18
|
{if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
21
19
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
22
20
|
return this.properties[name.toLowerCase()];};this.draw=this.Draw=function()
|
23
21
|
{RG.fireCustomEvent(this,'onbeforedraw');if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
24
|
-
this.
|
25
|
-
this.
|
26
|
-
this.axisWidth=(ca.width-prop['chart.
|
22
|
+
this.marginLeft=prop['chart.margin.left'];this.marginRight=prop['chart.margin.right'];this.marginTop=prop['chart.margin.top'];this.marginBottom=prop['chart.margin.bottom'];this.marginCenter=prop['chart.margin.center'];this.marginCenterAuto=prop['chart.margin.center.auto'];if(prop['chart.margin.center.auto']&&!prop['chart.margin.center']){prop['chart.margin.center']=this.getMarginCenter();}
|
23
|
+
this.marginCenter=prop['chart.margin.center'];this.left=this.data[0];this.right=this.data[1];this.coords=[];this.coords2=[];this.coordsLeft=[];this.coordsRight=[];this.coords2Left=[];this.coords2Right=[];this.coordsText=[];if(prop['chart.variant']==='3d'){if(prop['chart.text.accessible']){}else{co.setTransform(1,prop['chart.variant.threed.angle'],0,1,0.5,0.5);}}
|
24
|
+
this.axisWidth=(ca.width-prop['chart.margin.center']-this.marginLeft-this.marginRight)/2;this.axisHeight=ca.height-this.marginTop-this.marginBottom;this.sequentialFullIndex=0;this.getMax();this.drawBackgroundGrid();this.draw3DAxes();this.drawAxes();this.drawTicks();this.drawLeftBars();this.drawRightBars();this.drawLeftBars({shadow:false});this.drawRightBars({shadow:false});this.drawAxes();this.drawLabels();this.drawTitles();if(prop['chart.contextmenu']){RG.ShowContext(this);}
|
27
25
|
if(prop['chart.resizable']){RG.AllowResizing(this);}
|
28
26
|
RG.InstallEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
29
27
|
RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
30
28
|
{func(this);return this;};this.draw3DAxes=function()
|
31
|
-
{if(prop['chart.variant']==='3d'){var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];co.lineWidth=prop['chart.
|
29
|
+
{if(prop['chart.variant']==='3d'){var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];co.lineWidth=prop['chart.axes.linewidth']+0.001;co.beginPath();co.strokeStyle=prop['chart.axes.color'];pa2(co,'b m % % l % % l % % l % % s #aaa f #ddd',this.marginLeft,ca.height-this.marginBottom,this.marginLeft+offsetx,ca.height-this.marginBottom-offsety,this.marginLeft+offsetx+this.axisWidth,ca.height-this.marginBottom-offsety,this.marginLeft+this.axisWidth,ca.height-this.marginBottom);this.draw3DLeftVerticalAxis();pa2(co,'b m % % l % % l % % l % % s #aaa f #ddd',this.marginLeft+this.marginCenter+this.axisWidth,ca.height-this.marginBottom,this.marginLeft+this.marginCenter+this.axisWidth+offsetx,ca.height-this.marginBottom-offsety,this.marginLeft+this.marginCenter+this.axisWidth+this.axisWidth+offsetx,ca.height-this.marginBottom-offsety,this.marginLeft+this.marginCenter+this.axisWidth+this.axisWidth,ca.height-this.marginBottom);pa2(co,'b m % % l % % l % % l % % s #aaa f #ddd',this.marginLeft+this.marginCenter+this.axisWidth,ca.height-this.marginBottom,this.marginLeft+this.marginCenter+this.axisWidth,ca.height-this.marginBottom-this.axisHeight,this.marginLeft+this.marginCenter+this.axisWidth+offsetx,ca.height-this.marginBottom-this.axisHeight-offsety,this.marginLeft+this.marginCenter+this.axisWidth+offsetx,ca.height-this.marginBottom-offsety);}}
|
32
30
|
this.draw3DLeftVerticalAxis=function()
|
33
|
-
{if(prop['chart.variant']==='3d'){var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];pa2(co,'b m % % l % % l % % l % % s #aaa f #ddd',this.
|
34
|
-
{co.lineWidth=prop['chart.
|
35
|
-
if(
|
36
|
-
if(
|
37
|
-
co.stroke();co.beginPath();var x=this.
|
38
|
-
if(
|
31
|
+
{if(prop['chart.variant']==='3d'){var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];pa2(co,'b m % % l % % l % % l % % s #aaa f #ddd',this.marginLeft+this.axisWidth,this.marginTop,this.marginLeft+this.axisWidth+offsetx,this.marginTop-offsety,this.marginLeft+this.axisWidth+offsetx,ca.height-this.marginBottom-offsety,this.marginLeft+this.axisWidth,ca.height-this.marginBottom);}};this.drawAxes=this.DrawAxes=function()
|
32
|
+
{co.lineWidth=prop['chart.axes.linewidth']+0.001;co.beginPath();co.strokeStyle=prop['chart.axes.color'];this.axisWidth=(ca.width-prop['chart.margin.center']-this.marginLeft-this.marginRight)/2;this.axisHeight=ca.height-this.marginTop-this.marginBottom;if(!prop['chart.axes']){return;}
|
33
|
+
if(prop['chart.xaxis']){co.moveTo(this.marginLeft,ca.height-this.marginBottom);co.lineTo(this.marginLeft+this.axisWidth,ca.height-this.marginBottom);}
|
34
|
+
if(prop['chart.yaxis']){co.moveTo(this.marginLeft+this.axisWidth,ca.height-this.marginBottom);co.lineTo(this.marginLeft+this.axisWidth,this.marginTop);}
|
35
|
+
co.stroke();co.beginPath();var x=this.marginLeft+this.axisWidth+prop['chart.margin.center'];if(prop['chart.yaxis']){co.moveTo(x,this.marginTop);co.lineTo(x,ca.height-this.marginBottom);}
|
36
|
+
if(prop['chart.xaxis']){co.moveTo(x,ca.height-this.marginBottom);co.lineTo(ca.width-this.marginRight,ca.height-this.marginBottom);}
|
39
37
|
co.stroke();};this.drawTicks=this.DrawTicks=function()
|
40
|
-
{co.lineWidth=prop['chart.
|
41
|
-
if(
|
42
|
-
co.stroke();co.beginPath();for(var i=0;i<prop['chart.
|
43
|
-
co.stroke();if(prop['chart.
|
44
|
-
if(
|
45
|
-
for(i=this.
|
46
|
-
var stoppingPoint=ca.width-this.
|
47
|
-
if(prop['chart.
|
48
|
-
{var dec=prop['chart.scale.decimals'];if(prop['chart.
|
38
|
+
{co.lineWidth=prop['chart.axes.linewidth']+0.001;var numDataPoints=this.left.length;var barHeight=((ca.height-this.marginTop-this.marginBottom)-(this.left.length*(prop['chart.vmargin']*2)))/numDataPoints;this.barHeight=barHeight;if(!prop['chart.axes']){return;}
|
39
|
+
if(prop['chart.yaxis']&&prop['chart.yaxis.tickmarks.count']>0){co.beginPath();for(var i=0;i<prop['chart.yaxis.tickmarks.count'];++i){var y=prop['chart.margin.top']+(((ca.height-this.marginTop-this.marginBottom)/prop['chart.yaxis.tickmarks.count'])*i);co.moveTo(this.marginLeft+this.axisWidth,y);co.lineTo(this.marginLeft+this.axisWidth+3,y);}
|
40
|
+
co.stroke();co.beginPath();for(var i=0;i<prop['chart.yaxis.tickmarks.count'];++i){var y=prop['chart.margin.top']+(((ca.height-this.marginTop-this.marginBottom)/prop['chart.yaxis.tickmarks.count'])*i);co.moveTo(this.marginLeft+this.axisWidth+prop['chart.margin.center'],y);co.lineTo(this.marginLeft+this.axisWidth+prop['chart.margin.center']-3,y);}
|
41
|
+
co.stroke();if(!prop['chart.xaxis']){pa2(co,'b m % % l % % s %',this.marginLeft+this.axisWidth,ca.height-this.marginBottom,this.marginLeft+this.axisWidth+4,(ca.height-this.marginBottom),co.strokeStyle);pa2(co,'b m % % l % % s %',this.marginLeft+this.axisWidth+prop['chart.margin.center'],ca.height-this.marginBottom,this.marginLeft+this.axisWidth+prop['chart.margin.center']-4,ca.height-this.marginBottom,co.strokeStyle);}}
|
42
|
+
if(prop['chart.xaxis']&&prop['chart.xaxis.tickmarks.count']>0){var xInterval=this.axisWidth/prop['chart.xaxis.tickmarks.count'];if(typeof(prop['chart.xaxis.tickmarks.interval'])=='number'){xInterval=prop['chart.xaxis.tickmarks.interval'];}
|
43
|
+
for(i=this.marginLeft;i<(this.marginLeft+this.axisWidth);i+=xInterval){co.beginPath();co.moveTo(i,ca.height-this.marginBottom);co.lineTo(i,(ca.height-this.marginBottom)+4);co.closePath();co.stroke();}
|
44
|
+
var stoppingPoint=ca.width-this.marginRight;for(i=(this.marginLeft+this.axisWidth+prop['chart.margin.center']+xInterval);i<=stoppingPoint;i+=xInterval){co.beginPath();co.moveTo(i,ca.height-this.marginBottom);co.lineTo(i,(ca.height-this.marginBottom)+4);co.closePath();co.stroke();}
|
45
|
+
if(!prop['chart.yaxis']){pa2(co,'b m % % l % % s %',this.marginLeft+this.axisWidth,ca.height-this.marginBottom,this.marginLeft+this.axisWidth,(ca.height-this.marginBottom)+4,co.strokeStyle);pa2(co,'b m % % l % % s %',this.marginLeft+this.axisWidth+prop['chart.margin.center'],ca.height-this.marginBottom,this.marginLeft+this.axisWidth+prop['chart.margin.center'],(ca.height-this.marginBottom)+4,co.strokeStyle);}}};this.getMax=this.GetMax=function()
|
46
|
+
{var dec=prop['chart.xaxis.scale.decimals'];if(prop['chart.xaxis.scale.max']){var max=prop['chart.xaxis.scale.max'];var min=prop['chart.xaxis.scale.min'];this.scale2=RG.getScale2(this,{'scale.max':max,'scale.min':min,'scale.strict':true,'scale.thousand':prop['chart.xaxis.scale.thousand'],'scale.point':prop['chart.xaxis.scale.point'],'scale.decimals':prop['chart.xaxis.scale.decimals'],'scale.labels.count':prop['chart.xaxis.labels.count'],'scale.round':prop['chart.xaxis.scale.round'],'scale.units.pre':prop['chart.xaxis.scale.units.pre'],'scale.units.post':prop['chart.xaxis.scale.units.post']});this.max=this.scale2.max;this.min=this.scale2.min;}else{var max=1;for(var i=0;i<this.left.length;++i){if(typeof this.left[i]==='number'){max=ma.max(max,this.left[i]);}else if(RG.isNull(this.left[i])){}else{max=ma.max(max,prop['chart.grouping']==='stacked'?RG.arraySum(this.left[i]):RG.arrayMax(this.left[i]));}}
|
49
47
|
for(var i=0;i<this.right.length;++i){if(typeof this.right[i]==='number'){max=ma.max(max,this.right[i]);}else if(RG.isNull(this.right[i])){}else{max=ma.max(max,prop['chart.grouping']==='stacked'?RG.arraySum(this.right[i]):RG.arrayMax(this.right[i]));}}
|
50
|
-
this.scale2=RG.getScale2(this,{max:max,min:prop['chart.
|
48
|
+
this.scale2=RG.getScale2(this,{'scale.max':max,'scale.min':prop['chart.xsxis.scale.min'],'scale.thousand':prop['chart.xaxis.scale.thousand'],'scale.point':prop['chart.xaxis.scale.point'],'scale.decimals':prop['chart.xaxis.scale.decimals'],'scale.labels.count':prop['chart.xaxis.labels.count'],'scale.round':prop['chart.xaxis.scale.round'],'scale.units.pre':prop['chart.xaxis.scale.units.pre'],'scale.units.post':prop['chart.xaxis.scale.units.post']});this.max=this.scale2.max;this.min=this.scale2.min;}};this.drawLeftBars=this.DrawLeftBars=function()
|
51
49
|
{var opt={};if(typeof arguments[0]==='object'){opt.shadow=arguments[0].shadow;}else{opt.shadow=true;}
|
52
|
-
var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];co.strokeStyle=prop['chart.
|
50
|
+
var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];co.strokeStyle=prop['chart.colors.stroke'];co.lineWidth=prop['chart.linewidth'];for(var i=0,sequentialColorIndex=0;i<this.left.length;++i){if(prop['chart.shadow']&&prop['chart.variant']!=='3d'&&opt.shadow){RG.setShadow({object:this,prefix:'chart.shadow'});}
|
53
51
|
if(typeof this.left[i]==='number'){if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][0];if(prop['chart.colors'].length===2){co.fillStyle=prop['chart.colors'][0];}}
|
54
|
-
var width=(((this.left[i]-this.min)/(this.max-this.min))*this.axisWidth);var coords=[
|
52
|
+
var width=(((this.left[i]-this.min)/(this.max-this.min))*this.axisWidth);var coords=[this.marginLeft+this.axisWidth-width,this.marginTop+(i*(this.axisHeight/this.left.length))+prop['chart.vmargin'],width,this.barHeight];if(this.left[i]!==null){co.strokeRect(coords[0],coords[1],coords[2],coords[3]);co.fillRect(coords[0],coords[1],coords[2],coords[3]);}
|
55
53
|
if(prop['chart.variant']==='3d'&&this.left[i]!==null){if(prop['chart.shadow']&&opt.shadow){co.shadowColor=prop['chart.shadow.color'];co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];pa2(co,'b m % % l % % l % % l % % f black sc rgba(0,0,0,0) sx 0 sy 0 sb 0',coords[0]+offsetx,coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety+coords[3],coords[0]+offsetx,coords[1]-offsety+coords[3]);}
|
56
54
|
if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][i];}else{co.fillStyle=prop['chart.colors'][0];}
|
57
55
|
pa2(co,'b m % % l % % l % % l % % f %',coords[0],coords[1],coords[0]+offsetx,coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety,coords[0]+coords[2],coords[1]);pa2(co,'b m % % l % % l % % l % % f rgba(255,255,255,0.4)',coords[0],coords[1],coords[0]+offsetx,coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety,coords[0]+coords[2],coords[1]);}
|
58
56
|
if(!opt.shadow){this.coords.push([coords[0],coords[1],coords[2],coords[3]]);this.coordsLeft.push([coords[0],coords[1],coords[2],coords[3]]);}
|
59
57
|
sequentialColorIndex++;}else if(typeof this.left[i]==='object'&&prop['chart.grouping']==='stacked'){for(var j=0,accumulatedWidth=0;j<this.left[i].length;++j){if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][j];}
|
60
|
-
var value=this.left[i][j],min=this.min,max=this.max,margin=prop['chart.
|
58
|
+
var value=this.left[i][j],min=this.min,max=this.max,margin=prop['chart.vmargin'],width=(((value-min)/(max-min))*this.axisWidth),sectionHeight=(this.axisHeight/this.left.length),height=(sectionHeight-(2*margin)),x=this.marginLeft+this.axisWidth-width-accumulatedWidth,y=this.marginTop+margin+(i*sectionHeight);accumulatedWidth+=width;if(this.left[i]!==null){co.strokeRect(x,y,width,height);co.fillRect(x,y,width,height);}
|
61
59
|
if(prop['chart.variant']==='3d'&&this.left[i]!==null){if(prop['chart.shadow']&&opt.shadow){co.shadowColor=prop['chart.shadow.color'];co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];pa2(co,'b m % % l % % l % % l % % f black sc rgba(0,0,0,0) sx 0 sy 0 sb 0',x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+offsetx+width,y-offsety+height,x+offsetx,y-offsety+height);}
|
62
60
|
if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][j];}
|
63
61
|
pa2(co,'b m % % l % % l % % l % % f %',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y);pa2(co,'b m % % l % % l % % l % % f rgba(255,255,255,0.4)',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y);}
|
@@ -65,7 +63,7 @@ if(!opt.shadow){this.coords.push([x,y,width,height]);this.coordsLeft.push([x,y,w
|
|
65
63
|
this.coords2[i].push([x,y,width,height]);if(!RG.isArray(this.coords2Left[i])){this.coords2Left[i]=[];}
|
66
64
|
this.coords2Left[i].push([x,y,width,height]);}
|
67
65
|
sequentialColorIndex++;}}else if(typeof this.left[i]==='object'&&!RG.isNull(this.left[i])){for(var j=0;j<this.left[i].length;++j){if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][j];}
|
68
|
-
var value=this.left[i][j],min=this.min,max=this.max,margin=prop['chart.
|
66
|
+
var value=this.left[i][j],min=this.min,max=this.max,margin=prop['chart.vmargin'],marginGrouped=prop['chart.vmargin.grouped'],width=(((value-min)/(max-min))*this.axisWidth),sectionHeight=(this.axisHeight/this.left.length),height=(sectionHeight-(2*margin)-((this.left[i].length-1)*marginGrouped))/this.left[i].length,x=this.marginLeft+this.axisWidth-width,y=this.marginTop+margin+(i*sectionHeight)+(height*j)+(j*marginGrouped);if(this.left[i]!==null){co.strokeRect(x,y,width,height);co.fillRect(x,y,width,height);}
|
69
67
|
if(prop['chart.variant']==='3d'&&this.left[i]!==null){if(prop['chart.shadow']&&opt.shadow){co.shadowColor=prop['chart.shadow.color'];co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];pa2(co,'b m % % l % % l % % l % % f black sc rgba(0,0,0,0) sx 0 sy 0 sb 0',x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+offsetx+width,y-offsety+height,x+offsetx,y-offsety+height);}
|
70
68
|
if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][j];}
|
71
69
|
pa2(co,'b m % % l % % l % % l % % f %',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y);pa2(co,'b m % % l % % l % % l % % f rgba(255,255,255,0.4)',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y);}
|
@@ -76,85 +74,84 @@ sequentialColorIndex++;}}
|
|
76
74
|
this.draw3DLeftVerticalAxis();}
|
77
75
|
RG.noShadow(this);co.lineWidth=1;};this.drawRightBars=this.DrawRightBars=function()
|
78
76
|
{var opt={};if(typeof arguments[0]==='object'){opt.shadow=arguments[0].shadow;}else{opt.shadow=true;}
|
79
|
-
var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];co.strokeStyle=prop['chart.
|
77
|
+
var offsetx=prop['chart.variant.threed.offsetx'],offsety=prop['chart.variant.threed.offsety'];co.strokeStyle=prop['chart.colors.stroke'];co.lineWidth=prop['chart.linewidth'];if(prop['chart.shadow']&&prop['chart.variant']!=='3d'&&opt.shadow){co.shadowColor=prop['chart.shadow.color'];co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];}
|
80
78
|
for(var i=0,sequentialColorIndex=RG.arrayLinearize(this.left).length;i<this.right.length;++i){if(typeof this.right[i]==='number'){if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][0];if(prop['chart.colors'].length===2){co.fillStyle=prop['chart.colors'][1];}}
|
81
|
-
var width=(((this.right[i]-this.min)/(this.max-this.min))*this.axisWidth);var coords=[
|
79
|
+
var width=(((this.right[i]-this.min)/(this.max-this.min))*this.axisWidth);var coords=[this.marginLeft+this.axisWidth+prop['chart.margin.center'],prop['chart.vmargin']+(i*(this.axisHeight/this.right.length))+this.marginTop,width,this.barHeight];if(this.right[i]!==null){co.strokeRect(coords[0],coords[1],coords[2],coords[3]);co.fillRect(coords[0],coords[1],coords[2],coords[3]);}
|
82
80
|
if(prop['chart.variant']==='3d'&&this.right[i]!==null){var color=co.fillStyle;if(prop['chart.shadow']&&opt.shadow){co.shadowColor=prop['chart.shadow.color'];co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];pa2(co,'b m % % l % % l % % l % % f black sc rgba(0,0,0,0) sx 0 sy 0 sb 0',coords[0]+offsetx,coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety+coords[3],coords[0]+offsetx,coords[1]-offsety+coords[3]);}
|
83
81
|
pa2(co,'b m % % l % % l % % l % % f %',coords[0],coords[1],coords[0]+offsetx,coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety,coords[0]+coords[2],coords[1],color);pa2(co,'b m % % l % % l % % l % % f %',coords[0]+coords[2],coords[1],coords[0]+coords[2]+offsetx,coords[1]-offsety,coords[0]+coords[2]+offsetx,coords[1]-offsety+coords[3],coords[0]+coords[2],coords[1]+coords[3],color);pa2(co,'b m % % l % % l % % l % % f rgba(255,255,255,0.6)',coords[0],coords[1],coords[0]+offsetx,coords[1]-offsety,coords[0]+offsetx+coords[2],coords[1]-offsety,coords[0]+coords[2],coords[1]);pa2(co,'b m % % l % % l % % l % % f rgba(0,0,0,0.3)',coords[0]+coords[2],coords[1],coords[0]+coords[2]+offsetx,coords[1]-offsety,coords[0]+coords[2]+offsetx,coords[1]-offsety+coords[3],coords[0]+coords[2],coords[1]+coords[3]);}
|
84
82
|
if(!opt.shadow){this.coords.push([coords[0],coords[1],coords[2],coords[3]]);this.coordsRight.push([coords[0],coords[1],coords[2],coords[3]]);}
|
85
83
|
sequentialColorIndex++;}else if(typeof this.left==='object'&&prop['chart.grouping']==='stacked'){for(var j=0,accumulatedWidth=0;j<this.right[i].length;++j){if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][j];}
|
86
|
-
var value=this.right[i][j],min=this.min,max=this.max,margin=prop['chart.
|
87
|
-
if(prop['chart.variant']==='3d'&&this.right[i]!==null){var color=co.fillStyle;if(prop['chart.shadow']&&opt.shadow){
|
84
|
+
var value=this.right[i][j],min=this.min,max=this.max,margin=prop['chart.vmargin'],width=(((value-min)/(max-min))*this.axisWidth),sectionHeight=(this.axisHeight/this.right.length),height=(sectionHeight-(2*margin)),x=this.marginLeft+this.axisWidth+prop['chart.margin.center']+accumulatedWidth,y=this.marginTop+margin+(i*sectionHeight);accumulatedWidth+=width;if(this.right[i]!==null){co.strokeRect(x,y,width,height);co.fillRect(x,y,width,height);}
|
85
|
+
if(prop['chart.variant']==='3d'&&this.right[i]!==null){var color=co.fillStyle;if(prop['chart.shadow']&&opt.shadow){RG.setShadow({object:this,prefix:'chart.shadow'});pa2(co,'b m % % l % % l % % l % % f black sc rgba(0,0,0,0) sx 0 sy 0 sb 0',x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+offsetx+width,y-offsety+height,x+offsetx,y-offsety+height);}
|
88
86
|
pa2(co,'b m % % l % % l % % l % % f %',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y,color);if(j===(this.right[i].length-1)){pa2(co,'b m % % l % % l % % l % % f %',x+width,y,x+width+offsetx,y-offsety,x+width+offsetx,y-offsety+height,x+width,y+height,color);pa2(co,'b m % % l % % l % % l % % f rgba(0,0,0,0.3)',x+width,y,x+width+offsetx,y-offsety,x+width+offsetx,y-offsety+height,x+width,y+height);}
|
89
87
|
pa2(co,'b m % % l % % l % % l % % f rgba(255,255,255,0.6)',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y);}
|
90
88
|
if(!opt.shadow){this.coords.push([x,y,width,height]);if(!RG.isArray(this.coords2[sequentialColorIndex])){this.coords2[sequentialColorIndex]=[];}
|
91
89
|
this.coords2[sequentialColorIndex].push([x,y,width,height]);this.coordsRight.push([x,y,width,height]);if(!RG.isArray(this.coords2Right[i])){this.coords2Right[i]=[];}
|
92
90
|
this.coords2Right[i].push([x,y,width,height]);}
|
93
91
|
sequentialColorIndex++;}}else if(typeof this.right[i]==='object'){for(var j=0;j<this.right[i].length;++j){if(prop['chart.colors.sequential']){co.fillStyle=prop['chart.colors'][sequentialColorIndex];}else{co.fillStyle=prop['chart.colors'][j];}
|
94
|
-
var value=this.right[i][j],min=this.min,max=this.max,margin=prop['chart.
|
92
|
+
var value=this.right[i][j],min=this.min,max=this.max,margin=prop['chart.vmargin'],marginGrouped=prop['chart.vmargin.grouped'],width=((value-min)/(max-min))*this.axisWidth,sectionHeight=(this.axisHeight/this.right.length),height=(sectionHeight-(2*margin)-((this.right[i].length-1)*marginGrouped))/this.right[i].length,x=this.marginLeft+this.axisWidth+prop['chart.margin.center'],y=this.marginTop+margin+(i*sectionHeight)+(height*j)+(j*marginGrouped);if(this.right[i]!==null){co.strokeRect(x,y,width,height);co.fillRect(x,y,width,height);}
|
95
93
|
if(!opt.shadow){this.coords.push([x,y,width,height]);this.coordsRight.push([x,y,width,height]);if(!RG.isArray(this.coords2[this.left.length+i])){this.coords2[this.left.length+i]=[];}
|
96
94
|
this.coords2[this.left.length+i].push([x,y,width,height]);if(!RG.isArray(this.coords2Right[i])){this.coords2Right[i]=[];}
|
97
95
|
this.coords2Right[i].push([x,y,width,height]);}
|
98
96
|
sequentialColorIndex++;if(prop['chart.variant']==='3d'&&this.right[i]!==null){var color=co.fillStyle;if(prop['chart.shadow']&&opt.shadow){co.shadowColor=prop['chart.shadow.color'];co.shadowBlur=prop['chart.shadow.blur'];co.shadowOffsetX=prop['chart.shadow.offsetx'];co.shadowOffsetY=prop['chart.shadow.offsety'];pa2(co,'b m % % l % % l % % l % % f black sc rgba(0,0,0,0) sx 0 sy 0 sb 0',x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+offsetx+width,y-offsety+height,x+offsetx,y-offsety+height);}
|
99
97
|
pa2(co,'b m % % l % % l % % l % % f %',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y,color);pa2(co,'b m % % l % % l % % l % % f %',x+width,y,x+width+offsetx,y-offsety,x+width+offsetx,y-offsety+height,x+width,y+height,color);pa2(co,'b m % % l % % l % % l % % f rgba(255,255,255,0.6)',x,y,x+offsetx,y-offsety,x+offsetx+width,y-offsety,x+width,y);pa2(co,'b m % % l % % l % % l % % f rgba(0,0,0,0.3)',x+width,y,x+width+offsetx,y-offsety,x+width+offsetx,y-offsety+height,x+width,y+height);}}}}
|
100
98
|
RG.noShadow(this);co.lineWidth=1;};this.drawLabels=this.DrawLabels=function()
|
101
|
-
{var
|
102
|
-
co.fillStyle=color;for(var i=0,len=labels.length;i<len;++i){RG.text2(this,{color:color,font:font,size:size,x:this.
|
103
|
-
co.fillStyle=prop['chart.text.color'];if(prop['chart.
|
104
|
-
if(prop['chart.scale.zerostart']){RG.text2(this,{font:font,size:size,bold:bold,italic:italic,x:this.
|
99
|
+
{var labels=prop['chart.yaxis.labels'],barAreaHeight=ca.height-this.marginTop-this.marginBottom
|
100
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.labels'});co.fillStyle=textConf.color;for(var i=0,len=labels.length;i<len;++i){RG.text2(this,{color:textConf.color,font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,x:this.marginLeft+this.axisWidth+(prop['chart.margin.center']/2),y:this.marginTop+((barAreaHeight/labels.length)*(i))+((barAreaHeight/labels.length)/2),text:String(labels[i]?String(labels[i]):''),halign:'center',valign:'center',marker:false,tag:'labels'});}
|
101
|
+
co.fillStyle=prop['chart.text.color'];if(prop['chart.xaxis.labels']){var grapharea=(ca.width-prop['chart.margin.center']-this.marginLeft-this.marginRight)/2;var textConf=RG.getTextConf({object:this,prefix:'chart.xaxis.labels'});for(var i=0;i<this.scale2.labels.length;++i){RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:this.marginLeft+((grapharea/this.scale2.labels.length)*i),y:ca.height-this.marginBottom+3,text:typeof prop['chart.xaxis.scale.formatter']==='function'?(prop['chart.xaxis.scale.formatter'])(this,this.scale2.values[this.scale2.values.length-i-1]):this.scale2.labels[this.scale2.labels.length-i-1],valign:'top',halign:'center',tag:'scale'});RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:this.marginLeft+grapharea+prop['chart.margin.center']+((grapharea/this.scale2.labels.length)*(i+1)),y:ca.height-this.marginBottom+3,text:this.scale2.labels[i],text:typeof prop['chart.xaxis.scale.formatter']==='function'?(prop['chart.xaxis.scale.formatter'])(this,this.scale2.values[i]):this.scale2.labels[i],valign:'top',halign:'center',tag:'scale'});}
|
102
|
+
if(prop['chart.xaxis.scale.zerostart']){RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:this.marginLeft+this.axisWidth,y:ca.height-this.marginBottom+3,text:typeof prop['chart.xaxis.scale.formatter']==='function'?(prop['chart.xaxis.scale.formatter'])(this,0):RG.numberFormat({object:this,number:(0).toFixed(prop['chart.xaxis.scale.decimals']),unitspre:prop['chart.xaxis.scale.units.pre'],unitspost:prop['chart.xaxis.scale.units.post']}),valign:'top',halign:'center',tag:'scale'});RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:this.marginLeft+this.axisWidth+this.marginCenter,y:ca.height-this.marginBottom+3,text:typeof prop['chart.xaxis.scale.formatter']==='function'?(prop['chart.xaxis.scale.formatter'])(this,0):RG.numberFormat({object:this,number:(0).toFixed(prop['chart.xaxis.scale.decimals']),unitspre:prop['chart.xaxis.scale.units.pre'],unitspost:prop['chart.xaxis.scale.units.post']}),valign:'top',halign:'center',tag:'scale'});}}
|
105
103
|
if(prop['chart.labels.above']){this.drawLabelsAbove();}};this.drawLabelsAbove=function()
|
106
|
-
{var coordsLeft=this.coordsLeft,coordsRight=this.coordsRight;for(var i=0,seq=0;i<coordsLeft.length;++i,++seq){if(typeof this.left[i]=='number'){var coords=
|
107
|
-
var coords=coordsLeft[seq];RG.text2(this,{font:
|
104
|
+
{var coordsLeft=this.coordsLeft,coordsRight=this.coordsRight;var textConf=RG.getTextConf({object:this,prefix:'chart.labels.above'});for(var i=0,seq=0;i<coordsLeft.length;++i,++seq){if(typeof this.left[i]=='number'){var coords=this.coords[seq];RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:coords[0]-5,y:coords[1]+(coords[3]/2),text:typeof prop['chart.labels.above.formatter']==='function'?prop['chart.labels.above.formatter'](this,this.left[i]):RG.numberFormat({object:this,number:this.left[i].toFixed(typeof prop['chart.labels.above.decimals']==='number'?prop['chart.labels.above.decimals']:0),unitspre:prop['chart.labels.above.units.pre'],unitspost:prop['chart.labels.above.units.post']}),valign:'center',halign:'right',tag:'labels.above'});}else if(typeof this.left[i]==='object'){for(var j=0;j<this.left[i].length;++j,++seq){if(prop['chart.grouping']==='stacked'&&j!==(this.left[i].length-1)){continue;}
|
105
|
+
var coords=coordsLeft[seq];RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:coords[0]-5,y:coords[1]+(coords[3]/2),text:typeof prop['chart.labels.above.formatter']==='function'?prop['chart.labels.above.formatter'](this,this.left[i][j]):RG.numberFormat({object:this,number:RG.isNull(this.left[i][j])||isNaN(this.left[i][j])?'':(prop['chart.grouping']==='stacked'?RG.arraySum(this.left[i]):Number(this.left[i][j])).toFixed(typeof prop['chart.labels.above.decimals']==='number'?prop['chart.labels.above.decimals']:0),unitspre:prop['chart.labels.above.units.pre'],unitspost:prop['chart.labels.above.units.post']}),valign:'center',halign:'right',tag:'labels.above'});}
|
108
106
|
seq--;}}
|
109
|
-
for(i=0,seq=0;i<coordsRight.length;++i,++seq){if(typeof this.right[i]==='number'){var coords=coordsRight[
|
110
|
-
var coords=coordsRight[seq];RG.text2(this,{font:
|
107
|
+
for(i=0,seq=0;i<coordsRight.length;++i,++seq){if(typeof this.right[i]==='number'){var coords=coordsRight[seq];RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:coords[0]+coords[2]+5+(prop['chart.variant']==='3d'?10:0),y:coords[1]+(coords[3]/2)+(prop['chart.variant']==='3d'?-5:0),text:typeof prop['chart.labels.above.formatter']==='function'?prop['chart.labels.above.formatter'](this,this.right[i]):RG.numberFormat({object:this,number:this.right[i].toFixed(typeof prop['chart.labels.above.decimals']==='number'?prop['chart.labels.above.decimals']:0),unitspre:prop['chart.labels.above.units.pre'],unitspost:prop['chart.labels.above.units.post']}),valign:'center',halign:'left',tag:'labels.above'});}else if(typeof this.right[i]==='object'){for(var j=0;j<this.right[i].length;++j,++seq){if(prop['chart.grouping']==='stacked'&&j!==(this.right[i].length-1)){continue;}
|
108
|
+
var coords=coordsRight[seq];RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:coords[0]+coords[2]+5+(prop['chart.variant']==='3d'?10:0),y:coords[1]+(coords[3]/2)+(prop['chart.variant']==='3d'?-5:0),text:typeof prop['chart.labels.above.formatter']==='function'?prop['chart.labels.above.formatter'](this,this.right[i][j]):RG.numberFormat({object:this,number:RG.isNull(this.right[i][j])||isNaN(this.right[i][j])?'':prop['chart.grouping']==='stacked'?RG.arraySum(this.right[i]).toFixed(prop['chart.labels.above.decimals']):Number(this.right[i][j]).toFixed(typeof prop['chart.labels.above.decimals']==='number'?prop['chart.labels.above.decimals']:0),unitspre:prop['chart.labels.above.units.pre'],unitspost:prop['chart.labels.above.units.post']}),valign:'center',halign:'left',tag:'labels.above'});}
|
111
109
|
--seq;}}};this.drawTitles=this.DrawTitles=function()
|
112
|
-
{if(typeof prop['chart.title.left']==='string'){RG.text2(this,{font:
|
113
|
-
if(typeof prop['chart.title.right']==='string'){RG.text2(this,{font:
|
114
|
-
if(typeof prop['chart.title']==='string'){RG.drawTitle(this,prop['chart.title'],this.
|
115
|
-
{var prevFillStyle=co.fillStyle;var offsetx=prop['chart.shadow.offsetx'];var offsety=prop['chart.shadow.offsety'];co.lineWidth=prop['chart.linewidth'];co.fillStyle=prop['chart.shadow.color'];co.beginPath();co.fillRect(coords[0]+offsetx,coords[1]+offsety,coords[2],coords[3]);co.fill();co.fillStyle=prevFillStyle;}
|
116
|
-
this.getShape=this.getBar=function(e)
|
110
|
+
{var textConf=RG.getTextConf({object:this,prefix:'chart.title.left'});if(typeof prop['chart.title.left']==='string'){RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:this.marginLeft+5,y:this.marginTop-5,text:prop['chart.title.left'],halign:'left',valign:'bottom',tag:'title.left'});}
|
111
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.title.right'});if(typeof prop['chart.title.right']==='string'){RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:ca.width-this.marginRight-5,y:this.marginTop-5,text:prop['chart.title.right'],halign:'right',valign:'bottom',tag:'title.right'});}
|
112
|
+
if(typeof prop['chart.title']==='string'){RG.drawTitle(this,prop['chart.title'],this.marginTop,null,typeof prop['chart.title.size']==='number'?prop['chart.title.size']:null);}};this.getShape=this.getBar=function(e)
|
117
113
|
{var canvas=this.canvas,context=this.context,mouseXY=RG.getMouseXY(e)
|
118
114
|
for(var i=0;i<this.coords.length;i++){var mouseX=mouseXY[0],mouseY=mouseXY[1],left=this.coords[i][0],top=this.coords[i][1],width=this.coords[i][2],height=this.coords[i][3]
|
119
115
|
if(prop['chart.variant']==='3d'){pa2(co,'b r % % % %',left,top,width,height);var over=co.isPointInPath(mouseX,mouseY);}else{var over=(mouseX>=left&&mouseX<=(left+width)&&mouseY>=top&&mouseY<=(top+height));}
|
120
116
|
if(over){var tooltip=RG.parseTooltipText(prop['chart.tooltips'],i);return{0:this,1:left,2:top,3:width,4:height,5:i,object:this,x:left,y:top,width:width,height:height,index:i,tooltip:tooltip};}}
|
121
117
|
return null;};this.highlight=this.Highlight=function(shape)
|
122
118
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{RG.Highlight.Rect(this,shape);}};this.getValue=function(e)
|
123
|
-
{var obj=e.target.__object__;var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];if(mouseX>this.
|
124
|
-
if(mouseX<(ca.width-this.
|
119
|
+
{var obj=e.target.__object__;var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];if(mouseX>this.marginLeft&&mouseX<((ca.width/2)-(prop['chart.margin.center']/2))){var value=(mouseX-prop['chart.margin.left'])/this.axisWidth;value=this.max-(value*this.max);}
|
120
|
+
if(mouseX<(ca.width-this.marginRight)&&mouseX>((ca.width/2)+(prop['chart.margin.center']/2))){var value=(mouseX-prop['chart.margin.left']-this.axisWidth-prop['chart.margin.center'])/this.axisWidth;value=(value*this.max);}
|
125
121
|
return value;};this.getObjectByXY=function(e)
|
126
|
-
{var mouseXY=RG.getMouseXY(e);if(mouseXY[0]>prop['chart.
|
122
|
+
{var mouseXY=RG.getMouseXY(e);if(mouseXY[0]>prop['chart.margin.left']&&mouseXY[0]<(ca.width-prop['chart.margin.right'])&&mouseXY[1]>prop['chart.margin.top']&&mouseXY[1]<(ca.height-prop['chart.margin.bottom'])){return this;}};this.getXCoord=function(value)
|
127
123
|
{if(value>this.max||value<0){return null;}
|
128
|
-
var ret=[];var offset=((value/this.max)*this.axisWidth);ret[0]=(this.
|
129
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.
|
124
|
+
var ret=[];var offset=((value/this.max)*this.axisWidth);ret[0]=(this.marginLeft+this.axisWidth)-offset;ret[1]=(ca.width-this.marginRight-this.axisWidth)+offset;return ret;};this.parseColors=function()
|
125
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);this.original_colors['chart.highlight.stroke']=RG.arrayClone(prop['chart.highlight.fill']);this.original_colors['chart.highlight.fill']=RG.arrayClone(prop['chart.highlight.fill']);this.original_colors['chart.axes.color']=RG.arrayClone(prop['chart.axes.color']);this.original_colors['chart.colors.stroke']=RG.arrayClone(prop['chart.colors.stroke']);}
|
130
126
|
var props=this.properties;var colors=props['chart.colors'];for(var i=0;i<colors.length;++i){colors[i]=this.parseSingleColorForGradient(colors[i]);}
|
131
|
-
props['chart.highlight.stroke']=this.parseSingleColorForGradient(props['chart.highlight.stroke']);props['chart.highlight.fill']=this.parseSingleColorForGradient(props['chart.highlight.fill']);props['chart.
|
127
|
+
props['chart.highlight.stroke']=this.parseSingleColorForGradient(props['chart.highlight.stroke']);props['chart.highlight.fill']=this.parseSingleColorForGradient(props['chart.highlight.fill']);props['chart.axes.color']=this.parseSingleColorForGradient(props['chart.axes.color']);props['chart.color.stroke']=this.parseSingleColorForGradient(props['chart.colors.stroke']);};this.reset=function()
|
132
128
|
{};this.parseSingleColorForGradient=function(color)
|
133
129
|
{if(!color||typeof(color)!='string'){return color;}
|
134
|
-
if(color.match(/^gradient\((.*)\)$/i)){
|
130
|
+
if(color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
131
|
+
var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(prop['chart.margin.left'],0,ca.width-prop['chart.margin.right'],0);var diff=1/(parts.length-1);grad.addColorStop(0,RG.trim(parts[0]));for(var j=1;j<parts.length;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
|
135
132
|
return grad?grad:color;};this.on=function(type,func)
|
136
133
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
137
134
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
138
135
|
return this;};this.drawBackgroundGrid=function()
|
139
|
-
{if(prop['chart.background.grid']){var variant=prop['chart.variant'],color=prop['chart.background.grid.color'],numvlines=prop['chart.labels.count'],numhlines=this.left.length,vlines=prop['chart.background.grid.vlines'],hlines=prop['chart.background.grid.hlines'],linewidth=prop['chart.background.grid.linewidth'];if(typeof prop['chart.background.grid.
|
140
|
-
if(typeof prop['chart.background.grid.
|
136
|
+
{if(prop['chart.background.grid']){var variant=prop['chart.variant'],color=prop['chart.background.grid.color'],numvlines=prop['chart.xaxis.labels.count'],numhlines=this.left.length,vlines=prop['chart.background.grid.vlines'],hlines=prop['chart.background.grid.hlines'],linewidth=prop['chart.background.grid.linewidth'];if(typeof prop['chart.background.grid.hlines.count']==='number'){numhlines=prop['chart.background.grid.hlines.count'];}
|
137
|
+
if(typeof prop['chart.background.grid.vlines.count']==='number'){numvlines=prop['chart.background.grid.vlines.count'];}
|
141
138
|
co.lineWidth=linewidth;if(variant=='3d'){co.save();co.translate(prop['chart.variant.threed.offsetx'],-1*prop['chart.variant.threed.offsety']);}
|
142
|
-
if(vlines){for(var i=0;i<=numvlines;i+=1){pa2(co,'b m % % l % % s %',this.
|
143
|
-
if(hlines){for(var i=0;i<=numhlines;i+=1){pa2(co,'b m % % l % % s %',this.
|
144
|
-
if(vlines){for(var i=0;i<=numvlines;i+=1){pa2(co,'b m % % l % % s %',this.
|
145
|
-
if(hlines){for(var i=0;i<=numhlines;i+=1){pa2(co,'b m % % l % % s %',this.
|
139
|
+
if(vlines){for(var i=0;i<=numvlines;i+=1){pa2(co,'b m % % l % % s %',this.marginLeft+(this.axisWidth/numvlines)*i,this.marginTop,this.marginLeft+(this.axisWidth/numvlines)*i,this.marginTop+this.axisHeight,color);}}
|
140
|
+
if(hlines){for(var i=0;i<=numhlines;i+=1){pa2(co,'b m % % l % % s %',this.marginLeft,this.marginTop+(this.axisHeight/numhlines)*i,this.marginLeft+this.axisWidth,this.marginTop+(this.axisHeight/numhlines)*i,color);}}
|
141
|
+
if(vlines){for(var i=0;i<=numvlines;i+=1){pa2(co,'b m % % l % % s %',this.marginLeft+this.marginCenter+this.axisWidth+(this.axisWidth/numvlines)*i,this.marginTop,this.marginLeft+this.marginCenter+this.axisWidth+(this.axisWidth/numvlines)*i,this.marginTop+this.axisHeight,color);}}
|
142
|
+
if(hlines){for(var i=0;i<=numhlines;i+=1){pa2(co,'b m % % l % % s %',this.marginLeft+this.axisWidth+this.marginCenter,this.marginTop+(this.axisHeight/numhlines)*i,this.marginLeft+this.axisWidth+this.marginCenter+this.axisWidth,this.marginTop+(this.axisHeight/numhlines)*i,color);}}
|
146
143
|
if(variant=='3d'){co.restore();}}};this.firstDrawFunc=function()
|
147
|
-
{};this.getGutterCenter=function()
|
148
|
-
{var bold=typeof prop['chart.labels.bold']==='boolean'?prop['chart.labels.bold']:prop['chart.text.bold'],font=typeof prop['chart.labels.font']==='string'?prop['chart.labels.font']:prop['chart.text.font'],size=typeof prop['chart.labels.size']==='number'?prop['chart.labels.size']:prop['chart.text.size'];for(var i=0,len=0;i<prop['chart.labels'].length;++i){len=ma.max(len,RG.measureText(prop['chart.labels'][i],bold,font,size)[0]);}
|
144
|
+
{};this.getGutterCenter=this.getMarginCenter=function()
|
145
|
+
{var bold=typeof prop['chart.yaxis.labels.bold']==='boolean'?prop['chart.yaxis.labels.bold']:prop['chart.text.bold'],font=typeof prop['chart.yaxis.labels.font']==='string'?prop['chart.yaxis.labels.font']:prop['chart.text.font'],size=typeof prop['chart.yaxis.labels.size']==='number'?prop['chart.yaxis.labels.size']:prop['chart.text.size'];for(var i=0,len=0;i<prop['chart.yaxis.labels'].length;++i){len=ma.max(len,RG.measureText(prop['chart.yaxis.labels'][i],bold,font,size)[0]);}
|
149
146
|
return len+15;};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}
|
150
147
|
this.grow=function()
|
151
|
-
{var opt=arguments[0]||{},frames=opt.frames||30,frame=0,callback=arguments[1]||function(){},obj=this;var originalLeft=RG.arrayClone(this.left),originalRight=RG.arrayClone(this.right);if(RG.isNull(prop['chart.
|
148
|
+
{var opt=arguments[0]||{},frames=opt.frames||30,frame=0,callback=arguments[1]||function(){},obj=this;var originalLeft=RG.arrayClone(this.left),originalRight=RG.arrayClone(this.right);if(RG.isNull(prop['chart.xaxis.scale.max'])){var xmax=0;this.getMax();this.Set('chart.xaxis.scale.max',this.scale2.max);}
|
152
149
|
var iterator=function()
|
153
150
|
{var easingMultiplier=RG.Effects.getEasingMultiplier(frames,frame);for(var i=0;i<obj.left.length;i+=1){if(typeof obj.left[i]==='number'){obj.left[i]=easingMultiplier*originalLeft[i];}else{for(var j=0;j<obj.left[i].length;++j){obj.left[i][j]=easingMultiplier*originalLeft[i][j];}}}
|
154
151
|
for(var i=0;i<obj.right.length;i+=1){if(typeof obj.right[i]==='number'){obj.right[i]=easingMultiplier*originalRight[i];}else{for(var j=0;j<obj.right[i].length;++j){obj.right[i][j]=easingMultiplier*originalRight[i][j];}}}
|
155
152
|
RG.redrawCanvas(obj.canvas);if(frame<frames){frame+=1;RG.Effects.updateCanvas(iterator);}else{callback(obj);}};iterator();return this;};this.wave=function()
|
156
153
|
{var obj=this,opt=arguments[0]||{};opt.frames=opt.frames||120;opt.startFrames_left=[];opt.startFrames_right=[];opt.counters_left=[];opt.counters_right=[];var framesperbar=opt.frames/3,frame_left=-1,frame_right=-1,callback=arguments[1]||function(){},original_left=RG.arrayClone(obj.left),original_right=RG.arrayClone(obj.right);for(var i=0,len=obj.left.length;i<len;i+=1){opt.startFrames_left[i]=((opt.frames/3)/(obj.left.length-1))*i;opt.startFrames_right[i]=((opt.frames/3)/(obj.right.length-1))*i;opt.counters_left[i]=0;opt.counters_right[i]=0;}
|
157
|
-
obj.draw();obj.set('
|
154
|
+
obj.draw();obj.set('chart.xaxis.scale.max',obj.scale2.max);RG.clear(obj.canvas);for(var i=0,len=obj.left.length;i<len;i+=1){if(typeof obj.left[i]==='number')obj.left[i]=0;if(typeof obj.right[i]==='number')obj.right[i]=0;}
|
158
155
|
function iteratorLeft()
|
159
156
|
{++frame_left;for(var i=0,len=obj.left.length;i<len;i+=1){if(frame_left>opt.startFrames_left[i]){var isNull=RG.isNull(obj.left[i]);if(typeof obj.left[i]==='number'){obj.left[i]=ma.min(ma.abs(original_left[i]),ma.abs(original_left[i]*((opt.counters_left[i]++)/framesperbar)));if(original_left[i]<0){obj.left[i]*=-1;}}else if(RG.isArray(obj.left[i])){for(var j=0;j<obj.left[i].length;++j){obj.left[i][j]=ma.min(ma.abs(original_left[i][j]),ma.abs(original_left[i][j]*((opt.counters_left[i]++)/framesperbar)));if(original_left[i][j]<0){obj.left[i][j]*=-1;}}}
|
160
157
|
if(isNull){obj.left[i]=null;}}else{obj.left[i]=typeof obj.left[i]==='object'&&obj.left[i]?RG.arrayPad([],obj.left[i].length,0):(RG.isNull(obj.left[i])?null:0);}}
|