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
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Drawing=RGraph.Drawing||{};RGraph.Drawing.Rect=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.x==='number'&&typeof conf.y==='number'&&typeof conf.width==='number'&&typeof conf.height==='number'&&typeof conf.id==='string'){var id=conf.id,x=conf.x,y=conf.y,width=conf.width,height=conf.height,parseConfObjectForOptions=true;}else{var id=conf,x=arguments[1],y=arguments[2],width=arguments[3],height=arguments[4];}
|
4
|
-
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.colorsParsed=false;this.canvas.__object__=this;this.original_colors=[];this.coordsText=[];this.firstDraw=true;this.type='drawing.rect';this.isRGraph=true;this.uid=RGraph.createUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.
|
4
|
+
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.colorsParsed=false;this.canvas.__object__=this;this.original_colors=[];this.coordsText=[];this.firstDraw=true;this.type='drawing.rect';this.isRGraph=true;this.uid=RGraph.createUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.colors.stroke':'rgba(0,0,0,0)','chart.colors.fill':'red','chart.events.click':null,'chart.events.mousemove':null,'chart.shadow':false,'chart.shadow.color':'gray','chart.shadow.offsetx':3,'chart.shadow.offsety':3,'chart.shadow.blur':5,'chart.highlight.stroke':'black','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.tooltips.highlight':true,'chart.tooltips.coords.page':false,'chart.tooltips.valign':'top','chart.clearto':'rgba(0,0,0,0)'}
|
5
5
|
if(!this.canvas){alert('[DRAWING.RECT] No canvas support');return;}
|
6
6
|
this.coords=[[Math.round(x),Math.round(y),width,height]];this.$0={};if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
7
7
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math;if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
|
@@ -15,18 +15,19 @@ while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCa
|
|
15
15
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
16
16
|
{RG.fireCustomEvent(this,'onbeforedraw');this.coordsText=[];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
17
17
|
pa2(co,['b']);if(prop['chart.shadow']){pa2(co,['sc',prop['chart.shadow.color'],'sx',prop['chart.shadow.offsetx'],'sy',prop['chart.shadow.offsety'],'sb',prop['chart.shadow.blur']]);}
|
18
|
-
pa2(co,['r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.
|
18
|
+
pa2(co,['r',this.coords[0][0],this.coords[0][1],this.coords[0][2],this.coords[0][3],'f',prop['chart.colors.fill']]);RG.noShadow(this);pa2(co,['s',prop['chart.colors.stroke']]);RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
19
19
|
RG.fireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
20
20
|
{func(this);return this;};this.getObjectByXY=function(e)
|
21
21
|
{if(this.getShape(e)){return this;}};this.getShape=function(e)
|
22
22
|
{var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1];for(var i=0,len=this.coords.length;i<len;i++){var coords=this.coords[i];var left=coords[0],top=coords[1],width=coords[2],height=coords[3];if(mouseX>=left&&mouseX<=(left+width)&&mouseY>=top&&mouseY<=(top+height)){return{0:this,1:left,2:top,3:width,4:height,5:0,'object':this,'x':left,'y':top,'width':width,'height':height,'index':0,'tooltip':prop['chart.tooltips']?prop['chart.tooltips'][0]:null};}}
|
23
23
|
return null;};this.highlight=this.Highlight=function(shape)
|
24
24
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{RG.Highlight.rect(this,shape);}};this.parseColors=function()
|
25
|
-
{if(this.original_colors.length===0){this.original_colors['chart.
|
26
|
-
prop['chart.
|
25
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors.fill']=RG.arrayClone(prop['chart.colors.fill']);this.original_colors['chart.colors.stroke']=RG.arrayClone(prop['chart.colors.stroke']);this.original_colors['chart.highlight.stroke']=RG.arrayClone(prop['chart.highlight.stroke']);this.original_colors['chart.highlight.fill']=RG.arrayClone(prop['chart.highlight.fill']);}
|
26
|
+
prop['chart.colors.fill']=this.parseSingleColorForGradient(prop['chart.colors.fill']);prop['chart.colors.stroke']=this.parseSingleColorForGradient(prop['chart.colors.stroke']);prop['chart.highlight.stroke']=this.parseSingleColorForGradient(prop['chart.highlight.stroke']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);};this.reset=function()
|
27
27
|
{};this.parseSingleColorForGradient=function(color)
|
28
28
|
{if(!color){return color;}
|
29
|
-
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){
|
29
|
+
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
30
|
+
var parts=RegExp.$1.split(':'),grad=co.createLinearGradient(0,0,ca.width,0),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,RG.trim(parts[j]));}}
|
30
31
|
return grad?grad:color;};this.on=function(type,func)
|
31
32
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
32
33
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Drawing=RGraph.Drawing||{};RGraph.Drawing.Text=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.x==='number'&&typeof conf.y==='number'&&typeof conf.id==='string'){var id=conf.id
|
4
4
|
var x=conf.x;var y=conf.y;var text=String(conf.text);var parseConfObjectForOptions=true;}else{var id=conf;var x=arguments[1];var y=arguments[2];var text=arguments[3];}
|
5
|
-
this.id=id;this.canvas=document.getElementById(id);this.context=this.canvas.getContext('2d');this.colorsParsed=false;this.canvas.__object__=this;this.x=x;this.y=y;this.text=String(text);this.coords=[];this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.type='drawing.text';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.size':
|
5
|
+
this.id=id;this.canvas=document.getElementById(id);this.context=this.canvas.getContext('2d');this.colorsParsed=false;this.canvas.__object__=this;this.x=x;this.y=y;this.text=String(text);this.coords=[];this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.propertyNameAliases={};this.type='drawing.text';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.text.size':12,'chart.text.font':'Arial, Verdana, sans-serif','chart.text.bold':false,'chart.text.italic':false,'chart.angle':0,'chart.colors':['black'],'chart.events.click':null,'chart.events.mousemove':null,'chart.highlight.stroke':'#ccc','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.tooltips.highlight':true,'chart.tooltips.coords.page':false,'chart.bounding':false,'chart.bounding.fill':'rgba(255,255,255,0.7)','chart.bounding.stroke':'#777','chart.bounding.shadow':false,'chart.bounding.shadow.color':'#ccc','chart.bounding.shadow.blur':3,'chart.bounding.shadow.offsetx':3,'chart.bounding.shadow.offsety':3,'chart.marker':false,'chart.halign':'left','chart.valign':'bottom','chart.link':null,'chart.link.target':'_self','chart.link.options':'','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.shadow':false,'chart.shadow.color':'#ccc','chart.shadow.offsetx':2,'chart.shadow.offsety':2,'chart.shadow.blur':3,'chart.clearto':'rgba(0,0,0,0)'}
|
6
6
|
if(!this.canvas){alert('[DRAWING.TEXT] No canvas support');return;}
|
7
7
|
this.$0={};if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
8
8
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
@@ -17,21 +17,22 @@ while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCa
|
|
17
17
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
18
18
|
{RG.fireCustomEvent(this,'onbeforedraw');if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
19
19
|
this.coords=[];this.coordsText=[];var dimensions=RG.measureText(this.text,prop['chart.text.bold'],prop['chart.text.font'],prop['chart.text.size']);co.fillStyle=prop['chart.colors'][0];if(prop['chart.shadow']){RG.setShadow(this,prop['chart.shadow.color'],prop['chart.shadow.offsetx'],prop['chart.shadow.offsety'],prop['chart.shadow.blur']);}
|
20
|
-
var ret=RG.text2(this,{font:prop['chart.font'],size:prop['chart.size'],x:this.x,y:this.y,text:this.text,
|
21
|
-
this.coords.push({0:ret.x,'x':ret.x,1:ret.y,'y':ret.y,2:ret.width,'width':ret.width,3:ret.height,'height':ret.height});RG.
|
20
|
+
var ret=RG.text2(this,{font:prop['chart.text.font'],size:prop['chart.text.size'],bold:prop['chart.text.bold'],italic:prop['chart.text.italic'],color:prop['chart.colors'][0],x:this.x,y:this.y,text:this.text,angle:prop['chart.angle'],bounding:prop['chart.bounding'],'bounding.fill':prop['chart.bounding.fill'],'bounding.stroke':prop['chart.bounding.stroke'],'bounding.shadow':prop['chart.bounding.shadow'],'bounding.shadow.color':prop['chart.bounding.shadow.color'],'bounding.shadow.blur':prop['chart.bounding.shadow.blur'],'bounding.shadow.offsetx':prop['chart.bounding.shadow.offsetx'],'bounding.shadow.offsety':prop['chart.bounding.shadow.offsety'],marker:prop['chart.marker'],halign:prop['chart.halign'],valign:prop['chart.valign']});if(prop['chart.shadow']){RG.noShadow(this);}
|
21
|
+
this.coords.push({0:ret.x,'x':ret.x,1:ret.y,'y':ret.y,2:ret.width,'width':ret.width,3:ret.height,'height':ret.height});RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
22
22
|
RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
23
23
|
{func(this);return this;};this.getObjectByXY=function(e)
|
24
24
|
{if(this.getShape(e)){return this;}};this.getShape=function(e)
|
25
25
|
{var prop=this.properties;var coords=this.coords;var mouseXY=RGraph.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];for(var i=0,len=this.coords.length;i<len;i++){var left=coords[i].x;var top=coords[i].y;var width=coords[i].width;var height=coords[i].height;if(mouseX>=left&&mouseX<=(left+width)&&mouseY>=top&&mouseY<=(top+height)){return{0:this,1:left,2:top,3:width,4:height,5:0,'object':this,'x':left,'y':top,'width':width,'height':height,'index':0,'tooltip':prop['chart.tooltips']?prop['chart.tooltips'][0]:null};}}
|
26
26
|
return null;};this.highlight=this.Highlight=function(shape)
|
27
27
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{RG.Highlight.Rect(this,shape);}};this.parseColors=function()
|
28
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.
|
29
|
-
prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);prop['chart.
|
28
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors'])[0];this.original_colors['chart.colors.fill']=RG.arrayClone(prop['chart.colors.fill']);this.original_colors['chart.colors.stroke']=RG.arrayClone(prop['chart.colors.stroke']);this.original_colors['chart.highlight.stroke']=RG.arrayClone(prop['chart.highlight.stroke']);this.original_colors['chart.highlight.fill']=RG.arrayClone(prop['chart.highlight.fill']);}
|
29
|
+
prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);prop['chart.colors.fill']=this.parseSingleColorForGradient(prop['chart.colors.fill']);prop['chart.colors.stroke']=this.parseSingleColorForGradient(prop['chart.colors.stroke']);prop['chart.highlight.stroke']=this.parseSingleColorForGradient(prop['chart.highlight.stroke']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);};this.reset=function()
|
30
30
|
{};this.parseSingleColorForGradient=function(color)
|
31
31
|
{if(!color){return color;}
|
32
|
-
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){
|
32
|
+
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
33
|
+
var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(0,0,ca.width,0);var diff=1/(parts.length-1);grad.addColorStop(0,RGraph.trim(parts[0]));for(var j=1,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
|
33
34
|
return grad?grad:color;};this.on=function(type,func)
|
34
35
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
35
36
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
36
37
|
return this;};this.firstDrawFunc=function()
|
37
|
-
{};RG.
|
38
|
+
{};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|
@@ -2,7 +2,7 @@
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Drawing=RGraph.Drawing||{};RGraph.Drawing.XAxis=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.y==='number'&&typeof conf.id==='string'){var id=conf.id
|
4
4
|
var y=conf.y;var parseConfObjectForOptions=true;}else{var id=conf;var y=arguments[1];}
|
5
|
-
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.y=y;this.coords=[];this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.type='drawing.xaxis';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.
|
5
|
+
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext('2d');this.canvas.__object__=this;this.y=y;this.coords=[];this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.type='drawing.xaxis';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.margin.left':25,'chart.margin.right':25,'chart.colors':['black'],'chart.text.color':'black','chart.text.font':'Arial, Verdana, sans-serif','chart.text.size':12,'chart.text.bold':false,'chart.text.italic':false,'chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.xaxis.labels':null,'chart.xaxis.labels.position':'section','chart.xaxis.labels.count':5,'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.tickmarks.align':'bottom','chart.xaxis.tickmarks.count':5,'chart.xaxis.tickmarks.last.left':true,'chart.xaxis.tickmarks.last.right':true,'chart.xaxis.scale.visible':true,'chart.xaxis.scale.formatter':null,'chart.xaxis.scale.decimals':0,'chart.xaxis.scale.point':'.','chart.xaxis.scale.thousand':',','chart.xaxis.scale.invert':false,'chart.xaxis.scale.zerostart':true,'chart.xaxis.scale.units.pre':'','chart.xaxis.scale.units.post':'','chart.xaxis.title':'','chart.xaxis.title.font':null,'chart.xaxis.title.size':null,'chart.xaxis.title.color':null,'chart.xaxis.title.bold':null,'chart.xaxis.title.italic':null,'chart.xaxis.tickmarks.count':null,'chart.xaxis':true,'chart.xaxis.scale.max':null,'chart.xaxis.scale.min':0,'chart.xaxis.position':'bottom','chart.yaxis.position':'left','chart.hmargin':0,'chart.linewidth':1,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
|
6
6
|
if(!this.canvas){alert('[DRAWING.XAXIS] No canvas support');return;}
|
7
7
|
this.$0={};if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
8
8
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
@@ -11,41 +11,43 @@ this.set=this.Set=function(name)
|
|
11
11
|
{var value=typeof arguments[1]==='undefined'?null:arguments[1];if(arguments.length===1&&typeof name==='object'){RG.parseObjectStyleConfig(this,name);return this;}
|
12
12
|
if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
13
13
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
14
|
-
if(name=='chart.labels'&&!prop['chart.numxticks']){prop['chart.numxticks']=value.length;}
|
15
14
|
prop[name]=value;return this;};this.get=this.Get=function(name)
|
16
15
|
{if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
17
16
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
18
17
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
19
|
-
{RG.FireCustomEvent(this,'onbeforedraw');this.coordsText=[];this.
|
20
|
-
this.
|
18
|
+
{RG.FireCustomEvent(this,'onbeforedraw');this.coordsText=[];this.marginLeft=prop['chart.margin.left'];this.marginRight=prop['chart.margin.right'];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
19
|
+
this.drawXAxis();RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
21
20
|
RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
22
21
|
{func(this);return this;};this.getObjectByXY=function(e)
|
23
22
|
{if(this.getShape(e)){return this;}};this.getShape=function(e)
|
24
|
-
{var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];if(mouseX>=this.
|
23
|
+
{var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];if(mouseX>=this.marginLeft&&mouseX<=(ca.width-this.marginRight)&&mouseY>=this.y-(prop['chart.xaxis.tickmarks.align']=='top'?(prop['chart.text.size']*1.5)+5:0)&&mouseY<=(this.y+(prop['chart.xaxis.tickmarks.align']=='top'?0:(prop['chart.text.size']*1.5)+5))){var x=this.marginLeft;var y=this.y;var w=ca.width-this.marginLeft-this.marginRight;var h=15;return{0:this,1:x,2:y,3:w,4:h,5:0,'object':this,'x':x,'y':y,'width':w,'height':h,'index':0,'tooltip':prop['chart.tooltips']?prop['chart.tooltips'][0]:null};}
|
25
24
|
return null;};this.highlight=this.Highlight=function(shape)
|
26
25
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}};this.parseColors=function()
|
27
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.
|
28
|
-
prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);};this.reset=function()
|
26
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']),this.original_colors['chart.text.color']=RG.arrayClone(prop['chart.text.color']),this.original_colors['chart.xaxis.labels.color']=RG.arrayClone(prop['chart.xaxis.labels.color']),this.original_colors['chart.xaxis.title.color']=RG.arrayClone(prop['chart.xaxis.title.color'])}
|
27
|
+
prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);prop['chart.text.color']=this.parseSingleColorForGradient(prop['chart.text.color']);prop['chart.xaxis.labels.color']=this.parseSingleColorForGradient(prop['chart.xaxis.labels.color']);prop['chart.xaxis.title.color']=this.parseSingleColorForGradient(prop['chart.xaxis.title.color']);};this.reset=function()
|
29
28
|
{};this.parseSingleColorForGradient=function(color)
|
30
29
|
{if(!color){return color;}
|
31
|
-
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){
|
30
|
+
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
31
|
+
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,len=parts.length;j<len;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
|
32
32
|
return grad?grad:color;};this.drawXAxis=this.DrawXAxis=function()
|
33
|
-
{var
|
34
|
-
numticks=prop['chart.
|
35
|
-
if(RG.
|
36
|
-
co.lineWidth=linewidth+0.001;co.strokeStyle=color;if(!noxaxis){pa2(co,
|
33
|
+
{var marginLeft=prop['chart.margin.left'],marginRight=prop['chart.margin.right'],x=this.marginLeft,y=this.y,min=+prop['chart.xaxis.scale.min'],max=+prop['chart.xaxis.scale.max'],labels=prop['chart.xaxis.labels'],labels_position=prop['chart.xaxis.labels.position'],color=prop['chart.colors'][0],title_color=prop['chart.xaxis.title.color'],width=ca.width-this.marginLeft-this.marginRight,align=prop['chart.xaxis.tickmarks.align'],numlabels=prop['chart.xaxis.labels.count'],formatter=prop['chart.xaxis.scale.formatter'],decimals=Number(prop['chart.xaxis.scale.decimals']),invert=prop['chart.xaxis.scale.invert'],scale_visible=prop['chart.xaxis.scale.visible'],units_pre=prop['chart.xaxis.scale.units.pre'],units_post=prop['chart.xaxis.scale.units.post'],title=prop['chart.xaxis.title']
|
34
|
+
numticks=prop['chart.xaxis.tickmarks.count'],hmargin=prop['chart.hmargin'],linewidth=prop['chart.linewidth'],leftendtick=prop['chart.xaxis.tickmarks.last.left'],rightendtick=prop['chart.xaxis.tickmarks.last.right'],noxaxis=!prop['chart.xaxis'],xaxispos=prop['chart.xaxis.position'],yaxispos=prop['chart.yaxis.position']
|
35
|
+
if(RG.isNull(numticks)){if(labels&&labels.length){numticks=labels.length;}else if(!labels&&max!=0){numticks=10;}else{numticks=numlabels;}}
|
36
|
+
co.lineWidth=linewidth+0.001;co.strokeStyle=color;if(!noxaxis){pa2(co,'b m % % l % % s %',x,ma.round(y),x+width,ma.round(y),co.strokeStyle);co.beginPath();for(var i=(leftendtick?0:1);i<=(numticks-(rightendtick?0:1));++i){if(yaxispos==='center'&&i===(numticks/2)){continue;}
|
37
|
+
co.moveTo(ma.round(x+((width/numticks)*i)),xaxispos==='center'?(align==='bottom'?y-3:y+3):y);co.lineTo(ma.round(x+((width/numticks)*i)),y+(align=='bottom'?3:-3));}
|
37
38
|
co.stroke();}
|
38
|
-
|
39
|
-
for(var i=0,len=labels.length;i<len;++i){
|
39
|
+
if(labels){var textConf=RG.getTextConf({object:this,prefix:'chart.xaxis.labels'});numlabels=labels.length;var h=0;var l=0;var single_line=RG.MeasureText('Mg',false,textConf.font,textConf.size);for(var i=0,len=labels.length;i<len;++i){var dimensions=RG.measureText(labels[i],false,textConf.font,textConf.size);var h=ma.max(h,dimensions[1]);var l=ma.max(l,labels[i].split('\r\n').length);}
|
40
|
+
for(var i=0,len=labels.length;i<len;++i){if(labels_position=='edge'){var x=((((width-hmargin-hmargin)/(labels.length-1))*i)+marginLeft+hmargin);}else{var graphWidth=(width-hmargin-hmargin);var label_segment_width=(graphWidth/labels.length);var x=((label_segment_width*i)+(label_segment_width/2)+marginLeft+hmargin);}
|
41
|
+
RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:align=='bottom'?y+5:y-5-h+single_line[1],text:String(labels[i]),valign:align=='bottom'?'top':'bottom',halign:'center',tag:'labels'});}}else if(scale_visible){if(!max){alert('[DRAWING.XAXIS] If not specifying xaxisLabels you must specify xaxisScaleMax!');}
|
40
42
|
if(yaxispos=='center'){width/=2;var additionalX=width;}else{var additionalX=0;}
|
41
|
-
for(var i=0;i<=numlabels;++i){if(i==0&&!prop['chart.scale.zerostart']){continue;}
|
42
|
-
var original=(((max-min)/numlabels)*i)+min;var hmargin=prop['chart.hmargin'];
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
RG.
|
43
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.xaxis.labels'});for(var i=0;i<=numlabels;++i){if(i==0&&!prop['chart.xaxis.scale.zerostart']){continue;}
|
44
|
+
var original=(((max-min)/numlabels)*i)+min;var hmargin=prop['chart.hmargin'];if(typeof formatter==='function'){var text=formatter(this,original)}else{text=RG.numberFormat({object:this,number:original.toFixed(original===0?0:decimals),unitspre:units_pre,unitspost:units_post,point:prop['chart.xaxis.scale.point'],thousand:prop['chart.xaxis.scale.thousand']});}
|
45
|
+
if(invert){var x=((width-hmargin-((width-hmargin-hmargin)/numlabels)*i))+marginLeft+additionalX;}else{var x=(((width-hmargin-hmargin)/numlabels)*i)+marginLeft+hmargin+additionalX;}
|
46
|
+
RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:align=='bottom'?y+5:y-5,text:text,valign:align=='bottom'?'top':'bottom',halign:'center',tag:'scale'});}
|
47
|
+
if(yaxispos=='center'){for(var i=0;i<numlabels;++i){var original=(((max-min)/numlabels)*(numlabels-i))+min;var hmargin=prop['chart.hmargin'];var text=String(typeof(formatter)=='function'?formatter(this,original):RG.numberFormat({object:this,number:original.toFixed(decimals),unitspre:units_pre,unitspost:units_post}));if(invert){var x=((width-hmargin-((width-hmargin-hmargin)/numlabels)*i))+marginLeft;}else{var x=(((width-hmargin-hmargin)/numlabels)*i)+marginLeft+hmargin;}
|
48
|
+
RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:align=='bottom'?y+5:y-5,'text':'-'+text,valign:align=='bottom'?'top':'bottom',halign:'center',tag:'scale'});}}}
|
49
|
+
if(title){var textConf=RG.getTextConf({object:this,prefix:'chart.xaxis.title'});var dimensions=RG.measureText({text:title,bold:textConf.bold,font:textConf.font,size:textConf.size});RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:(ca.width-this.marginLeft-this.marginRight)/2+this.marginLeft,y:align=='bottom'?y+dimensions[1]+5:y-dimensions[1]-5,text:title,valign:'top',halign:'center',tag:'title'});}};this.on=function(type,func)
|
48
50
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
49
51
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
50
52
|
return this;};this.firstDrawFunc=function()
|
51
|
-
{};RG.
|
53
|
+
{};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|
@@ -2,7 +2,7 @@
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Drawing=RGraph.Drawing||{};RGraph.Drawing.YAxis=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.x==='number'&&typeof conf.id==='string'){var id=conf.id
|
4
4
|
var x=conf.x;var parseConfObjectForOptions=true;}else{var id=conf;var x=arguments[1];}
|
5
|
-
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext("2d");this.canvas.__object__=this;this.x=x;this.coords=[];this.coordsText=[];this.original_colors=[];this.maxLabelLength=0;this.firstDraw=true;this.type='drawing.yaxis';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.
|
5
|
+
this.id=id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext("2d");this.canvas.__object__=this;this.x=x;this.coords=[];this.coordsText=[];this.original_colors=[];this.maxLabelLength=0;this.firstDraw=true;this.type='drawing.yaxis';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.properties={'chart.margin.top':25,'chart.margin.bottom':30,'chart.colors':['black'],'chart.title':'','chart.title.color':null,'chart.title.font':null,'chart.title.size':null,'chart.title.bold':null,'chart.title.italic':null,'chart.text.font':'Arial, Verdana, sans-serif','chart.text.size':12,'chart.text.color':'black','chart.text.bold':false,'chart.text.italic':false,'chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.yaxis':true,'chart.yaxis.tickmarks.count':5,'chart.yaxis.labels.count':5,'chart.yaxis.labels.specific':null,'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.tickmarks.align':'left','chart.yaxis.scale.min':0,'chart.yaxis.scale.max':null,'chart.yaxis.scale.formatter':null,'chart.yaxis.scale.decimals':0,'chart.yaxis.scale.point':'.','chart.yaxis.scale.thousand':',','chart.yaxis.scale.invert':false,'chart.yaxis.scale.zerostart':true,'chart.yaxis.scale.visible':true,'chart.yaxis.scale.units.pre':'','chart.yaxis.scale.units.post':'','chart.yaxis.tickmarks.last.top':true,'chart.yaxis.tickmarks.last.bottom':true,'chart.linewidth':1,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.xaxis.position':'bottom','chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
|
6
6
|
if(!this.canvas){alert('[DRAWING.YAXIS] No canvas support');return;}
|
7
7
|
this.$0={};if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
8
8
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
@@ -15,38 +15,38 @@ prop[name]=value;return this;};this.get=this.Get=function(name)
|
|
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
17
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
18
|
-
{RG.fireCustomEvent(this,'onbeforedraw');this.
|
19
|
-
this.drawYAxis();RG.
|
18
|
+
{RG.fireCustomEvent(this,'onbeforedraw');this.marginTop=prop['chart.margin.top'];this.marginBottom=prop['chart.margin.bottom'];this.coordsText=[];if(!prop['chart.text.color'])prop['chart.text.color']=prop['chart.colors'][0];if(!prop['chart.title.color'])prop['chart.title.color']=prop['chart.text.color'];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
19
|
+
this.drawYAxis();RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
20
20
|
RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
21
21
|
{func(this);return this;};this.getObjectByXY=function(e)
|
22
22
|
{if(this.getShape(e)){return this;}};this.getShape=function(e)
|
23
|
-
{var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];if(mouseX>=this.x-(prop['chart.align']=='right'?0:this.getWidth())&&mouseX<=this.x+(prop['chart.align']=='right'?this.getWidth():0)&&mouseY>=this.
|
23
|
+
{var mouseXY=RG.getMouseXY(e);var mouseX=mouseXY[0];var mouseY=mouseXY[1];if(mouseX>=this.x-(prop['chart.tickmarks.align']=='right'?0:this.getWidth())&&mouseX<=this.x+(prop['chart.tickmarks.align']=='right'?this.getWidth():0)&&mouseY>=this.marginTop&&mouseY<=(ca.height-this.marginBottom)){var x=this.x;var y=this.marginTop;var w=15;;var h=ca.height-this.marginTop-this.marginBottom;return{0:this,1:x,2:y,3:w,4:h,5:0,'object':this,'x':x,'y':y,'width':w,'height':h,'index':0,'tooltip':prop['chart.tooltips']?prop['chart.tooltips'][0]:null};}
|
24
24
|
return null;};this.highlight=this.Highlight=function(shape)
|
25
25
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}};this.parseColors=function()
|
26
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.
|
27
|
-
prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);};this.reset=function()
|
26
|
+
{if(this.original_colors.length===0){this.original_colors['chart.yaxis.labels.color']=RG.arrayClone(prop['chart.yaxis.labels.color']);this.original_colors['chart.title.color']=RG.arrayClone(prop['chart.title.color']);this.original_colors['chart.text.color']=RG.arrayClone(prop['chart.text.color']);this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);}
|
27
|
+
prop['chart.yaxis.labels.color']=this.parseSingleColorForGradient(prop['chart.yaxis.labels.color']);prop['chart.title.color']=this.parseSingleColorForGradient(prop['chart.title.color']);prop['chart.text.color']=this.parseSingleColorForGradient(prop['chart.text.color']);prop['chart.colors'][0]=this.parseSingleColorForGradient(prop['chart.colors'][0]);};this.reset=function()
|
28
28
|
{};this.parseSingleColorForGradient=function(color)
|
29
29
|
{if(!color){return color;}
|
30
|
-
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){
|
30
|
+
if(typeof color==='string'&&color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
31
|
+
var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(0,prop['chart.margin.top'],0,ca.height-this.marginBottom);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]));}}
|
31
32
|
return grad?grad:color;};this.drawYAxis=this.DrawYAxis=function()
|
32
|
-
{
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if(xaxispos=='center'){for(var i=1;i<=numticks;++i){pa2(co,['m',align=='right'?x+3:x-3,Math.round(y+halfheight+(gap*i)),'l',x,Math.round(y+halfheight+(gap*i))]);}}
|
33
|
+
{var x=this.x,y=this.marginTop,height=ca.height-this.marginBottom-this.marginTop,min=+prop['chart.yaxis.scale.min']?+prop['chart.yaxis.scale.min']:0,max=+prop['chart.yaxis.scale.max'],title=prop['chart.yaxis.title']?prop['chart.yaxis.title']:'',color=prop['chart.colors']?prop['chart.colors'][0]:'black',title_color=prop['chart.yaxis.title.color']?prop['chart.yaxis.title.color']:color,label_color=prop['chart.text.color']?prop['chart.text.color']:color,numticks=typeof(prop['chart.yaxis.tickmarks.count'])=='number'?prop['chart.yaxis.tickmarks.count']:10,labels_specific=prop['chart.yaxis.labels.specific'],numlabels=prop['chart.yaxis.labels.count']?prop['chart.yaxis.labels.count']:5,font=prop['chart.text.font']?prop['chart.text.font']:'Arial, Verdana, sans-serif',size=prop['chart.text.size']?prop['chart.text.size']:12
|
34
|
+
align=typeof(prop['chart.yaxis.tickmarks.align'])=='string'?prop['chart.yaxis.tickmarks.align']:'left',formatter=prop['chart.yaxis.scale.formatter'],decimals=prop['chart.yaxis.scale.decimals'],invert=prop['chart.yaxis.scale.invert'],scale_visible=prop['chart.yaxis.scale.visible'],units_pre=prop['chart.yaxis.scale.units.pre'],units_post=prop['chart.yaxis.scale.units.post'],linewidth=prop['chart.linewidth']?prop['chart.linewidth']:1,notopendtick=!prop['chart.yaxis.tickmarks.last.top'],nobottomendtick=!prop['chart.yaxis.tickmarks.last.bottom'],yaxis=prop['chart.yaxis'],xaxispos=prop['chart.xaxis.position']
|
35
|
+
co.lineWidth=linewidth+0.001;co.strokeStyle=color;if(yaxis){pa2(co,'b m % % l % % s %',Math.round(x),y,Math.round(x),y+height,color);if(numticks){var gap=(xaxispos=='center'?height/2:height)/numticks;var halfheight=height/2;co.beginPath();for(var i=(notopendtick?1:0);i<=(numticks-(nobottomendtick||xaxispos=='center'?1:0));++i){pa2(co,['m',align=='right'?x+3:x-3,Math.round(y+(gap*i)),'l',x,Math.round(y+(gap*i))]);}
|
36
|
+
if(xaxispos=='center'){for(var i=1;i<=numticks-(nobottomendtick?1:0);++i){pa2(co,['m',align=='right'?x+3:x-3,Math.round(y+halfheight+(gap*i)),'l',x,Math.round(y+halfheight+(gap*i))]);}}
|
37
37
|
co.stroke();}}
|
38
38
|
co.fillStyle=label_color;var text_len=0;if(scale_visible){if(labels_specific&&labels_specific.length){var text_len=0;for(var i=0,len=labels_specific.length;i<len;i+=1){text_len=ma.max(text_len,co.measureText(labels_specific[i]).width);}
|
39
|
-
for(var i=0,len=labels_specific.length;i<len;++i){var gap=(len-1)>0?(height/(len-1)):0;if(xaxispos=='center'){gap/=2;}
|
40
|
-
RG.text2(this,{
|
41
|
-
if(xaxispos=='center'){for(var i=(labels_specific.length-2);i>=0;--i){RG.text2(this,{
|
42
|
-
var text=RG.numberFormat(this,original.toFixed(original===0?0:decimals),units_pre,units_post);var text=String(typeof(formatter)=='function'?formatter(this,original):text);var text_len=ma.max(text_len,co.measureText(text).width);this.maxLabelLength=text_len;if(invert){var y=height-((height/numlabels)*i);}else{var y=(height/numlabels)*i;}
|
43
|
-
if(prop['chart.
|
44
|
-
text=text.replace(/^-,([0-9])/,'-$1');RG.text2(this,{
|
45
|
-
if(title){co.beginPath();co.fillStyle=title_color;if(labels_specific){var width=0;for(var i=0,len=labels_specific.length;i<len;i+=1){width=Math.max(width,co.measureText(labels_specific[i]).width);}}else{var
|
46
|
-
RG.text2(this,{font:font,size:size
|
47
|
-
{var width=this.maxLabelLength;if(prop['chart.title']&&prop['chart.title'].length){width+=(prop['chart.text.size']*1.5);}
|
39
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.labels'});for(var i=0,len=labels_specific.length;i<len;++i){var gap=(len-1)>0?(height/(len-1)):0;if(xaxispos=='center'){gap/=2;}
|
40
|
+
RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:x-(align=='right'?-5:5),y:(i*gap)+this.marginTop,text:labels_specific[i],valign:'center',halign:align=='right'?'left':'right',tag:'scale'});this.maxLabelLength=ma.max(this.maxLabelLength,co.measureText(labels_specific[i]).width);}
|
41
|
+
if(xaxispos=='center'){for(var i=(labels_specific.length-2);i>=0;--i){RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:x-(align=='right'?-5:5),y:ca.height-this.marginBottom-(i*gap),text:labels_specific[i],valign:'center',halign:align=='right'?'left':'right',tag:'scale'});}}}else{var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.labels'});for(var i=0;i<=numlabels;++i){var original=((max-min)*((numlabels-i)/numlabels))+min;if(original==0&&prop['chart.yaxis.scale.zerostart']==false){continue;}
|
42
|
+
var text=RG.numberFormat({object:this,number:original.toFixed(original===0?0:decimals),unitspre:units_pre,unitspost:units_post,point:prop['chart.yaxis.scale.point'],thousand:prop['chart.yaxis.scale.thousand']});var text=String(typeof(formatter)=='function'?formatter(this,original):text);var text_len=ma.max(text_len,co.measureText(text).width);this.maxLabelLength=text_len;if(invert){var y=height-((height/numlabels)*i);}else{var y=(height/numlabels)*i;}
|
43
|
+
if(prop['chart.xaxis.position']=='center'){y=y/2;}
|
44
|
+
text=text.replace(/^-,([0-9])/,'-$1');RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:x-(align=='right'?-5:5),y:y+this.marginTop,text:text,valign:'center',halign:align=='right'?'left':'right',tag:'scale'});if(prop['chart.xaxis.position']=='center'&&i<numlabels){RG.Text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:x-(align=='right'?-5:5),y:ca.height-this.marginBottom-y,text:'-'+text,valign:'center',halign:align=='right'?'left':'right',tag:'scale'});}}}}
|
45
|
+
if(title){co.beginPath();co.fillStyle=title_color;if(labels_specific){var width=0;for(var i=0,len=labels_specific.length;i<len;i+=1){width=Math.max(width,co.measureText(labels_specific[i]).width);}}else{var m=RG.measureText(prop['chart.yaxis.scale.units.pre']+prop['chart.yaxis.scale.max'].toFixed(prop['chart.yaxis.scale.decimals'])+prop['chart.yaxis.scale.units.post']),width=m[0];}
|
46
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.title'});RG.text2(this,{font:textConf.font,size:textConf.size,bold:textConf.bold,italic:textConf.italic,color:textConf.color,x:align=='right'?x+width+13:x-width-13,y:height/2+this.marginTop,text:title,valign:'bottom',halign:'center',angle:align=='right'?90:-90,accessible:false});co.stroke();}};this.getWidth=function()
|
47
|
+
{var width=this.maxLabelLength;if(prop['chart.yaxis.title']&&prop['chart.yaxis.title'].length){width+=(prop['chart.text.size']*1.5);}
|
48
48
|
this.width=width;return width;};this.on=function(type,func)
|
49
49
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
50
50
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
51
51
|
return this;};this.firstDrawFunc=function()
|
52
|
-
{};RG.
|
52
|
+
{};RG.register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Fuel=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.id==='string'){var id=conf.id,canvas=document.getElementById(id),min=conf.min,max=conf.max,value=conf.value,parseConfObjectForOptions=true;}else{var id=conf,canvas=document.getElementById(id),min=arguments[1],max=arguments[2],value=arguments[3];}
|
4
|
-
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='fuel';this.isRGraph=true;this.min=RGraph.stringsToNumbers(min);this.max=RGraph.stringsToNumbers(max);this.value=RGraph.stringsToNumbers(value);this.angles={};this.currentValue=null;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.coordsText=[];this.original_colors=[];this.firstDraw=true;if(!this.canvas){alert('[FUEL] No canvas support');return;}
|
5
|
-
this.properties={'chart.colors':['Gradient(white:red)'],'chart.needle.color':'red','chart.
|
4
|
+
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='fuel';this.isRGraph=true;this.min=RGraph.stringsToNumbers(min);this.max=RGraph.stringsToNumbers(max);this.value=RGraph.stringsToNumbers(value);this.angles={};this.currentValue=null;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={};if(!this.canvas){alert('[FUEL] No canvas support');return;}
|
5
|
+
this.properties={'chart.centerx':null,'chart.centery':null,'chart.radius':null,'chart.colors':['Gradient(white:red)'],'chart.needle.color':'red','chart.needle.radius.offset':45,'chart.margin.left':5,'chart.margin.right':5,'chart.margin.top':5,'chart.margin.bottom':5,'chart.text.size':12,'chart.text.color':'black','chart.text.font':'Arial, Verdana, sans-serif','chart.text.bold':false,'chart.text.italic':false,'chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.contextmenu':null,'chart.annotatable':false,'chart.annotatable.color':'black','chart.adjustable':false,'chart.resizable':false,'chart.resizable.handle.background':null,'chart.icon':'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAfCAYAAAD0ma06AAAEGElEQVRIS7VXSyhtYRT+jnfe5FEMjAwUBiQGHikzRWIkkgy8YyDK+xnJK5JCeZSUGKBMiAyYkMxMJAMpSfJ+2/d8695/33NunSPnHqt2Z5+91/9/'+'/'+'/et9a/1b8Pn56dmMBhg/IWDgwNoNzc38PHxkXtN0+Tiexp9eH18fIDj1Bj63N/fw8vLS/wsmcHoqKmXT09PuL29RVFREU5OTvTJ6UIAgioQ+vLe09MTb29v8PX1RWBgICYnJ+XXIqDRWXN0dJT3nIDsWlpadP+lpSWZlD4KmL/8/'+'/7+Ls/S09N1/7y8PISHh+sK/QssDJWcHEyGCnB1dRUDAwPIzMzUx5GpAnZ1dcXy8jK2trbM5j06OsLc3JzISx8q4OzsLOOsAq6treHg4AAeHh4WJbq7u0Nzc7P+PiYmBnt7ezg9PcXExAQCAgLg5OSEx8dHuLu7Wwfc3t7G/v6+yEcjO8rIROGKaWdnZ+jr6zMDjI6OxvT0tDzr6uqS2KtksspwZ2cHjY2NuqSUhnHmilUCraysmElaWloKJpQCjI2NRX5+Pl5eXr6WlCv08/MTEMVOZDH+Zzw4CdlfX1/rDHt7ezE1NQXGkcYEKi4ulkVKYlpLGouBs/JiaGgIZL25uSlecXFxohAz/ccAz8/P4e/vj7q6Ojw8PMje5DNRy94MQ0JCUFtbK2wqKipE+sHBQbi4uPwMQ86ak5ODxMREVFdXIywsDCUlJRJDXnZlmJqaip6eHuTm5kqikGlycjIyMjL+ZrY9JSUgMzQiIgINDQ2ypaqqqkCZWXHsnjQEHB8fR0pKigAxabq7uyWOlJNxtLukTJDs7GxUVlZKDNl5oqKi8Pr6+jOAIyMjiI+Pl5JGQG4F1Qy+LN7f3fiUdGZmBsHBwRgbG8Pw8LD01ba2NmlX0rTtnTQLCwvSjEdHR3FxcSExLCwsRGRkpBR9vePzeMDyw3bT1NT0XXLiT4a7u7s4Pj4GGzd7K8GCgoKEsRR8I4Cm6hwHXV5eiv62GAE5npMTmFuBTCkzmzT7qs5Q9TlW/o6ODlvwhCHPM5SVPZIxYzNeXFxEa2srvL29YTC2GI3aMm3Zeq6urv4LMC0tDRsbG1K8k5KS9DgS0IwhKVFjSsJA22r9/f0oKCgQdvPz83JEmZ2dlcpD9maSshow0KZnlO8Csx9yK3BLKCMJPpf2xGMigdi9WXooaWdn53dxdP+amhrZh4eHh1hfX5cTW319vZyBnp+ffzNkBWBmhYaGysB/j322oCckJCArK0uGMlsJ5ubmBoPxRiMzFlomjr2MGdne3i5ANILRJEtJt6ysTG8h9gDl4am8vFwSUWron1O9LulXIOqk9pWftfdSS40yyj5Uh101wPRryuR7R1ZMX/U1pfy5IF40xcgUnGAc9wsGYxsFhy87kwAAAABJRU5ErkJggg==','chart.icon.redraw':true,'chart.background.image.stretch':false,'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.labels.full':'F','chart.labels.empty':'E','chart.labels.font':null,'chart.labels.size':null,'chart.labels.color':null,'chart.labels.bold':null,'chart.labels.italic':null,'chart.scale.visible':false,'chart.scale.decimals':0,'chart.scale.units.pre':'','chart.scale.units.post':'','chart.scale.point':'.','chart.scale.thousand':',','chart.scale.labels.count':5,'chart.clearto':'rgba(0,0,0,0)'}
|
6
6
|
if(this.value>this.max)this.value=this.max;if(this.value<this.min)this.value=this.min;if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
7
7
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
8
8
|
if(RG.Effects&&typeof RG.Effects.decorate==='function'){RG.Effects.decorate(this);}
|
@@ -14,36 +14,37 @@ prop[name]=value;return this;};this.get=this.Get=function(name)
|
|
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
16
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
17
|
-
{RG.
|
18
|
-
this.radius=ca.height-this.
|
19
|
-
this.angles.start=(RG.PI+RG.HALFPI)-0.5;this.angles.end=(RG.PI+RG.HALFPI)+0.5;this.angles.needle=this.getAngle(this.value);this.
|
20
|
-
if(prop['chart.resizable']){RG.
|
21
|
-
RG.
|
22
|
-
RG.
|
17
|
+
{RG.fireCustomEvent(this,'onbeforedraw');this.currentValue=this.value;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.centerx=((ca.width-this.marginLeft-this.marginRight)/2)+this.marginLeft;this.centery=ca.height-20-this.marginBottom
|
18
|
+
this.radius=ca.height-this.marginTop-this.marginBottom-20;this.coordsText=[];if(typeof(prop['chart.centerx'])=='number')this.centerx=prop['chart.centerx'];if(typeof(prop['chart.centery'])=='number')this.centery=prop['chart.centery'];if(typeof(prop['chart.radius'])=='number')this.radius=prop['chart.radius'];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
19
|
+
this.angles.start=(RG.PI+RG.HALFPI)-0.5;this.angles.end=(RG.PI+RG.HALFPI)+0.5;this.angles.needle=this.getAngle(this.value);this.drawLabels();this.drawChart();if(prop['chart.contextmenu']){RG.showContext(this);}
|
20
|
+
if(prop['chart.resizable']){RG.allowResizing(this);}
|
21
|
+
RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
22
|
+
RG.fireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
23
23
|
{func(this);return this;};this.drawChart=this.DrawChart=function()
|
24
|
-
{this.
|
25
|
-
this.
|
26
|
-
{if(!prop['chart.scale.visible']){var radius=(this.radius-20);co.fillStyle=prop['chart.text.color'];var y=this.centery-Math.sin(this.angles.start-RG.PI)*(this.radius-
|
27
|
-
{co.beginPath();co.lineWidth=5;co.lineCap='round';co.strokeStyle=prop['chart.needle.color'];var angle=this.angles.needle;co.arc(this.centerx,this.centery,this.radius-
|
24
|
+
{this.drawScale();if(!RG.ISOLD){this.DrawIcon();}
|
25
|
+
this.drawNeedle();};this.drawLabels=this.DrawLabels=function()
|
26
|
+
{if(!prop['chart.scale.visible']){var radius=(this.radius-20);co.fillStyle=prop['chart.text.color'];var y=this.centery-Math.sin(this.angles.start-RG.PI)*(this.radius-17);var x=this.centerx-Math.cos(this.angles.start-RG.PI)*(this.radius-17);var textConf=RG.getTextConf({object:this,prefix:'chart.labels'});RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:y,text:prop['chart.labels.empty'],halign:'left',valign:'top',tag:'labels'});var y=this.centery-Math.sin(this.angles.start-RG.PI)*(this.radius-17);var x=this.centerx+Math.cos(this.angles.start-RG.PI)*(this.radius-17);RG.Text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:y,text:prop['chart.labels.full'],halign:'right',valign:'top',tag:'labels'});}};this.drawNeedle=this.DrawNeedle=function()
|
27
|
+
{co.beginPath();co.lineWidth=5;co.lineCap='round';co.strokeStyle=prop['chart.needle.color'];var angle=this.angles.needle;co.arc(this.centerx,this.centery,this.radius-prop['chart.needle.radius.offset'],angle,angle+0.0001,false);co.lineTo(this.centerx,this.centery);co.stroke();co.lineWidth=1;var cx=this.centerx+10;var cy=this.centery-10
|
28
28
|
var grad=co.createRadialGradient(cx,cy,35,cx,cy,0);grad.addColorStop(0,'black');grad.addColorStop(1,'#eee');if(navigator.userAgent.indexOf('Firefox/6.0')>0){grad=co.createLinearGradient(cx+10,cy-10,cx-10,cy+10);grad.addColorStop(1,'#666');grad.addColorStop(0.5,'#ccc');}
|
29
29
|
co.beginPath();co.fillStyle=grad;co.moveTo(this.centerx,this.centery);co.arc(this.centerx,this.centery,20,0,RG.TWOPI,0);co.fill();};this.drawScale=this.DrawScale=function()
|
30
30
|
{var a,x,y;co.beginPath();co.strokeStyle='black';co.fillStyle='white';co.arc(this.centerx,this.centery,this.radius,this.angles.start,this.angles.end,false);co.arc(this.centerx,this.centery,this.radius-10,this.angles.end,this.angles.start,true);co.closePath();co.stroke();co.fill();var start=this.angles.start;var end=this.angles.needle;co.beginPath();co.fillStyle=prop['chart.colors'][0];co.arc(this.centerx,this.centery,this.radius,start,end,false);co.arc(this.centerx,this.centery,this.radius-10,end,start,true);co.closePath();co.fill();for(a=this.angles.start;a<=this.angles.end+0.01;a+=((this.angles.end-this.angles.start)/5)){co.beginPath();co.arc(this.centerx,this.centery,this.radius-10,a,a+0.0001,false);co.arc(this.centerx,this.centery,this.radius-15,a+0.0001,a,true);co.stroke();}
|
31
|
-
if(prop['chart.scale.visible']){co.fillStyle=prop['chart.text.color'];var numLabels=prop['chart.labels.count'];var decimals=prop['chart.scale.decimals'];var font=prop['chart.text.font'];var size=prop['chart.text.size'];var
|
31
|
+
if(prop['chart.scale.visible']){co.fillStyle=prop['chart.text.color'];var numLabels=prop['chart.scale.labels.count'];var decimals=prop['chart.scale.decimals'];var units_post=prop['chart.scale.units.post'];var units_pre=prop['chart.scale.units.pre'];var font=prop['chart.text.font'];var size=prop['chart.text.size'];var color=prop['chart.text.color'];var bold=prop['chart.text.bold'];var italic=prop['chart.text.italic'];for(var i=0;i<=numLabels;++i){a=((this.angles.end-this.angles.start)*(i/numLabels))+this.angles.start;y=this.centery-Math.sin(a-RG.PI)*(this.radius-17);x=this.centerx-Math.cos(a-RG.PI)*(this.radius-17);var textConf=RG.getTextConf({object:this,prefix:'chart.labels'});RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:y,text:RG.numberFormat({object:this,number:(this.min+((this.max-this.min)*(i/numLabels))).toFixed(decimals),unitspre:units_pre,unitspost:units_post,point:prop['chart.scale.point'],thousand:prop['chart.scale.thousand']}),halign:'center',valign:'top',tag:'scale'});}}};this.getShape=function(e){};this.getValue=function(e)
|
32
32
|
{var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(this.centerx,this.centery,mouseXY[0],mouseXY[1]);if(angle>=this.angles.end){return this.max;}else if(angle<=this.angles.start){return this.min;}
|
33
33
|
var value=(angle-this.angles.start)/(this.angles.end-this.angles.start);value=value*(this.max-this.min);value=value+this.min;return value;};this.getObjectByXY=function(e)
|
34
34
|
{var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(this.centerx,this.centery,mouseXY[0],mouseXY[1]);var accuracy=15;var leftMin=this.centerx-this.radius;var rightMax=this.centerx+this.radius;var topMin=this.centery-this.radius;var bottomMax=this.centery+this.radius;if(mouseXY[0]>leftMin&&mouseXY[0]<rightMax&&mouseXY[1]>topMin&&mouseXY[1]<bottomMax){return this;}};this.drawIcon=this.DrawIcon=function()
|
35
|
-
{if(!
|
36
|
-
{img.__loaded__=true;var obj=img.__object__;co.drawImage(img,obj.centerx-(img.width/2),obj.centery-obj.radius+35);obj.DrawNeedle();if(prop['chart.icon.redraw']){obj.Set('chart.icon.redraw',false);RG.Clear(obj.canvas);RG.RedrawCanvas(ca);}}}else{var img=this.__icon__;co.drawImage(img,this.centerx-(img.width/2),this.centery-this.radius+35);}
|
35
|
+
{if(!this.__icon__||!this.__icon__.__loaded__){var img=new Image();img.src=prop['chart.icon'];img.__object__=this;this.__icon__=img;img.onload=function(e)
|
36
|
+
{img.__loaded__=true;var obj=img.__object__;co.drawImage(img,obj.centerx-(img.width/2),obj.centery-obj.radius+35);obj.DrawNeedle();if(prop['chart.icon.redraw']){obj.Set('chart.icon.redraw',false);RG.Clear(obj.canvas);RG.RedrawCanvas(ca);}}}else{var img=this.__icon__;co.drawImage(img,this.centerx-(img.width/2),this.centery-this.radius+35);}
|
37
37
|
this.DrawNeedle();};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
|
38
|
-
{if(prop['chart.adjustable']&&RG.Registry.
|
38
|
+
{if(prop['chart.adjustable']&&RG.Registry.get('chart.adjusting')&&RG.Registry.get('chart.adjusting').uid==this.uid){this.value=this.getValue(e);RG.redrawCanvas(ca);RG.fireCustomEvent(this,'onadjust');}};this.getAngle=function(value)
|
39
39
|
{if(value<this.min||value>this.max){return null;}
|
40
40
|
var angle=(((value-this.min)/(this.max-this.min))*(this.angles.end-this.angles.start))+this.angles.start;return angle;};this.parseColors=function()
|
41
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.
|
41
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.arrayClone(prop['chart.colors']);this.original_colors['chart.needle.color']=RG.arrayClone(prop['chart.needle.color']);}
|
42
42
|
var props=this.properties;var colors=props['chart.colors'];for(var i=0;i<colors.length;++i){colors[i]=this.parseSingleColorForLinearGradient(colors[i]);}
|
43
43
|
props['chart.needle.color']=this.parseSingleColorForRadialGradient(props['chart.needle.color']);};this.reset=function()
|
44
44
|
{};this.parseSingleColorForLinearGradient=function(color)
|
45
45
|
{if(!color||typeof(color)!='string'){return color;}
|
46
|
-
if(color.match(/^gradient\((.*)\)$/i)){
|
46
|
+
if(color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
47
|
+
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]));}}
|
47
48
|
return grad?grad:color;};this.parseSingleColorForRadialGradient=function(color)
|
48
49
|
{if(!color||typeof color!='string'){return color;}
|
49
50
|
if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createRadialGradient(this.centerx,this.centery,0,this.centerx,this.centery,this.radius);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]));}}
|
@@ -56,4 +57,4 @@ return this;};this.firstDrawFunc=function()
|
|
56
57
|
var newValue=this.value;var diff=newValue-origValue;var step=(diff/numFrames);var frame=0;function iterator()
|
57
58
|
{frame++;obj.value=((frame/numFrames)*diff)+origValue
|
58
59
|
if(obj.value>obj.max)obj.value=obj.max;if(obj.value<obj.min)obj.value=obj.min;RGraph.clear(obj.canvas);RGraph.redrawCanvas(obj.canvas);if(frame<numFrames){RGraph.Effects.updateCanvas(iterator);}else{callback(obj);}}
|
59
|
-
iterator();return this;};RG.
|
60
|
+
iterator();return this;};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|
@@ -2,8 +2,8 @@
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Funnel=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.data==='object'&&typeof conf.id==='string'){var id=conf.id
|
4
4
|
var canvas=document.getElementById(id);var data=conf.data;var parseConfObjectForOptions=true;}else{var id=conf;var canvas=document.getElementById(id);var data=arguments[1];}
|
5
|
-
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='funnel';this.coords=[];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;if(!this.canvas){alert('[FUNNEL] No canvas support');return;}
|
6
|
-
this.properties={'chart.
|
5
|
+
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='funnel';this.coords=[];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={};if(!this.canvas){alert('[FUNNEL] No canvas support');return;}
|
6
|
+
this.properties={'chart.colors.stroke':'rgba(0,0,0,0)','chart.colors':['Gradient(white:red)','Gradient(white:green)','Gradient(white:gray)','Gradient(white:blue)','Gradient(white:black)','Gradient(white:gray)','Gradient(white:pink)','Gradient(white:blue)','Gradient(white:yellow)','Gradient(white:green)','Gradient(white:red)'],'chart.margin.left':25,'chart.margin.right':25,'chart.margin.top':25,'chart.margin.bottom':25,'chart.labels':null,'chart.labels.font':null,'chart.labels.size':null,'chart.labels.color':null,'chart.labels.bold':null,'chart.labels.italic':null,'chart.labels.sticks':false,'chart.labels.x':null,'chart.title':'','chart.title.background':null,'chart.title.hpos':null,'chart.title.vpos':null,'chart.title.italic':null,'chart.title.bold':null,'chart.title.font':null,'chart.title.size':null,'chart.title.color':null,'chart.title.x':null,'chart.title.y':null,'chart.title.halign':null,'chart.title.valign':null,'chart.text.size':12,'chart.text.color':'black','chart.text.font':'Arial, Verdana, sans-serif','chart.text.bold':false,'chart.text.italic':false,'chart.text.halign':'left','chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.contextmenu':null,'chart.shadow':false,'chart.shadow.color':'#666','chart.shadow.blur':3,'chart.shadow.offsetx':3,'chart.shadow.offsety':3,'chart.key':null,'chart.key.background':'white','chart.key.position':'graph','chart.key.halign':'right','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.color.shape':'square','chart.key.rounded':true,'chart.key.linewidth':1,'chart.key.colors':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.labels.font':null,'chart.key.labels.size':null,'chart.key.labels.color':null,'chart.key.labels.bold':null,'chart.key.labels.italic':null,'chart.key.labels.offsetx':0,'chart.key.labels.offsety':0,'chart.tooltips.highlight':true,'chart.tooltips':null,'chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.event':'onclick','chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.annotatable':false,'chart.annotatable.color':'black','chart.resizable':false,'chart.resizable.handle.background':null,'chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
|
7
7
|
for(var i=0;i<data.length;++i){data[i]=parseFloat(data[i]);}
|
8
8
|
this.data=data;for(var i=0;i<data.length;++i){this['$'+i]={};}
|
9
9
|
if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
@@ -17,40 +17,41 @@ prop[name]=value;return this;};this.get=this.Get=function(name)
|
|
17
17
|
{if(name.substr(0,6)!='chart.'){name='chart.'+name;}
|
18
18
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
19
19
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
20
|
-
{RG.
|
21
|
-
this.
|
22
|
-
this.
|
20
|
+
{RG.fireCustomEvent(this,'onbeforedraw');if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
21
|
+
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.coords=[];this.coordsText=[];RG.drawTitle(this,prop['chart.title'],this.marginTop,null,typeof prop['chart.title.size']==='number'?prop['chart.title.size']:prop['chart.text.size']);this.drawFunnel();if(prop['chart.contextmenu']){RG.showContext(this);}
|
22
|
+
this.drawLabels();if(prop['chart.resizable']){RG.allowResizing(this);}
|
23
23
|
RG.InstallEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
24
24
|
RG.FireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
25
25
|
{func(this);return this;};this.drawFunnel=this.DrawFunnel=function()
|
26
|
-
{var width=ca.width-this.
|
27
|
-
for(i=0,len=this.data.length;i<len;++i){var firstvalue=this.data[0];var firstwidth=(firstvalue/
|
26
|
+
{var width=ca.width-this.marginLeft-this.marginRight;var height=ca.height-this.marginTop-this.marginBottom;var max=RG.arrayMax(this.data);var accheight=this.marginTop;if(prop['chart.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'];}
|
27
|
+
for(i=0,len=this.data.length;i<len;++i){var firstvalue=this.data[0];var firstwidth=(firstvalue/max)*width;var curvalue=this.data[i];var curwidth=(curvalue/max)*width;var curheight=height/(this.data.length-1);var halfCurWidth=(curwidth/2);var nextvalue=this.data[i+1];var nextwidth=this.data[i+1]?(nextvalue/max)*width:null;var halfNextWidth=(nextwidth/2);var center=this.marginLeft+(firstwidth/2);var x1=center-halfCurWidth;var y1=accheight;var x2=center+halfCurWidth;var y2=accheight;var x3=center+halfNextWidth;var y3=accheight+curheight;var x4=center-halfNextWidth;var y4=accheight+curheight;if(nextwidth&&i<this.data.length-1){co.beginPath();co.strokeStyle=prop['chart.colors.stroke'];co.fillStyle=prop['chart.colors'][i];co.moveTo(x1,y1);co.lineTo(x2,y2);co.lineTo(x3,y3);co.lineTo(x4,y4);co.closePath();this.coords.push([x1,y1,x2,y2,x3,y3,x4,y4]);}
|
28
28
|
if(!prop['chart.shadow']){co.stroke();}
|
29
29
|
co.fill();accheight+=curheight;}
|
30
|
-
if(prop['chart.shadow']){RG.
|
31
|
-
if(prop['chart.key']&&prop['chart.key'].length){RG.
|
32
|
-
{if(prop['chart.labels']&&prop['chart.labels'].length>0){var font=prop['chart.text.font'];var size=prop['chart.text.size'];var color=prop['chart.text.color'];var labels=prop['chart.labels'];var halign=prop['chart.text.halign']=='left'?'left':'center';var
|
33
|
-
for(var j=0;j<this.coords.length;++j){co.beginPath();co.strokeStyle='black';co.fillStyle=color;RG.
|
34
|
-
var lastLabel=labels[j];if(lastLabel){RG.text2(this,{
|
30
|
+
if(prop['chart.shadow']){RG.noShadow(this);for(i=0;i<this.coords.length;++i){co.strokeStyle=prop['chart.colors.stroke'];co.fillStyle=prop['chart.colors'][i];co.beginPath();co.moveTo(this.coords[i][0],this.coords[i][1]);co.lineTo(this.coords[i][2],this.coords[i][3]);co.lineTo(this.coords[i][4],this.coords[i][5]);co.lineTo(this.coords[i][6],this.coords[i][7]);co.closePath();co.stroke();co.fill();}}
|
31
|
+
if(prop['chart.key']&&prop['chart.key'].length){RG.drawKey(this,prop['chart.key'],prop['chart.colors']);}};this.drawLabels=this.DrawLabels=function()
|
32
|
+
{if(prop['chart.labels']&&prop['chart.labels'].length>0){var font=prop['chart.text.font'];var size=prop['chart.text.size'];var color=prop['chart.text.color'];var labels=prop['chart.labels'];var halign=prop['chart.text.halign']=='left'?'left':'center';var textConf=RG.getTextConf({object:this,prefix:'chart.labels'});if(typeof prop['chart.labels.x']=='number'){var x=prop['chart.labels.x'];}else{var x=halign=='left'?(this.marginLeft-15):((ca.width-this.marginLeft-this.marginRight)/2)+this.marginLeft;}
|
33
|
+
for(var j=0;j<this.coords.length;++j){co.beginPath();co.strokeStyle='black';co.fillStyle=color;RG.noShadow(this);var label=labels[j]||'';RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:this.coords[j][1],text:label,valign:'center',halign:halign,bounding:true,boundingFill:'rgba(255,255,255,0.7)',boundingStroke:'rgba(0,0,0,0)',tag:'labels'});if(prop['chart.labels.sticks']&&labels[j]){co.font=size+'pt '+font;var labelWidth=co.measureText(label).width;co.beginPath();co.strokeStyle='gray';co.moveTo(x+labelWidth+10,ma.round(this.coords[j][1]));co.lineTo(this.coords[j][0]-10,ma.round(this.coords[j][1]));co.stroke();}}
|
34
|
+
var lastLabel=labels[j];if(lastLabel){RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:this.coords[j-1][5],text:lastLabel,valign:'center',halign:halign,bounding:true,boundingFill:'rgba(255,255,255,0.7)',boundingStroke:'rgba(0,0,0,0)',tag:'labels'});if(prop['chart.labels.sticks']){co.font=size+'pt '+font;var labelWidth=co.measureText(lastLabel).width;co.beginPath();co.strokeStyle='gray';co.moveTo(x+labelWidth+10,Math.round(this.coords[j-1][7]));co.lineTo(this.coords[j-1][6]-10,Math.round(this.coords[j-1][7]));co.stroke();}}}};this.getShape=this.getSegment=function(e)
|
35
35
|
{var coords=this.coords;var mouseCoords=RG.getMouseXY(e);var x=mouseCoords[0];var y=mouseCoords[1];for(i=0,len=coords.length;i<len;++i){var segment=coords[i]
|
36
36
|
co.beginPath();co.moveTo(segment[0],segment[1]);co.lineTo(segment[2],segment[3]);co.lineTo(segment[4],segment[5]);co.lineTo(segment[6],segment[7]);co.lineTo(segment[8],segment[9]);if(co.isPointInPath(x,y)){var tooltip=RGraph.parseTooltipText(prop['chart.tooltips'],i);return{0:this,1:coords,2:i,'object':this,'coords':segment,'index':i,'tooltip':tooltip};}}
|
37
37
|
return null;};this.highlight=this.Highlight=function(shape)
|
38
38
|
{if(prop['chart.tooltips.highlight']){if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);return;}
|
39
39
|
var coords=shape['coords'];pa2(co,'b m % % l % % l % % l % % c s % f %',coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6],coords[7],prop['chart.highlight.stroke'],prop['chart.highlight.fill']);}};this.getObjectByXY=function(e)
|
40
|
-
{var mouseXY=RGraph.getMouseXY(e);if(mouseXY[0]>prop['chart.
|
41
|
-
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.array_clone(prop['chart.colors']);this.original_colors['chart.key.colors']=RG.array_clone(prop['chart.key.colors']);this.original_colors['chart.highlight.fill']=RG.array_clone(prop['chart.highlight.fill']);this.original_colors['chart.highlight.stroke']=RG.array_clone(prop['chart.highlight.stroke']);this.original_colors['chart.
|
40
|
+
{var mouseXY=RGraph.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.parseColors=function()
|
41
|
+
{if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.array_clone(prop['chart.colors']);this.original_colors['chart.key.colors']=RG.array_clone(prop['chart.key.colors']);this.original_colors['chart.highlight.fill']=RG.array_clone(prop['chart.highlight.fill']);this.original_colors['chart.highlight.stroke']=RG.array_clone(prop['chart.highlight.stroke']);this.original_colors['chart.colors.stroke']=RG.array_clone(prop['chart.colors.stroke']);}
|
42
42
|
var colors=prop['chart.colors'];for(var i=0;i<colors.length;++i){colors[i]=this.parseSingleColorForHorizontalGradient(colors[i]);}
|
43
43
|
var keyColors=prop['chart.key.colors'];if(keyColors){for(var i=0;i<keyColors.length;++i){keyColors[i]=this.parseSingleColorForHorizontalGradient(keyColors[i]);}}
|
44
|
-
prop['chart.
|
44
|
+
prop['chart.colors.stroke']=this.parseSingleColorForVerticalGradient(prop['chart.colors.stroke']);prop['chart.highlight.stroke']=this.parseSingleColorForHorizontalGradient(prop['chart.highlight.stroke']);prop['chart.highlight.fill']=this.parseSingleColorForHorizontalGradient(prop['chart.highlight.fill']);};this.reset=function()
|
45
45
|
{};this.parseSingleColorForHorizontalGradient=function(color)
|
46
46
|
{if(!color||typeof(color)!='string'){return color;}
|
47
|
-
if(color.match(/^gradient\((.*)\)$/i)){
|
47
|
+
if(color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
48
|
+
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,RGraph.trim(parts[0]));for(var j=1;j<parts.length;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
|
48
49
|
return grad?grad:color;};this.parseSingleColorForVerticalGradient=function(color)
|
49
50
|
{if(!color||typeof(color)!='string'){return color;}
|
50
|
-
if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(0,prop['chart.
|
51
|
+
if(color.match(/^gradient\((.*)\)$/i)){var parts=RegExp.$1.split(':');var grad=co.createLinearGradient(0,prop['chart.margin.top'],0,ca.height-prop['chart.margin.bottom']);var diff=1/(parts.length-1);grad.addColorStop(0,RGraph.trim(parts[0]));for(var j=1;j<parts.length;++j){grad.addColorStop(j*diff,RG.trim(parts[j]));}}
|
51
52
|
return grad?grad:color;};this.interactiveKeyHighlight=function(index)
|
52
53
|
{var coords=this.coords[index];if(coords&&coords.length==8){var pre_linewidth=co.lineWidth;co.lineWidth=2;co.strokeStyle=prop['chart.key.interactive.highlight.chart.stroke'];co.fillStyle=prop['chart.key.interactive.highlight.chart.fill'];co.beginPath();co.moveTo(coords[0],coords[1]);co.lineTo(coords[2],coords[3]);co.lineTo(coords[4],coords[5]);co.lineTo(coords[6],coords[7]);co.closePath();co.fill();co.stroke();co.lineWidth=pre_linewidth;}};this.on=function(type,func)
|
53
54
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
54
55
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
55
56
|
return this;};this.firstDrawFunc=function()
|
56
|
-
{};RG.
|
57
|
+
{};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|
@@ -2,8 +2,8 @@
|
|
2
2
|
RGraph=window.RGraph||{isRGraph:true};RGraph.Gantt=function(conf)
|
3
3
|
{if(typeof conf==='object'&&typeof conf.data==='object'&&typeof conf.id==='string'){var id=conf.id
|
4
4
|
var canvas=document.getElementById(id);var data=conf.data;var parseConfObjectForOptions=true;}else{var id=conf;var canvas=document.getElementById(id);var data=arguments[1];}
|
5
|
-
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='gantt';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.data=data;this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.properties={'chart.background.
|
6
|
-
if(!data){alert('[GANTT] The Gantt chart event data is now supplied as the second argument to the constructor - please update your code');}else{for(var i=0,idx=0;i<data.length;++i){if(typeof data[i]
|
5
|
+
this.id=id;this.canvas=canvas;this.context=this.canvas.getContext?this.canvas.getContext("2d",{alpha:(typeof id==='object'&&id.alpha===false)?false:true}):null;this.canvas.__object__=this;this.type='gantt';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.data=data;this.colorsParsed=false;this.coordsText=[];this.original_colors=[];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.linewidth':1,'chart.background.grid.color':'#ddd','chart.background.grid.hsize':20,'chart.background.grid.vsize':20,'chart.background.grid.hlines':true,'chart.background.grid.vlines':true,'chart.background.grid.border':true,'chart.background.grid.align':true,'chart.background.grid.autofit':true,'chart.background.grid.autofit.align':true,'chart.background.grid.hlines.count':null,'chart.background.grid.vlines.count':null,'chart.background.vbars':[],'chart.background.hbars':[],'chart.text.size':12,'chart.text.font':'Arial, Verdana, sans-serif','chart.text.color':'black','chart.text.bold':false,'chart.text.italic':false,'chart.text.accessible':true,'chart.text.accessible.overflow':'visible','chart.text.accessible.pointerevents':false,'chart.margin.left':75,'chart.margin.right':25,'chart.margin.top':35,'chart.margin.bottom':25,'chart.labels.inbar':null,'chart.labels.inbar.bgcolor':null,'chart.labels.inbar.align':'left','chart.labels.inbar.size':null,'chart.labels.inbar.font':null,'chart.labels.inbar.color':null,'chart.labels.inbar.bold':null,'chart.labels.inbar.italic':null,'chart.labels.inbar.above':false,'chart.labels.complete':true,'chart.labels.complete.font':null,'chart.labels.complete.size':null,'chart.labels.complete.color':null,'chart.labels.complete.bold':null,'chart.labels.complete.italic':null,'chart.vmargin':2,'chart.title':'','chart.title.background':null,'chart.title.x':null,'chart.title.y':null,'chart.title.bold':null,'chart.title.italic':null,'chart.title.font':null,'chart.title.size':null,'chart.title.color':null,'chart.title.halign':null,'chart.title.valign':null,'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.title':'','chart.yaxis.title.bold':null,'chart.yaxis.title.italic':null,'chart.yaxis.title.font':null,'chart.yaxis.title.size':null,'chart.yaxis.title.color':null,'chart.yaxis.title.pos':null,'chart.yaxis.title.position':'right','chart.yaxis.title.x':null,'chart.yaxis.title.y':null,'chart.xaxis.labels':[],'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.align':'bottom','chart.xaxis.title':'','chart.xaxis.title.x':null,'chart.xaxis.title.y':null,'chart.xaxis.title.bold':null,'chart.xaxis.title.color':null,'chart.xaxis.title.font':null,'chart.xaxis.title.size':null,'chart.xaxis.title.italic':null,'chart.xaxis.scale.min':0,'chart.xaxis.scale.max':0,'chart.colors.default':'white','chart.borders':true,'chart.coords':[],'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.contextmenu':null,'chart.annotatable':false,'chart.annotatable.color':'black','chart.resizable':false,'chart.resizable.handle.adjust':[0,0],'chart.resizable.handle.background':null,'chart.adjustable':false,'chart.adjustable.only':null,'chart.events.click':null,'chart.events.mousemove':null,'chart.clearto':'rgba(0,0,0,0)'}
|
6
|
+
if(!data){alert('[GANTT] The Gantt chart event data is now supplied as the second argument to the constructor - please update your code');}else{for(var i=0,idx=0;i<data.length;++i){if(typeof data[i].start==='string')data[i].start=parseFloat(data[i].start);if(typeof data[i].duration==='string')data[i].duration=parseFloat(data[i].duration);if(typeof data[i].complete==='string')data[i].complete=parseFloat(data[i].complete);if(typeof data[i].linewidth==='string')data[i].linewidth=parseFloat(data[i].linewidth);}}
|
7
7
|
for(var i=0,idx=0;i<data.length;++i){if(RGraph.isArray(this.data[i][0])){for(var j=0;j<this.data[i].length;++j){this['$'+(idx++)]={};}}else{this['$'+(idx++)]={};}}
|
8
8
|
if(!this.canvas.__rgraph_aa_translated__){this.context.translate(0.5,0.5);this.canvas.__rgraph_aa_translated__=true;}
|
9
9
|
var RG=RGraph,ca=this.canvas,co=ca.getContext('2d'),prop=this.properties,pa2=RG.path2,win=window,doc=document,ma=Math
|
@@ -19,60 +19,65 @@ prop[name]=value;return this;};this.get=this.Get=function(name)
|
|
19
19
|
while(name.match(/([A-Z])/)){name=name.replace(/([A-Z])/,'.'+RegExp.$1.toLowerCase());}
|
20
20
|
if(name=='chart.margin'){name='chart.vmargin'}
|
21
21
|
return prop[name.toLowerCase()];};this.draw=this.Draw=function()
|
22
|
-
{RG.
|
23
|
-
this.graphArea=ca.width-this.
|
24
|
-
this.barHeight=this.graphHeight/this.numEvents;this.halfBarHeight=this.barHeight/2;RG.
|
25
|
-
if(prop['chart.
|
26
|
-
|
27
|
-
RG.
|
22
|
+
{RG.fireCustomEvent(this,'onbeforedraw');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.coordsText=[];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;}
|
23
|
+
this.graphArea=ca.width-this.marginLeft-this.marginRight;this.graphHeight=ca.height-this.marginTop-this.marginBottom;this.numEvents=this.data.length
|
24
|
+
this.barHeight=this.graphHeight/this.numEvents;this.halfBarHeight=this.barHeight/2;if(RG.isNull(prop['chart.background.grid.hlines.count'])){this.set('chart.background.grid.hlines.count',this.data.length);}
|
25
|
+
RG.Background.draw(this);this.drawLabels();this.drawEvents();if(prop['chart.contextmenu']){RG.showContext(this);}
|
26
|
+
if(prop['chart.resizable']){RG.allowResizing(this);}
|
27
|
+
RG.installEventListeners(this);if(this.firstDraw){this.firstDraw=false;RG.fireCustomEvent(this,'onfirstdraw');this.firstDrawFunc();}
|
28
|
+
RG.fireCustomEvent(this,'ondraw');return this;};this.exec=function(func)
|
28
29
|
{func(this);return this;};this.drawLabels=this.DrawLabels=function()
|
29
|
-
{var labels=prop['chart.labels']
|
30
|
-
if(prop['chart.labels.align']=='bottom'){y=ca.height-this.
|
31
|
-
for(i=0;i<labels.length;++i){RG.
|
32
|
-
for(var i=0,len=this.data.length;i<len;++i){var ev=this.data[i]
|
33
|
-
{var events=this.data;this.coords=[];if(prop['chart.vbars']){for(i=0,len=prop['chart.vbars'].length;i<len;++i){if(prop['chart.vbars'][i][0]+prop['chart.vbars'][i][1]>prop['chart.
|
34
|
-
var barX=this.
|
35
|
-
co.fillStyle=prop['chart.vbars'][i][2];co.fillRect(barX,barY,width,height);}}
|
36
|
-
if(prop['chart.hbars']){for(i=0,len=prop['chart.hbars'].length;i<len;++i){if(prop['chart.hbars'][i]){var barX=this.
|
37
|
-
co.fillStyle=prop['chart.hbars'][i];co.fillRect(barX,barY,width,height);}}}
|
38
|
-
var sequentialIndex=0;for(i=0;i<events.length;++i){if(typeof
|
30
|
+
{var labels=prop['chart.xaxis.labels'],labelsColor=prop['chart.xaxis.labels.color']||prop['chart.text.color'],labelSpace=(this.graphArea)/labels.length,x=this.marginLeft+(labelSpace/2),y=this.marginTop-(prop['chart.text.size']/2)-5,font=prop['chart.text.font'],size=prop['chart.text.size'];co.beginPath();co.fillStyle=prop['chart.text.color'];co.strokeStyle='black'
|
31
|
+
if(prop['chart.xaxis.labels.align']=='bottom'){y=ca.height-this.marginBottom+size+2;}
|
32
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.xaxis.labels'});for(i=0;i<labels.length;++i){RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x+(i*labelSpace),y:y,text:String(labels[i]),halign:'center',valign:'center',tag:'labels.horizontal'});}
|
33
|
+
for(var i=0,len=this.data.length;i<len;++i){var ev=this.data[i],x=this.marginLeft,y=this.marginTop+this.halfBarHeight+(i*this.barHeight);co.fillStyle=labelsColor||prop['chart.text.color'];var label=RG.isArray(ev)?String(ev[0].label):String(ev.label);var textConf=RG.getTextConf({object:this,prefix:'chart.yaxis.labels'});if(label){RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x-5,y:y,text:label,halign:'right',valign:'center',tag:'labels.vertical'});}}};this.drawEvents=this.DrawEvents=function()
|
34
|
+
{var events=this.data;this.coords=[];if(prop['chart.background.vbars']){for(i=0,len=prop['chart.background.vbars'].length;i<len;++i){if(prop['chart.background.vbars'][i][0]+prop['chart.background.vbars'][i][1]>prop['chart.xaxis.scale.max']){prop['chart.background.vbars'][i][1]=364-prop['chart.background.vbars'][i][0];}
|
35
|
+
var barX=this.marginLeft+(((prop['chart.background.vbars'][i][0]-prop['chart.xaxis.scale.min'])/(prop['chart.xaxis.scale.max']-prop['chart.xaxis.scale.min']))*this.graphArea),barY=this.marginTop,width=(this.graphArea/(prop['chart.xaxis.scale.max']-prop['chart.xaxis.scale.min']))*prop['chart.background.vbars'][i][1],height=ca.height-this.marginTop-this.marginBottom;if((barX+width)>(ca.width-this.marginRight)){width=ca.width-this.marginRight-barX;}
|
36
|
+
co.fillStyle=prop['chart.background.vbars'][i][2];co.fillRect(barX,barY,width,height);}}
|
37
|
+
if(prop['chart.background.hbars']){for(i=0,len=prop['chart.background.hbars'].length;i<len;++i){if(prop['chart.background.hbars'][i]){var barX=this.marginLeft,barY=((ca.height-this.marginTop-this.marginBottom)/this.data.length)*i+this.marginTop,width=this.graphArea,height=this.barHeight
|
38
|
+
co.fillStyle=prop['chart.background.hbars'][i];co.fillRect(barX,barY,width,height);}}}
|
39
|
+
var sequentialIndex=0;for(i=0;i<events.length;++i){if(typeof events[i].start==='number'){this.DrawSingleEvent(events[i],i,sequentialIndex++);}else{for(var j=0;j<events[i].length;++j){var subindex=j;this.DrawSingleEvent(events[i][j],i,sequentialIndex++,subindex);}}}};this.getShape=this.getBar=function(e)
|
39
40
|
{e=RG.fixEventObject(e);var mouseXY=RG.getMouseXY(e),mouseX=mouseXY[0],mouseY=mouseXY[1];for(var i=0,len=this.coords.length;i<len;i++){var left=this.coords[i][0],top=this.coords[i][1],width=this.coords[i][2],height=this.coords[i][3];if(mouseX>=left&&mouseX<=(left+width)&&mouseY>=top&&mouseY<=(top+height)){var tooltip=RG.parseTooltipText(prop['chart.tooltips'],i);var ret={0:this,object:this,1:left,x:left,2:top,y:top,3:width,width:width,4:height,height:height,5:i,index:this.coords[i][4].index,subindex:(this.coords[i][4]&&typeof this.coords[i][4].subindex==='number'?this.coords[i][4].subindex:null),sequentialIndex:this.coords[i][5],tooltip:tooltip};return ret;}}};this.drawSingleEvent=this.DrawSingleEvent=function(ev,index,sequentialIndex)
|
40
41
|
{ev.index=index;if(typeof arguments[3]==='number'){ev.subindex=arguments[3]}
|
41
|
-
var min=prop['chart.
|
42
|
-
this.coords.push([barStartX,barStartY+prop['chart.vmargin'],barWidth,this.barHeight-(2*prop['chart.vmargin']),ev,sequentialIndex,]);if(prop['chart.borders']||ev
|
43
|
-
|
44
|
-
|
42
|
+
var min=prop['chart.xaxis.scale.min'];co.beginPath();co.strokeStyle='black';co.fillStyle=ev.color?ev.color:prop['chart.colors.default'];var barStartX=this.marginLeft+(((ev.start-min)/(prop['chart.xaxis.scale.max']-min))*this.graphArea),barStartY=this.marginTop+(index*this.barHeight),barWidth=(ev.duration/(prop['chart.xaxis.scale.max']-min))*this.graphArea;if((barStartX+barWidth)>(ca.width-this.marginRight)){barWidth=ca.width-this.marginRight-barStartX;}
|
43
|
+
this.coords.push([barStartX,barStartY+prop['chart.vmargin'],barWidth,this.barHeight-(2*prop['chart.vmargin']),ev,sequentialIndex,]);if(prop['chart.borders']||typeof ev.border==='number'){co.strokeStyle=typeof(ev.border)==='string'?ev.border:'black';co.lineWidth=(typeof(ev.linewidth)==='number'?ev.linewidth:1);if(ev.linewidth!==0){co.strokeRect(barStartX,barStartY+prop['chart.vmargin'],barWidth,this.barHeight-(2*prop['chart.vmargin']));}}
|
44
|
+
if(RG.isNull(ev.complete)){co.fillStyle=ev.color?ev.color:prop['chart.colors.default'];}else{co.fillStyle=ev.background?ev.background:prop['chart.colors.default'];}
|
45
|
+
co.fillRect(barStartX,barStartY+prop['chart.vmargin'],barWidth,this.barHeight-(2*prop['chart.vmargin']));var complete=(ev.complete/100)*barWidth;if(typeof(ev.complete)==='number'){co.fillStyle=ev.color?ev.color:'#0c0';co.fillRect(barStartX,barStartY+prop['chart.vmargin'],(ev.complete/100)*barWidth,this.barHeight-(2*prop['chart.vmargin']));if(prop['chart.labels.complete']){co.beginPath();var textConf=RG.getTextConf({object:this,prefix:'chart.labels.complete'});RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:barStartX+barWidth+5,y:barStartY+this.halfBarHeight,text:String(ev.complete)+'%',valign:'center',tag:'labels.complete'});}}
|
46
|
+
if(prop['chart.labels.inbar']&&prop['chart.labels.inbar'][sequentialIndex]){var label=String(prop['chart.labels.inbar'][sequentialIndex]),halign=prop['chart.labels.inbar.align']=='left'?'left':'center';halign=prop['chart.labels.inbar.align']=='right'?'right':halign;if(halign=='right'){var x=(barStartX+barWidth)-5;}else if(halign=='center'){var x=barStartX+(barWidth/2);}else{var x=barStartX+5;}
|
45
47
|
if(prop['chart.labels.inbar.above']){x=barStartX+barWidth+5;halign='left';}
|
46
|
-
co.fillStyle=prop['chart.labels.inbar.color'];RG.text2(this,{
|
48
|
+
var textConf=RG.getTextConf({object:this,prefix:'chart.labels.inbar'});co.fillStyle=prop['chart.labels.inbar.color'];RG.text2(this,{font:textConf.font,size:textConf.size,color:textConf.color,bold:textConf.bold,italic:textConf.italic,x:x,y:barStartY+this.halfBarHeight,text:label,valign:'center',halign:halign,bounding:typeof(prop['chart.labels.inbar.bgcolor'])=='string',boundingFill:typeof(prop['chart.labels.inbar.bgcolor'])==='string'?prop['chart.labels.inbar.bgcolor']:null,tag:'labels.inbar'});}};this.highlight=this.Highlight=function(shape)
|
47
49
|
{if(typeof prop['chart.highlight.style']==='function'){(prop['chart.highlight.style'])(shape);}else{RG.Highlight.Rect(this,shape);}};this.getObjectByXY=function(e)
|
48
|
-
{var mouseXY=RG.getMouseXY(e);if(mouseXY[0]>this.
|
49
|
-
{if(prop['chart.adjustable']&&RG.Registry.get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){var bar=RG.Registry.get('chart.adjusting.gantt');if(bar){var mouseXY=RG.getMouseXY(e),obj=RG.Registry.get('chart.adjusting.gantt')['object'],index=bar['index'],subindex=bar['subindex'],diff=((mouseXY[0]-RG.Registry.get('chart.adjusting.gantt')['mousex'])/(ca.width-obj.
|
50
|
-
if(bar['mode']
|
51
|
-
var diff=((mouseXY[0]-RG.Registry.get('chart.adjusting.gantt')['mousex'])/(ca.width-obj.
|
50
|
+
{var mouseXY=RG.getMouseXY(e);if(mouseXY[0]>this.marginLeft&&mouseXY[0]<(ca.width-this.marginRight)&&mouseXY[1]>this.marginTop&&mouseXY[1]<(ca.height-this.marginBottom)){return this;}};this.adjusting_mousemove=this.Adjusting_mousemove=function(e)
|
51
|
+
{if(prop['chart.adjustable']&&RG.Registry.get('chart.adjusting')&&RG.Registry.Get('chart.adjusting').uid==this.uid){var bar=RG.Registry.get('chart.adjusting.gantt');if(bar){var mouseXY=RG.getMouseXY(e),obj=RG.Registry.get('chart.adjusting.gantt')['object'],index=bar['index'],subindex=bar['subindex'],diff=((mouseXY[0]-RG.Registry.get('chart.adjusting.gantt')['mousex'])/(ca.width-obj.marginLeft-obj.marginRight))*prop['chart.xaxis.scale.max'],eventStart=RG.Registry.get('chart.adjusting.gantt')['event_start'],duration=RG.Registry.get('chart.adjusting.gantt')['event_duration'],event=typeof subindex==='number'?obj.data[index][subindex]:obj.data[index]
|
52
|
+
if(bar['mode']==='move'){diff=ma.round(diff);if(RG.isNull(subindex)){event.start=eventStart+diff;if(eventStart+diff<0){obj.data[index].start=0;}else if((eventStart+diff+obj.data[index].duration)>prop['chart.xaxis.scale.max']){obj.data[index].start=prop['chart.xaxis.scale.max']-obj.data[index].duration;}}else{var index=RG.Registry.get('chart.adjusting.gantt').index,subindex=RG.Registry.get('chart.adjusting.gantt').subindex,event=this.data[index][subindex];event.start=eventStart+diff;if((eventStart+diff)<0){event.start=0;}else if((eventStart+diff+event.duration)>prop['chart.xaxis.scale.max']){event.start=prop['chart.xaxis.scale.max']-event.duration;}}}else if(bar['mode']=='resize'){if(mouseXY[0]>(ca.width-obj.marginRight)){mouseXY[0]=ca.width-obj.marginRight;}
|
53
|
+
var diff=((mouseXY[0]-RG.Registry.get('chart.adjusting.gantt')['mousex'])/(ca.width-obj.marginLeft-obj.marginRight))*prop['chart.xaxis.scale.max'];diff=ma.round(diff);if(RG.isNull(subindex)){obj.data[index].duration=duration+diff;if(obj.data[index].duration<0){obj.data[index].duration=1;}}else{obj.data[index][subindex].duration=duration+diff;if(obj.data[index][subindex].duration<0){obj.data[index][subindex].duration=1;}}}
|
52
54
|
RG.resetColorsToOriginalValues(this);RG.redrawCanvas(ca);RG.fireCustomEvent(obj,'onadjust');}}};this.getXCoord=function(value)
|
53
|
-
{var min=prop['chart.
|
54
|
-
var x=(((value-min)/(max-min))*graphArea)+this.
|
55
|
+
{var min=prop['chart.xaxis.scale.min'],max=prop['chart.xaxis.scale.max'],graphArea=ca.width-this.marginLeft-this.marginRight;if(value>max||value<min){return null;}
|
56
|
+
var x=(((value-min)/(max-min))*graphArea)+this.marginLeft;return x;};this.getValue=function(arg)
|
55
57
|
{if(arg.length==2){var mouseXY=arg;}else{var mouseXY=RGraph.getMouseXY(arg);}
|
56
|
-
var mouseX=mouseXY[0]
|
58
|
+
var mouseX=mouseXY[0],mouseY=mouseXY[1];var value=(mouseX-this.marginLeft)/(ca.width-this.marginLeft-this.marginRight);value*=(prop['chart.xaxis.scale.max']-prop['chart.xaxis.scale.min']);if(value<prop['chart.xaxis.scale.min']||value>prop['chart.xaxis.scale.max']){value=null;}
|
57
59
|
return value;};this.parseColors=function()
|
58
|
-
{if(this.original_colors.length===0){this.original_colors['data']=RG.arrayClone(this.data);this.original_colors['chart.background.
|
59
|
-
for(var i=0,sequentialIndex=0;i<this.data.length;++i){if(typeof this.data[i][0]
|
60
|
-
|
60
|
+
{if(this.original_colors.length===0){this.original_colors['data']=RG.arrayClone(this.data);this.original_colors['chart.background.bars.color1']=RG.arrayClone(prop['chart.background.bars.color1']);this.original_colors['chart.background.bars.color2']=RG.arrayClone(prop['chart.background.bars.color2']);this.original_colors['chart.background.grid.color']=RG.arrayClone(prop['chart.background.grid.color']);this.original_colors['chart.colors.default']=RG.arrayClone(prop['chart.colors.default']);this.original_colors['chart.highlight.stroke']=RG.arrayClone(prop['chart.highlight.stroke']);this.original_colors['chart.highlight.fill']=RG.arrayClone(prop['chart.highlight.fill']);}
|
61
|
+
for(var i=0,sequentialIndex=0;i<this.data.length;++i){if(RG.isArray(this.data[i])&&typeof this.data[i][0]==='object'&&typeof this.data[i][0].start==='number'){for(var j=0,len=this.data[i].length;j<len;j+=1,sequentialIndex+=1){this.data[i][j].background=this.parseSingleColorForGradient(this.data[i][j].background,{start:this.data[i][j].start,duration:this.data[i][j].duration});this.data[i][j].color=this.parseSingleColorForGradient(this.data[i][j].color,{start:this.data[i][j].start,duration:this.data[i][j].duration});}}else{if(typeof this.data[i].background==='string'){this.data[i].background=this.parseSingleColorForGradient(this.data[i].background,{start:this.data[i].start,duration:this.data[i].duration});}
|
62
|
+
if(typeof this.data[i].color==='string'){this.data[i].color=this.parseSingleColorForGradient(this.data[i].color,{start:this.data[i].start,duration:this.data[i].duration});}
|
63
|
+
++sequentialIndex;}}
|
64
|
+
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.colors.default']=this.parseSingleColorForGradient(prop['chart.colors.default']);prop['chart.highlight.stroke']=this.parseSingleColorForGradient(prop['chart.highlight.stroke']);prop['chart.highlight.fill']=this.parseSingleColorForGradient(prop['chart.highlight.fill']);};this.reset=function()
|
61
65
|
{};this.parseSingleColorForGradient=function(color)
|
62
66
|
{var opts=arguments[1]||{};if(!color||typeof(color)!='string'){return color;}
|
63
|
-
if(color.match(/^gradient\((.*)\)$/i)){
|
67
|
+
if(color.match(/^gradient\((.*)\)$/i)){if(color.match(/^gradient\(({.*})\)$/i)){return RGraph.parseJSONGradient({object:this,def:RegExp.$1});}
|
68
|
+
var parts=RegExp.$1.split(':'),value=(opts.start+opts.duration)>prop['chart.xaxis.scale.max']?prop['chart.xaxis.scale.max']:(opts.start+opts.duration);var grad=co.createLinearGradient(typeof opts.start==='number'?this.getXCoord(opts.start):this.marginLeft,0,typeof opts.start==='number'?this.getXCoord(value):ca.width-this.marginRight,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]));}}
|
64
69
|
return grad?grad:color;};this.on=function(type,func)
|
65
70
|
{if(type.substr(0,2)!=='on'){type='on'+type;}
|
66
71
|
if(typeof this[type]!=='function'){this[type]=func;}else{RG.addCustomEventListener(this,type,func);}
|
67
72
|
return this;};this.firstDrawFunc=function()
|
68
73
|
{};this.grow=function()
|
69
|
-
{var obj=this
|
70
|
-
{RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);if(frame<=numFrames){for(var i=0,len=obj.data.length;i<len;++i){if(typeof obj.data[i][0]==='object'){for(var j=0;j<obj.data[i].length;++j){obj.data[i][j]
|
74
|
+
{var obj=this,opt=arguments[0]||{},callback=arguments[1]?arguments[1]:function(){},canvas=obj.canvas,context=obj.context,numFrames=opt.frames||30,frame=0;original_events=RG.arrayClone(obj.data);function iterator()
|
75
|
+
{RG.clear(obj.canvas);RG.redrawCanvas(obj.canvas);if(frame<=numFrames){for(var i=0,len=obj.data.length;i<len;++i){if(typeof obj.data[i]==='object'&&obj.data[i][0]&&typeof obj.data[i][0]==='object'){for(var j=0;j<obj.data[i].length;++j){obj.data[i][j].duration=(frame/numFrames)*original_events[i][j].duration;}}else{obj.data[i].duration=(frame/numFrames)*original_events[i].duration;}}
|
71
76
|
obj.reset();frame++;RGraph.Effects.updateCanvas(iterator);}else{callback(obj);}}
|
72
77
|
iterator();return this;};this.resetColorsToOriginalValues=function()
|
73
|
-
{for(var i=0;i<this.original_colors['data'].length;++i){if(this.original_colors['data'][i]
|
74
|
-
if(this.original_colors['data'][i]
|
75
|
-
if(typeof this.original_colors['data'][i][0]==='object'&&typeof this.original_colors['data'][i][0]
|
76
|
-
{this.resetColorsToOriginalValues();this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.coords=[];};this.sequentialIndex2Grouped=function(){alert('[RGRAPH]
|
78
|
+
{for(var i=0;i<this.original_colors['data'].length;++i){if(this.original_colors['data'][i].background){this.data[i].background=RG.arrayClone(this.original_colors['data'][i].background);}
|
79
|
+
if(this.original_colors['data'][i].color){this.data[i].color=RG.arrayClone(this.original_colors['data'][i].color);}
|
80
|
+
if(typeof this.original_colors['data'][i][0]==='object'&&typeof this.original_colors['data'][i][0].start==='number'){for(var j=0,len2=this.original_colors['data'][i].length;j<len2;++j){this.data[i][j].background=RG.arrayClone(this.original_colors['data'][i][j].background);this.data[i][j].color=RG.arrayClone(this.original_colors['data'][i][j].color);}}}};this.reset=function()
|
81
|
+
{this.resetColorsToOriginalValues();this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.coords=[];};this.sequentialIndex2Grouped=function(){alert('[RGRAPH] Something went badly wrong - contact support');};this.isAdjustable=function(shape)
|
77
82
|
{if(RG.isNull(prop['chart.adjustable.only'])){return true;}else if(RG.isArray(prop['chart.adjustable.only'])&&prop['chart.adjustable.only'][shape.sequentialIndex]){return true;}
|
78
83
|
return false;};RG.Register(this);if(parseConfObjectForOptions){RG.parseObjectStyleConfig(this,conf.options);}};
|