1 line
52 KiB
JavaScript
1 line
52 KiB
JavaScript
|
(function(){var aE=jQuery,U=document,v=aE.telerik,a7=v.Class,I=v.Component,aF=v.DataSource,ae=v.template,O=function(){return v.formatString.apply(v,arguments)},aJ=aE.proxy;var at="above",S=1,a4="bar",ag=0.7,ax=1.5,h=0.4,a0="below",aN="#000",a="bottom",aZ="center",aj="change",aV="circle",R="column",a1=3,aa="dataBound",K=400,aP=6,ac=600,s="glass",a9="height",r="horizontal",aq="left",u="line",aL=6,d="square",x="none",ao="object",au="outside",l="right",ar="12px Verdana, sans-serif",bc="16px Verdana, sans-serif",aC="square",ad="http://www.w3.org/2000/svg",ap="top",F="triangle",V="undefined",aB="vertical",q="width",Z="#fff",ah="x",ai="y",aH=0.2;var a6=I.extend({init:function(be,bf){var Y=this,X=bf?bf.theme:"";I.fn.init.call(Y,be);Y.options=a2(Y.options,X?a6.Themes[X]||a6.Themes[X.toLowerCase()]:{},bf);Y.bind([aa],Y.options);if(Y.options.dataSource){Y._initDataSource()}Y.refresh()},options:{chartArea:{},title:{visible:true},legend:{visible:true},valueAxis:{type:"Numeric"},categoryAxis:{categories:[]},seriesColors:["#d7df23","#adc32b","#799b28","#4c7520"],seriesDefaults:{type:R,data:[],bar:{gap:ax,spacing:h},column:{gap:ax,spacing:h}},series:[]},types:{},refresh:function(){var X=this;X._applyDefaults();if(X.options.dataSource){X.dataSource.read()}else{X._redraw()}},_redraw:function(){var Y=this,be=Y.options,bf=new a8(be.chartArea);if(be.title&&be.title.visible&&be.title.text){bf.children.push(new an(be.title))}if(be.legend.visible){var X=a2({},be.legend,{series:be.series});bf.children.push(new c(X))}bf.children.push(new m(Y.options));Y._model=bf;bf.reflow();bf.getView().renderTo(Y.element[0])},_applyDefaults:function(){var bi=this,Y=bi.element,be=bi.options,bg=be.series,bj,bm=be.seriesColors,bf=be.chartArea,X=be.seriesDefaults,bk=a2({},be.seriesDefaults);delete bk.bar;delete bk.column;delete bk.line;for(var bh=0,bl=bg.length;bh<bl;bh++){bj=bg[bh].type||be.seriesDefaults.type;bg[bh]=a2({color:bm[bh%bm.length]},bk,be.seriesDefaults[bj],bg[bh])}be.categoryAxis=a2({},be.axisDefaults,be.categoryAxis);if(!bf.width){bf.width=Y.width()||ac}if(!bf.height){bf.height=Y.height()||K}},_initDataSource:function(){var X=this;X.dataSource=aF.create(X.options.dataSource).bind(aj,aJ(X._onDataChanged,X))},_onDataChanged:function(){var be=this,bk=be.options,bh=bk.series,bi=bk.categoryAxis,bj=be.dataSource.view();for(var bo=0,bl=bj.length;bo<bl;bo++){var Y=bj[bo];if(bi.field){var bg=Y[bi.field];if(bo===0){bi.categories=[bg]}else{bi.categories.push(bg)}}for(var bn=0,bf=bh.length;bn<bf;bn++){var bm=bh[bn],X=Y[bm.field];if(bm.field){if(bo===0){bm.data=[X]}else{bm.data.push(X)}}}}be.trigger(aa);be._redraw()}});a6.Themes={};var aW=a7.extend({init:function(be,bf,bg,X){var Y=this;Y.x1=be||0;Y.x2=bg||0;Y.y1=bf||0;Y.y2=X||0},width:function(){return this.x2-this.x1},height:function(){return this.y2-this.y1},translate:function(Y,X){var be=this;be.x1+=Y;be.x2+=Y;be.y1+=X;be.y2+=X;return be},move:function(bf,bg){var X=this,Y=X.height(),be=X.width();X.x1=bf;X.y1=bg;X.x2=X.x1+be;X.y2=X.y1+Y;return X},wrap:function(Y){var X=this;X.x1=Math.min(X.x1,Y.x1);X.y1=Math.min(X.y1,Y.y1);X.x2=Math.max(X.x2,Y.x2);X.y2=Math.max(X.y2,Y.y2);return this},snapTo:function(X,Y){var be=this;if(Y==ah||!Y){be.x1=X.x1;be.x2=X.x2}if(Y==ai||!Y){be.y1=X.y1;be.y2=X.y2}return this},alignTo:function(bf,bh){var X=this,Y=X.height(),be=X.width(),bi=bh==ap||bh==a?ai:ah,bg=bi==ai?Y:be;if(bh==ap||bh==aq){X[bi+1]=bf[bi+1]-bg}else{X[bi+1]=bf[bi+2]}X.x2=X.x1+be;X.y2=X.y1+Y;return X},shrink:function(X,Y){var be=this;be.x2-=X;be.y2-=Y;return be},expand:function(X,Y){this.shrink(-X,-Y);return this},pad:function(X){var be=this,Y=z(X);be.x1-=Y.left;be.x2+=Y.right;be.y1-=Y.top;be.y2+=Y.bottom;return be},unpad:function(X){var be=this,Y=z(X);Y.left=-Y.left;Y.top=-Y.top;Y.right=-Y.right;Y.bottom=-Y.bottom;return be.pad(Y)},clone:function(){var X=this;return new aW(X.x1,X.y1,X.x2,X.y2)},center:function(){var X=this;return[X.x1+X.width()/2,X.y1+X.height()/2]}});var o=new aW(0,0,0,0);var J=a7.extend({init:function(Y){var X=this;X.attributes={};X.children=[];X.options=a2({},X.options,Y)},reflow:function(bh){var Y=
|