/*!********************************************************************* * ELYCHARTS v2.1.5-SNAPSHOT $Id: elycharts.min.js 95 2014-02-06 22:01:29Z stefano.bagnara@gmail.com $ * A Javascript library to generate interactive charts with vectorial graphics. * * Copyright (c) 2010-2014 Void Labs s.n.c. (http://void.it) * Licensed under the MIT (http://creativecommons.org/licenses/MIT/) license. **********************************************************************/ (function(a){if(!a.elycharts){a.elycharts={}}a.elycharts.templates={common:{margins:[10,10,10,10],interactive:true,defaultSeries:{visible:true,tooltip:{active:true,width:100,height:50,roundedCorners:5,padding:[6,6],offset:[20,0],frameProps:{fill:"white","stroke-width":2},contentStyle:{"font-family":"Arial","font-size":"12px","line-height":"16px",color:"black"}},highlight:{scaleSpeed:100,scaleEasing:"",moveSpeed:100,moveEasing:"",restoreSpeed:0,restoreEasing:""},anchor:{},startAnimation:{type:"simple",speed:600,delay:0,propsFrom:{},propsTo:{},easing:""},label:{active:false,html:false,props:{fill:"black",stroke:"none","font-family":"Arial","font-size":"16px"},style:{cursor:"default"}}},series:{empty:{label:{active:false},tooltip:{active:false}}},features:{tooltip:{fadeDelay:100,moveDelay:300},mousearea:{type:"single",indexCenter:"auto",areaMoveDelay:500,syncTag:false,onMouseEnter:false,onMouseExit:false,onMouseChanged:false,onMouseOver:false,onMouseOut:false},highlight:{indexHighlightProps:{opacity:1}},animation:{startAnimation:{speed:600,delay:0,easing:""},stepAnimation:{speed:600,delay:0,easing:""}},frameAnimation:{active:false,cssFrom:{opacity:0},cssTo:{opacity:1},speed:"slow",easing:"linear"},pixelWorkAround:{active:Raphael.svg},label:{},shadows:{active:false,offset:[2,2],props:{"stroke-width":0,"stroke-opacity":0,fill:"black","fill-opacity":0.3}},balloons:{active:false,style:{},padding:[5,5],left:10,line:[[0,0],[0,0]],lineProps:{}},legend:{horizontal:false,x:"auto",y:10,width:"auto",height:20,itemWidth:"fixed",margins:[0,0,0,0],dotMargins:[10,5],borderProps:{fill:"white",stroke:"black","stroke-width":1},dotType:"rect",dotWidth:10,dotHeight:10,dotR:4,dotProps:{type:"rect",width:10,height:10},textProps:{font:"12px Arial",fill:"#000"}},debug:{active:false}},enableInternalCaching:true,nop:0},line:{template:"common",barMargins:0,barOverlapPerc:0,avgOverNulls:true,defaultAxis:{normalize:2,min:0,labels:false,labelsDistance:8,labelsRotate:0,labelsProps:{font:"10px Arial",fill:"#000"},titleDistance:25,titleDistanceIE:0.75,titleProps:{font:"12px Arial",fill:"#000","font-weight":"bold"}},axis:{x:{titleDistanceIE:1.2}},defaultSeries:{type:"line",axis:"l",cumulative:false,rounded:1,lineCenter:"auto",plotProps:{"stroke-width":1,"stroke-linejoin":"round"},barWidthPerc:100,fill:false,fillProps:{stroke:"none","stroke-width":0,"stroke-opacity":0,opacity:0.3},dot:false,dotProps:{size:4,stroke:"#000",zindex:5},dotShowOnNull:false,mouseareaShowOnNull:false,startAnimation:{plotPropsFrom:false,fillPropsFrom:false,dotPropsFrom:false,shadowPropsFrom:false}},features:{grid:{nx:"auto",ny:4,draw:false,forceBorder:false,props:{stroke:"#e0e0e0","stroke-width":1},extra:[0,0,0,0],labelsCenter:"auto",evenVProps:false,oddVProps:false,evenHProps:false,oddHProps:false,ticks:{active:[false,false,false],size:[10,10],props:{stroke:"#e0e0e0","stroke-width":1}}}},nop:0},pie:{template:"common",startAngle:0,clockwise:false,valueThresold:0.006,margins:[0,0,0,0],defaultSeries:{}},funnel:{template:"common",rh:0,method:"width",topSector:0,topSectorProps:{fill:"#d0d0d0"},bottomSector:0.1,bottomSectorProps:{fill:"#d0d0d0"},edgeProps:{fill:"#c0c0c0","stroke-width":1,opacity:1},nop:0},barline:{template:"common",direction:"ltr"}}})(jQuery);(function(c){if(!c.elycharts){c.elycharts={}}c.elycharts.lastId=0;c.fn.chart=function(j){if(!this.length){return this}var n=this.data("elycharts_env");if(typeof j=="string"){if(j.toLowerCase()=="config"){return n?n.opt:false}if(j.toLowerCase()=="clear"){if(n){if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.clear(n)}n.paper.clear();n.cache=false;if(n.autoresize){c(window).unbind("resize",n.autoresize)}this.html("");this.data("elycharts_env",false)}}return this}if(!n){if(j){j=d(j)}if(!j||!j.type||!c.elycharts.templates[j.type]){alert("ElyCharts ERROR: chart type is not specified");return false}n=i(this,j);this.data("elycharts_env",n)}else{if(!j){j={}}j=b(j,n.opt);n.oldopt=f._clone(n.opt);n.opt=c.extend(true,n.opt,j);n.newopt=j;n.oldwidth=n.width;n.oldheight=n.height}n.cache=j.enableInternalCaching?{}:false;e(n,j);if(n.opt.autoresize){if(!n.autoresize){var m=this;n.autoresize=h(function(){m.chart()});c(window).bind("resize",n.autoresize)}}else{if(n.autoresize){c(window).unbind("resize",n.autoresize);n.autoresize=false}}var l=c.elycharts[n.opt.type].draw(n);if(n.pieces){l=g(n,n.pieces,l)}f._show(n,l);n.pieces=l;return this};function g(t,m,l,u,r,q){var o=[],s;var n=0;for(var p=0;p=l.length||!f.samePiecePath(m[p],l[n]))){if(!q){m[p].show=false;o.push(m[p])}else{s={path:false,attr:false};s.show=true;s.animation={element:m[p].element?m[p].element:false,speed:0,easing:"",delay:0};o.push(s)}}else{s=l?l[n]:{path:false,attr:false};s.show=true;if(typeof m[p].paths=="undefined"){s.animation={element:m[p].element?m[p].element:false,speed:0,easing:"",delay:0}}else{s.paths=g(t,m[p].paths,l[n].paths,m[p].section,m[p].serie,true)}o.push(s);n++}}if(l){for(;n180;a1=(a1%360)*Math.PI/180;a2=(a2%360)*Math.PI/180;if(a1==a2&&u!=t){a2+=359.99*Math.PI/180}return{path:q?[["M",o+s*Math.cos(a1),v+s*Math.sin(a1)],["A",s,s,0,+p,1,o+s*Math.cos(a2),v+s*Math.sin(a2)],["L",o+q*Math.cos(a2),v+q*Math.sin(a2)],["A",q,q,0,+p,0,o+q*Math.cos(a1),v+q*Math.sin(a1)],["z"]]:[["M",o,v],["l",s*Math.cos(a1),s*Math.sin(a1)],["A",s,s,0,+p,1,o+s*Math.cos(a2),v+s*Math.sin(a2)],["z"]]}};return m},_clone:function(m){if(m==null||typeof(m)!="object"){return m}if(m.constructor==Array){return[].concat(m)}var j=new m.constructor();for(var l in m){j[l]=this._clone(m[l])}return j},compactUnits:function(n,l){for(var m=l.length-1;m>=0;m--){var j=n/Math.pow(1000,m+1);if(j>=1&&j*10%10==0){return j+l[m]}}return n},getElementOriginalAttrs:function(l){var j=c(l.node).data("original-attr");if(!j){j=l.attr();c(l.node).data("original-attr",j)}return j},findInPieces:function(n,p,m,j,o){for(var l=0;l=0&&q.values&&q.values[n]){q=c.extend(true,q,q.values[n])}if(m.cache){if(!m.cache.areaPropsCache){m.cache.areaPropsCache={}}m.cache.areaPropsCache[o]=q}}}}else{var p=j.toLowerCase();q=this._clone(m.opt[p]);if(typeof l=="undefined"||!l){if(s&&s[p]){q=c.extend(true,q,s[p])}}else{if(m.opt["default"+r]&&m.opt["default"+r][p]){q=c.extend(true,q,m.opt["default"+r][p])}if(s&&s[l]&&s[l][p]){q=c.extend(true,q,s[l][p])}if((typeof n!="undefined")&&n>0&&q.values&&q.values[n]){q=c.extend(true,q,q.values[n])}}}return q},_absrectpath:function(l,o,j,n,p){if(p){var m=[["M",l,o+p],["a",p,p,0,0,1,p,-p],["L",j-p,o],["a",p,p,0,0,1,p,p],["L",j,n-p],["a",p,p,0,0,1,-p,p],["L",l+p,n],["a",p,p,0,0,1,-p,-p],["z"]];return m}else{return[["M",l,o],["L",l,n],["L",j,n],["L",j,o],["z"]]}},_linepathAnchors:function(m,l,x,v,s,r,o){var j=1;if(o&&o.length){j=o[1];o=o[0]}if(!o){o=1}var p=(x-m)/2,n=(s-x)/2,y=Math.atan(Math.abs(x-m)/Math.abs(v-l)),w=Math.atan(Math.abs(s-x)/Math.abs(v-r));y=(lm)||(l>v&&xx)||(r>v&&s0){y=0;w=0}else{if(Math.abs(y-Math.PI/2)0&&j>m.width-m.opt.margins[1]?m.width-m.opt.margins[1]:(l<0&&j0&&n>l.height-l.opt.margins[2]?l.height-l.opt.margins[2]:(j<0&&n0)){m[l]=o}else{if(!j){return false}}return m},showPath:function(n,o,p){if(!p){p=n.paper}if(o.length==1&&o[0][0]=="CIRCLE"){o=this._preparePathShow(n,o);return p.circle(o[0][1],o[0][2],o[0][3])}if(o.length==1&&o[0][0]=="TEXT"){o=this._preparePathShow(n,o);return p.text(o[0][2],o[0][3],o[0][1])}var m=this.getSVGProps(n,o);var l=false;for(var j in m){l=true;break}return m&&l?p.path().attr(m):false},_preparePathShow:function(j,l){return j.opt.features.pixelWorkAround.active?this.movePath(j,this._clone(l),[0.5,0.5],false,true):l},getPieceFullAttr:function(l,j){if(!j.fullattr){j.fullattr=this._clone(j.attr);if(j.path){switch(j.path[0][0]){case"CIRCLE":var m=this._preparePathShow(l,j.path);j.fullattr.cx=m[0][1];j.fullattr.cy=m[0][2];j.fullattr.r=m[0][3];break;case"TEXT":case"DOMELEMENT":case"RELEMENT":break;default:j.fullattr=this.getSVGProps(l,j.path,j.fullattr)}}if(typeof j.fullattr.opacity=="undefined"){j.fullattr.opacity=1}}return j.fullattr},_show:function(o,m){if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.beforeShow(o,m)}pieces=this._getSortedPathData(m);this._animationStackStart(o);var j=false;for(var l=0;lq?1:(p.posj.pos?1:0)))})},_animationStackStart:function(j){if(!j.animationStackDepth||j.animationStackDepth==0){j.animationStackDepth=0;j.animationStack={}}j.animationStackDepth++},_animationStackEnd:function(l){l.animationStackDepth--;if(l.animationStackDepth==0){for(var j in l.animationStack){this._animationStackAnimate(l.animationStack[j],j);delete l.animationStack[j]}l.animationStack={}}},animationStackPush:function(o,n,m,j,q,r,l,p){if(typeof l=="undefined"){l=0}if(!o.animationStackDepth||o.animationStackDepth==0){this._animationStackAnimate([{piece:n,object:m,props:j,speed:q,easing:r,force:p}],l)}else{if(!o.animationStack[l]){o.animationStack[l]=[]}o.animationStack[l].push({piece:n,object:m,props:j,speed:q,easing:r,force:p})}},_animationStackAnimate:function(j,m){var l=this;var n=function(){var p=j.pop();var q=l._animationStackAnimateElement(p);while(j.length>0){var o=j.pop();l._animationStackAnimateElement(o,p,q)}};if(m>0){setTimeout(n,m)}else{n()}},_animationStackAnimateElement:function(j,o,n){if(j.force||!j.piece.animationInProgress){j.object.stop();if(!j.props){j.props={opacity:0}}if(!j.speed||j.speed<=0){j.object.attr(j.props);j.piece.animationInProgress=false;return}j.piece.animationInProgress=true;var l=function(){j.piece.animationInProgress=false};if(Raphael.animation){var m=Raphael.animation(j.props,j.speed,j.easing?j.easing:"linear",l);if(o){j.object.animateWith(o,n,m)}else{j.object.animate(m)}return m}else{if(o){j.object.animateWith(o,j.props,j.speed,j.easing?j.easing:"linear",l)}else{j.object.animate(j.props,j.speed,j.easing?j.easing:"linear",l)}return null}}return null}};var f=c.elycharts.common;c.elycharts.featuresmanager={managers:[],initialized:false,register:function(l,j){c.elycharts.featuresmanager.managers.push([j,l]);c.elycharts.featuresmanager.initialized=false},init:function(){c.elycharts.featuresmanager.managers.sort(function(l,j){return l[0]=0;j--){if(c.elycharts.featuresmanager.managers[j][1].clear){c.elycharts.featuresmanager.managers[j][1].clear(l)}}},beforeShow:function(l,m){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=0;j0){var g=e.onAnchors.pop();b(g[0]).removeClass(g[1])}}};b.elycharts.featuresmanager.register(b.elycharts.anchormanager,30)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.animationmanager={beforeShow:function(c,d){if(!c.newopt){this.startAnimation(c,d)}else{this.stepAnimation(c,d)}},stepAnimation:function(c,d){d=this._stepAnimationInt(c,d)},_stepAnimationInt:function(e,h,j,g,c){for(var d=0;d1){for(e=0;!g.paths[e].path&&e=0;e--){}d=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=0;e1){for(e=0;!g.paths[e].path&&e=0;e--){}d=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=0;e0){var e=d.highlighted.pop();if(e.piece){if(c){a.animationStackPush(d,e.piece,e.piece.element,a.getPieceFullAttr(d,e.piece),e.cfg.restoreSpeed,e.cfg.restoreEasing,0,true)}}else{e.element.remove()}}}},afterShow:function(c,d){if(c.highlighted&&c.highlighted.length>0){this.removeHighlighted(c,false)}c.highlighted=[]},onMouseOver:function(D,u,j,H){var s,c;for(var B=0;B90){E=90}s=[["SLICE",s[0][1],s[0][2],s[0][3]*J[0],s[0][4],s[0][5]-E,s[0][6]+E]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(D.opt.type=="funnel"){var p=(e.rect[2]-e.rect[0])*(J[0]-1)/2;var n=(e.rect[3]-e.rect[1])*(J[1]-1)/2;s=[a.movePath(D,[s[0]],[-p,-n])[0],a.movePath(D,[s[1]],[+p,-n])[0],a.movePath(D,[s[2]],[+p,+n])[0],a.movePath(D,[s[3]],[-p,+n])[0],s[4]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);r=false;if(j>0){G=H.pieces[B].paths[j-1];r=G.element;y=G.path}else{G=a.findInPieces(H.pieces,"Sector","top");if(G){r=G.element;y=G.path}}if(r){y=[y[0],y[1],a.movePath(D,[y[2]],[+p,-n])[0],a.movePath(D,[y[3]],[-p,-n])[0],y[4]];a.animationStackPush(D,G,r,a.getSVGProps(D,y),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);D.highlighted.push({piece:G,cfg:f.highlight})}r=false;if(j0?D.opt.labels.length:1);var z=(D.width-D.opt.margins[3]-D.opt.margins[1])/(D.opt.labels.length>1?D.opt.labels.length-1:1);var m=true;switch(q){case"bar":s=[["RECT",D.opt.margins[3]+j*A,D.opt.margins[0],D.opt.margins[3]+(j+1)*A,D.height-D.opt.margins[2]]];break;case"line":m=false;case"barline":var l=Math.round((m?A/2:0)+D.opt.margins[3]+j*(m?A:z));s=[["M",l,D.opt.margins[0]],["L",l,D.height-D.opt.margins[2]]]}if(s){c=a.showPath(D,s).attr(D.opt.features.highlight.indexHighlightProps);D.highlighted.push({element:c,attr:false,cfg:D.opt.features.highlight})}}},onMouseOut:function(e,f,d,c){this.removeHighlighted(e,true)}};b.elycharts.featuresmanager.register(b.elycharts.highlightmanager,21)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.labelmanager={beforeShow:function(f,g){if(!a.executeIfChanged(f,["labels","values","series"])){return}if(f.opt.labels&&(f.opt.type=="pie"||f.opt.type=="funnel")){var j=false;var h;for(var d=0;d"+s+"").css(g).prependTo(o.container)}else{i=b(s).css(g).prependTo(o.container)}if(o.opt.features.debug.active&&i.height()==0){alert("DEBUG: Al gestore label e' stata passata una label ancora senza dimensioni, quindi ancora non disegnata. Per questo motivo il posizionamento potrebbe non essere correto.")}var e=d[0];var c=d[1];if(!j.label.frameAnchor||j.label.frameAnchor[0]=="middle"){e-=i.width()/2}else{if(j.label.frameAnchor&&j.label.frameAnchor[0]=="end"){e-=i.width()}}if(!j.label.frameAnchor||j.label.frameAnchor[1]=="middle"){c-=i.height()/2}else{if(j.label.frameAnchor&&j.label.frameAnchor[1]=="top"){c-=i.height()}}if(f){i.css({margin:c+"px 0 0 "+e+"px",opacity:n})}else{i.css({margin:c+"px 0 0 "+e+"px"})}return{path:[["DOMELEMENT",i]],attr:false}}}return false}};b.elycharts.featuresmanager.register(b.elycharts.labelmanager,5)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.legendmanager={afterShow:function(L,l){if(L.legenditems){for(item in L.legenditems){L.legenditems[item].remove()}L.legenditems=false}if(!L.opt.legend||L.opt.legend.length==0){return}var d=L.opt.features.legend;if(d===false){return}var e=d.x;if(e=="auto"){var D=1;e=0}var c=d.width;if(c=="auto"){var o=1;c=L.width}var H=0;var A=[];var f=0;var B,M,K,r,q,p,G;for(B in L.opt.legend){if(L.opt.type!="pie"){f++}else{f+=L.opt.legend[B].length}}var J=0;for(B in L.opt.legend){if(L.opt.type!="pie"){M=[L.opt.legend[B]]}else{M=L.opt.legend[B]}for(var I=0;I(r-G)&&u.getBBox().width>10){v=v.substring(0,v.length-1);u.attr({text:v})}u.show();if(d.horizontal&&d.itemWidth=="auto"){H+=G+u.getBBox().width+4}else{if(!d.horizontal&&o){H=u.getBBox().width+G>H?u.getBBox().width+G:H}else{H+=r}}J++}}if(o){c=H+d.margins[3]+d.margins[1]-1}if(D){e=Math.floor((L.width-c)/2);for(J in A){if(A[J].attrs.x){A[J].attr("x",A[J].attrs.x+e)}else{A[J].attr("path",a.movePath(L,A[J].attrs.path,[e,0]))}}}var s=[["RECT",e,d.y,e+c,d.y+d.height,d.r]];var E=a.showPath(L,s).attr(d.borderProps);for(J in A){A[J].toFront()}A.unshift(E);L.legenditems=A}};b.elycharts.featuresmanager.register(b.elycharts.legendmanager,90)})(jQuery);(function(c){var a=c.elycharts.featuresmanager;var b=c.elycharts.common;c.elycharts.mousemanager={clear:function(d){if(d.mouseLayer){d.mouseLayer.remove();d.mouseLayer=null;d.mousePaper.clear();d.mousePaper.remove();d.mousePaper=null;d.mouseTimer=null;d.mouseAreas=null}},afterShow:function(n,g){if(!n.opt.interactive){return}this.clear(n);n.mouseLayer=c("
").css({position:"absolute","z-index":20,opacity:1}).prependTo(n.container);n.mousePaper=b._RaphaelInstance(n.mouseLayer.get(0),n.width,n.height);var f=n.mousePaper;if(n.opt.features.debug.active&&typeof DP_Debug!="undefined"){n.paper.text(n.width,n.height-5,"DEBUG").attr({"text-anchor":"end",stroke:"red",opacity:0.1});f.text(n.width,n.height-5,"DEBUG").attr({"text-anchor":"end",stroke:"red",opacity:0.1}).click(function(){DP_Debug.dump(n.opt,"",false,4)})}var l,h;n.mouseAreas=[];if(n.opt.features.mousearea.type=="single"){for(l=0;l=1&&(g[l].path[0][0]=="LINE"||g[l].path[0][0]=="LINEAREA")){for(h=0;h0?n.opt.labels.length:1);e=n.opt.margins[3]}else{r=(n.width-n.opt.margins[3]-n.opt.margins[1])/(n.opt.labels.length>1?n.opt.labels.length-1:1);e=n.opt.margins[3]-r/2}for(var q in n.opt.labels){var m=parseInt(q);n.mouseAreas.push({path:[["RECT",e+m*r,n.height-n.opt.margins[2],e+(m+1)*r,n.opt.margins[0]]],piece:false,pieces:g,index:parseInt(m),props:n.opt.defaultSeries})}}var p=false;if(!n.opt.features.mousearea.syncTag){n.mouseareaenv={chartEnv:false,mouseObj:false,caller:false,inArea:-1,timer:false};p=n.mouseareaenv}else{if(!c.elycharts.mouseareaenv){c.elycharts.mouseareaenv={}}if(!c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]){c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]={chartEnv:false,mouseObj:false,caller:false,inArea:-1,timer:false}}p=c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]}for(l=0;l