1 |
- define("echarts/chart/eventRiver","require ./base ../layout/eventRiver zrender/shape/Polygon ../component/axis ../component/grid ../component/dataZoom ../config ../util/ecData ../util/date zrender/tool/util zrender/tool/color ../chart".split(" "),function(f){function l(a,c,e,n,g){p.call(this,a,c,e,n,g);var k=this;k._ondragend=function(){k.isDragend=!0};this.refresh(n)}var p=f("./base"),u=f("../layout/eventRiver"),b=f("zrender/shape/Polygon");f("../component/axis");f("../component/grid");f("../component/dataZoom");var t=f("../config");t.eventRiver={zlevel:0,z:2,clickable:!0,legendHoverLink:!0,itemStyle:{normal:{borderColor:"rgba(0,0,0,0)",borderWidth:1,label:{show:!0,position:"inside",formatter:"{b}"}},emphasis:{borderColor:"rgba(0,0,0,0)",borderWidth:1,label:{show:!0}}}};var h=f("../util/ecData"),m=f("../util/date"),r=f("zrender/tool/util"),a=f("zrender/tool/color");return l.prototype={type:t.CHART_TYPE_EVENTRIVER,_buildShape:function(){var a=this.series;this.selectedMap={};this._dataPreprocessing();for(var c=this.component.legend,e=[],n=0;n<a.length;n++)if(a[n].type===this.type){a[n]=this.reformOption(a[n]);this.legendHoverLink=a[n].legendHoverLink||this.legendHoverLink;var g=a[n].name||"";if(this.selectedMap[g]=c?c.isSelected(g):!0,this.selectedMap[g])this.buildMark(n),e.push(this.series[n])}u(e,this._intervalX,this.component.grid.getArea());this._drawEventRiver();this.addShapeList()},_dataPreprocessing:function(){for(var a,c,e=this.series,n=0,g=e.length;g>n;n++)if(e[n].type===this.type){a=this.component.xAxis.getAxis(e[n].xAxisIndex||0);for(var k=0,b=e[n].eventList.length;b>k;k++){c=e[n].eventList[k].evolution;for(var q=0,h=c.length;h>q;q++)c[q].timeScale=a.getCoord(m.getNewDate(c[q].time)-0),c[q].valueScale=Math.pow(c[q].value,.8)}}this._intervalX=Math.round(this.component.grid.getWidth()/40)},_drawEventRiver:function(){for(var a=this.series,c=0;c<a.length;c++){var e=a[c].name||"";if(a[c].type===this.type&&this.selectedMap[e])for(e=0;e<a[c].eventList.length;e++)this._drawEventBubble(a[c].eventList[e],c,e)}},_drawEventBubble:function(d,c,e){var n=this.series,g=n[c],k=g.name||"",y=g.eventList[e],q=[y,g],r=this.component.legend,m=r?r.getColor(k):this.zr.getColor(c),k=this.deepMerge(q,"itemStyle.normal")||{},r=this.deepMerge(q,"itemStyle.emphasis")||{},m=this.getItemStyleColor(k.color,c,e,y)||m,f=this.getItemStyleColor(r.color,c,e,y)||("string"==typeof m?a.lift(m,-.2):m),t=this._calculateControlPoints(d),q={zlevel:this.getZlevelBase(),z:this.getZBase(),clickable:this.deepQuery(q,"clickable"),style:{pointList:t,smooth:"spline",brushType:"both",lineJoin:"round",color:m,lineWidth:k.borderWidth,strokeColor:k.borderColor},highlightStyle:{color:f,lineWidth:r.borderWidth,strokeColor:r.borderColor},draggable:"vertical",ondragend:this._ondragend},q=new b(q);this.addLabel(q,g,y,d.name);h.pack(q,n[c],c,n[c].eventList[e],e,n[c].eventList[e].name);this.shapeList.push(q)},_calculateControlPoints:function(a){var c=this._intervalX,e=a.y,n=a.evolution;a=n.length;if(!(1>a)){for(var g=[],k=[],b=0;a>b;b++)g.push(n[b].timeScale),k.push(n[b].valueScale);n=[];n.push([g[0],e]);for(b=0;a-1>b;b++)n.push([(g[b]+g[b+1])/2,k[b]/-2+e]);n.push([(g[b]+(g[b]+c))/2,k[b]/-2+e]);n.push([g[b]+c,e]);n.push([(g[b]+(g[b]+c))/2,k[b]/2+e]);for(b=a-1;0<b;b--)n.push([(g[b]+g[b-1])/2,k[b-1]/2+e]);return n}},ondragend:function(a,c){this.isDragend&&a.target&&(c.dragOut=!0,c.dragIn=!0,c.needRefresh=!1,this.isDragend=!1)},refresh:function(a){a&&(this.option=a,this.series=a.series);this.backupShapeList();this._buildShape()}},r.inherits(l,p),f("../chart").define("eventRiver",l),l});define("echarts/layout/eventRiver",["require"],function(){function f(b,f,h,m){var r=f.y;f=(f.height-m)/h;for(h=0;h<b.length;h++){b[h].y=b[h].y*f+r;m=b[h].eventList;for(var a=0;a<m.length;a++){m[a].y=m[a].y*f+r;for(var d=m[a].evolution,c=0;c<d.length;c++)d[c].valueScale=1*d[c].valueScale*f}}}function l(b,f){var h={left:b,right:f,leftChild:null,rightChild:null,maxValue:0};if(f>b+1){var m=Math.round((b+f)/2);h.leftChild=l(b,m);h.rightChild=l(m,f)}return h}function p(b,f,h){if(1>h-f)return 0;var m=Math.round((b.left+b.right)/2);if(f==b.left&&h==b.right)b=b.maxValue;else if(m>=h&&null!=b.leftChild)b=p(b.leftChild,f,h);else if(f>=m&&null!=b.rightChild)b=p(b.rightChild,f,h);else{var r=0,a=0;null!=b.leftChild&&(r=p(b.leftChild,f,m));null!=b.rightChild&&(a=p(b.rightChild,m,h));b=r>a?r:a}return b}function u(b,f,h,m){if(null!=b){var r=Math.round((b.left+b.right)/2);b.maxValue=b.maxValue>m?b.maxValue:m;(Math.floor(10*f)!=Math.floor(10*b.left)||Math.floor(10*h)!=Math.floor(10*b.right))&&(r>=h?u(b.leftChild,f,h,m):f>=r?u(b.rightChild,f,h,m):(u(b.leftChild,f,r,m),u(b.rightChild,r,h,m)))}}return function(b,t,h){function m(a,c){var d=a.importance,e=c.importance;return d>e?-1:e>d?1:0}function r(a,c){if(a.indexOf)return a.indexOf(c);for(var d=0,e=a.length;e>d;d++)if(a[d]===c)return d;return-1}for(var a=0;a<b.length;a++){for(var d=0;d<b[a].eventList.length;d++){null==b[a].eventList[d].weight&&(b[a].eventList[d].weight=1);for(var c=0,e=0;e<b[a].eventList[d].evolution.length;e++)c+=b[a].eventList[d].evolution[e].valueScale;b[a].eventList[d].importance=c*b[a].eventList[d].weight}b[a].eventList.sort(m)}for(a=0;a<b.length;a++){null==b[a].weight&&(b[a].weight=1);for(d=c=0;d<b[a].eventList.length;d++)c+=b[a].eventList[d].weight;b[a].importance=c*b[a].weight}b.sort(m);for(var c=Number.MAX_VALUE,n=0,a=0;a<b.length;a++)for(d=0;d<b[a].eventList.length;d++)for(e=0;e<b[a].eventList[d].evolution.length;e++)var g=b[a].eventList[d].evolution[e].timeScale,c=Math.min(c,g),n=Math.max(n,g);c=l(Math.floor(c),Math.ceil(n));for(a=n=0;a<b.length;a++)for(d=0;d<b[a].eventList.length;d++){g=b[a].eventList[d];g.time=[];g.value=[];for(e=0;e<b[a].eventList[d].evolution.length;e++)g.time.push(b[a].eventList[d].evolution[e].timeScale),g.value.push(b[a].eventList[d].evolution[e].valueScale);var k=r(g.value,Math.max.apply(Math,g.value)),y=p(c,g.time[k],g.time[k+1]),e=0;g.y=y+g.value[k]/2+5;for(e=0;e<g.time.length-1;e++)y=p(c,g.time[e],g.time[e+1]),g.y-g.value[e]/2-5<y&&(g.y=y+g.value[e]/2+5);y=p(c,g.time[e],g.time[e]+t);g.y-g.value[e]/2-5<y&&(g.y=y+g.value[e]/2+5);b[a].y=g.y;n=Math.max(n,g.y+g.value[k]/2);for(e=0;e<g.time.length-1;e++)u(c,g.time[e],g.time[e+1],g.y+g.value[e]/2);u(c,g.time[e],g.time[e]+t,g.y+g.value[e]/2)}f(b,h,n,5)}});define("echarts/component/axis","require ./base zrender/shape/Line ../config ../util/ecData zrender/tool/util zrender/tool/color ./categoryAxis ./valueAxis ../component".split(" "),function(f){function l(b,a,d,c,e,n){p.call(this,b,a,d,c,e);this.axisType=n;this._axisList=[];this.refresh(c)}var p=f("./base"),u=f("zrender/shape/Line"),b=f("../config"),t=f("../util/ecData"),h=f("zrender/tool/util"),m=f("zrender/tool/color");return l.prototype={type:b.COMPONENT_TYPE_AXIS,axisBase:{_buildAxisLine:function(){var b=this.option.axisLine.lineStyle.width,a=b/2,d={_axisShape:"axisLine",zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1},c=this.grid;switch(this.option.position){case "left":d.style={xStart:c.getX()-a,yStart:c.getYend(),xEnd:c.getX()-a,yEnd:c.getY(),lineCap:"round"};break;case "right":d.style={xStart:c.getXend()+a,yStart:c.getYend(),xEnd:c.getXend()+a,yEnd:c.getY(),lineCap:"round"};break;case "bottom":d.style={xStart:c.getX(),yStart:c.getYend()+a,xEnd:c.getXend(),yEnd:c.getYend()+a,lineCap:"round"};break;case "top":d.style={xStart:c.getX(),yStart:c.getY()-a,xEnd:c.getXend(),yEnd:c.getY()-a,lineCap:"round"}}a=d.style;""!==this.option.name&&(a.text=this.option.name,a.textPosition=this.option.nameLocation,a.textFont=this.getFont(this.option.nameTextStyle),this.option.nameTextStyle.align&&(a.textAlign=this.option.nameTextStyle.align),this.option.nameTextStyle.baseline&&(a.textBaseline=this.option.nameTextStyle.baseline),this.option.nameTextStyle.color&&(a.textColor=this.option.nameTextStyle.color));a.strokeColor=this.option.axisLine.lineStyle.color;a.lineWidth=b;this.isHorizontal()?a.yStart=a.yEnd=this.subPixelOptimize(a.yEnd,b):a.xStart=a.xEnd=this.subPixelOptimize(a.xEnd,b);a.lineType=this.option.axisLine.lineStyle.type;d=new u(d);this.shapeList.push(d)},_axisLabelClickable:function(b,a){return b?(t.pack(a,void 0,-1,void 0,-1,a.style.text),a.hoverable=!0,a.clickable=!0,a.highlightStyle={color:m.lift(a.style.color,1),brushType:"fill"},a):a},refixAxisShape:function(b,a){if(this.option.axisLine.onZero){var d;if(this.isHorizontal()&&null!=a)for(var c=0,e=this.shapeList.length;e>c;c++)"axisLine"===this.shapeList[c]._axisShape?(this.shapeList[c].style.yStart=this.shapeList[c].style.yEnd=this.subPixelOptimize(a,this.shapeList[c].stylelineWidth),this.zr.modShape(this.shapeList[c].id)):"axisTick"===this.shapeList[c]._axisShape&&(d=this.shapeList[c].style.yEnd-this.shapeList[c].style.yStart,this.shapeList[c].style.yStart=a-d,this.shapeList[c].style.yEnd=a,this.zr.modShape(this.shapeList[c].id));if(!this.isHorizontal()&&null!=b)for(c=0,e=this.shapeList.length;e>c;c++)"axisLine"===this.shapeList[c]._axisShape?(this.shapeList[c].style.xStart=this.shapeList[c].style.xEnd=this.subPixelOptimize(b,this.shapeList[c].stylelineWidth),this.zr.modShape(this.shapeList[c].id)):"axisTick"===this.shapeList[c]._axisShape&&(d=this.shapeList[c].style.xEnd-this.shapeList[c].style.xStart,this.shapeList[c].style.xStart=b,this.shapeList[c].style.xEnd=b+d,this.zr.modShape(this.shapeList[c].id))}},getPosition:function(){return this.option.position},isHorizontal:function(){return"bottom"===this.option.position||"top"===this.option.position}},reformOption:function(h){if(!h||h instanceof Array&&0===h.length?h=[{type:b.COMPONENT_TYPE_AXIS_VALUE}]:h instanceof Array||(h=[h]),2<h.length&&(h=[h[0],h[1]]),"xAxis"===this.axisType){(!h[0].position||"bottom"!=h[0].position&&"top"!=h[0].position)&&(h[0].position="bottom");1<h.length&&(h[1].position="bottom"===h[0].position?"top":"bottom");for(var a=0,d=h.length;d>a;a++)h[a].type=h[a].type||"category",h[a].xAxisIndex=a,h[a].yAxisIndex=-1}else for((!h[0].position||"left"!=h[0].position&&"right"!=h[0].position)&&(h[0].position="left"),1<h.length&&(h[1].position="left"===h[0].position?"right":"left"),a=0,d=h.length;d>a;a++)h[a].type=h[a].type||"value",h[a].xAxisIndex=-1,h[a].yAxisIndex=a;return h},refresh:function(b){var a;b&&(this.option=b,"xAxis"===this.axisType?(this.option.xAxis=this.reformOption(b.xAxis),a=this.option.xAxis):(this.option.yAxis=this.reformOption(b.yAxis),a=this.option.yAxis),this.series=b.series);for(var d=f("./categoryAxis"),c=f("./valueAxis"),e=Math.max(a&&a.length||0,this._axisList.length),n=0;e>n;n++)!this._axisList[n]||!b||a[n]&&this._axisList[n].type==a[n].type||(this._axisList[n].dispose&&this._axisList[n].dispose(),this._axisList[n]=!1),this._axisList[n]?this._axisList[n].refresh&&this._axisList[n].refresh(a?a[n]:!1,this.series):a&&a[n]&&(this._axisList[n]="category"===a[n].type?new d(this.ecTheme,this.messageCenter,this.zr,a[n],this.myChart,this.axisBase):new c(this.ecTheme,this.messageCenter,this.zr,a[n],this.myChart,this.axisBase,this.series))},getAxis:function(b){return this._axisList[b]},clear:function(){for(var b=0,a=this._axisList.length;a>b;b++)this._axisList[b].dispose&&this._axisList[b].dispose();this._axisList=[]}},h.inherits(l,p),f("../component").define("axis",l),l});define("echarts/component/grid","require ./base zrender/shape/Rectangle ../config zrender/tool/util ../component".split(" "),function(f){function l(b,f,l,a,d){p.call(this,b,f,l,a,d);this.refresh(a)}var p=f("./base"),u=f("zrender/shape/Rectangle"),b=f("../config");b.grid={zlevel:0,z:0,x:12,y:60,x2:12,y2:60,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc"};var t=f("zrender/tool/util");return l.prototype={type:b.COMPONENT_TYPE_GRID,getX:function(){return this._x},getY:function(){return this._y},getWidth:function(){return this._width},getHeight:function(){return this._height},getXend:function(){return this._x+this._width},getYend:function(){return this._y+this._height},getArea:function(){return{x:this._x,y:this._y,width:this._width,height:this._height}},getBbox:function(){return[[this._x,this._y],[this.getXend(),this.getYend()]]},refixAxisShape:function(h){for(var f,l,a=h.xAxis._axisList.concat(h.yAxis?h.yAxis._axisList:[]),d=a.length;d--;)h=a[d],h.type==b.COMPONENT_TYPE_AXIS_VALUE&&0>h._min&&0<=h._max&&(h.isHorizontal()?f=h.getCoord(0):l=h.getCoord(0));if("undefined"!=typeof f||"undefined"!=typeof l)for(d=a.length;d--;)a[d].refixAxisShape(f,l)},refresh:function(b){if(b||this._zrWidth!=this.zr.getWidth()||this._zrHeight!=this.zr.getHeight()){this.clear();this.option=b||this.option;this.option.grid=this.reformOption(this.option.grid);b=this.option.grid;this._zrWidth=this.zr.getWidth();this._zrHeight=this.zr.getHeight();this._x=this.parsePercent(b.x,this._zrWidth);this._y=this.parsePercent(b.y,this._zrHeight);var f=this.parsePercent(b.x2,this._zrWidth),l=this.parsePercent(b.y2,this._zrHeight);this._width="undefined"==typeof b.width?this._zrWidth-this._x-f:this.parsePercent(b.width,this._zrWidth);this._width=0>=this._width?10:this._width;this._height="undefined"==typeof b.height?this._zrHeight-this._y-l:this.parsePercent(b.height,this._zrHeight);this._height=0>=this._height?10:this._height;this._x=this.subPixelOptimize(this._x,b.borderWidth);this._y=this.subPixelOptimize(this._y,b.borderWidth);this.shapeList.push(new u({zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this._x,y:this._y,width:this._width,height:this._height,brushType:0<b.borderWidth?"both":"fill",color:b.backgroundColor,strokeColor:b.borderColor,lineWidth:b.borderWidth}}));this.zr.addShape(this.shapeList[0])}}},t.inherits(l,p),f("../component").define("grid",l),l});define("echarts/component/dataZoom","require ./base zrender/shape/Rectangle zrender/shape/Polygon ../util/shape/Icon ../config ../util/date zrender/tool/util ../component".split(" "),function(f){function l(a,d,c,e,b){p.call(this,a,d,c,e,b);var g=this;g._ondrift=function(a,c){return g.__ondrift(this,a,c)};g._ondragend=function(){return g.__ondragend()};this._fillerSize=30;this._isSilence=!1;this._zoom={};this.option.dataZoom=this.reformOption(this.option.dataZoom);this.zoomOption=this.option.dataZoom;this._handleSize=this.zoomOption.handleSize;this._location=this._getLocation();this._zoom=this._getZoom();this._backupData();this.option.dataZoom.show&&this._buildShape();this._syncData()}var p=f("./base"),u=f("zrender/shape/Rectangle"),b=f("zrender/shape/Polygon"),t=f("../util/shape/Icon"),h=f("../config");h.dataZoom={zlevel:0,z:4,show:!1,orient:"horizontal",backgroundColor:"rgba(0,0,0,0)",dataBackgroundColor:"#eee",fillerColor:"rgba(144,197,237,0.2)",handleColor:"rgba(70,130,180,0.8)",handleSize:20,showDetail:!0,realtime:!1};var m=f("../util/date"),r=f("zrender/tool/util");return l.prototype={type:h.COMPONENT_TYPE_DATAZOOM,_buildShape:function(){this._buildBackground();this._buildFiller();this._buildHandle();this._buildFrame();for(var a=0,d=this.shapeList.length;d>a;a++)this.zr.addShape(this.shapeList[a]);this._syncFrameShape()},_getLocation:function(){var a,d,c,e,b=this.component.grid;return"horizontal"==this.zoomOption.orient?(c=this.zoomOption.width||b.getWidth(),e=this.zoomOption.height||this._fillerSize,a=null!=this.zoomOption.x?this.zoomOption.x:b.getX(),d=null!=this.zoomOption.y?this.zoomOption.y:this.zr.getHeight()-e-2):(c=this.zoomOption.width||this._fillerSize,e=this.zoomOption.height||b.getHeight(),a=null!=this.zoomOption.x?this.zoomOption.x:2,d=null!=this.zoomOption.y?this.zoomOption.y:b.getY()),{x:a,y:d,width:c,height:e}},_getZoom:function(){var a=this.option.series,d=this.option.xAxis;!d||d instanceof Array||(d=[d],this.option.xAxis=d);var c=this.option.yAxis;!c||c instanceof Array||(c=[c],this.option.yAxis=c);var e,b=[],g=this.zoomOption.xAxisIndex;if(d&&null==g){e=[];for(var k=0,f=d.length;f>k;k++)"category"!=d[k].type&&null!=d[k].type||e.push(k)}else e=g instanceof Array?g:null!=g?[g]:[];if(g=this.zoomOption.yAxisIndex,c&&null==g)for(d=[],k=0,f=c.length;f>k;k++)"category"==c[k].type&&d.push(k);else d=g instanceof Array?g:null!=g?[g]:[];for(var q,k=0,f=a.length;f>k;k++)if(q=a[k],q.type==h.CHART_TYPE_LINE||q.type==h.CHART_TYPE_BAR||q.type==h.CHART_TYPE_SCATTER||q.type==h.CHART_TYPE_K){c=0;for(g=e.length;g>c;c++)if(e[c]==(q.xAxisIndex||0)){b.push(k);break}c=0;for(g=d.length;g>c;c++)if(d[c]==(q.yAxisIndex||0)){b.push(k);break}null==this.zoomOption.xAxisIndex&&null==this.zoomOption.yAxisIndex&&q.data&&this.getDataFromOption(q.data[0])instanceof Array&&(q.type==h.CHART_TYPE_SCATTER||q.type==h.CHART_TYPE_LINE||q.type==h.CHART_TYPE_BAR)&&b.push(k)}a=null!=this._zoom.start?this._zoom.start:null!=this.zoomOption.start?this.zoomOption.start:0;k=null!=this._zoom.end?this._zoom.end:null!=this.zoomOption.end?this.zoomOption.end:100;a>k&&(a+=k,k=a-k,a-=k);return{start:a,end:k,start2:0,end2:100,size:Math.round((k-a)/100*("horizontal"==this.zoomOption.orient?this._location.width:this._location.height)),xAxisIndex:e,yAxisIndex:d,seriesIndex:b,scatterMap:this._zoom.scatterMap||{}}},_backupData:function(){this._originalData={xAxis:{},yAxis:{},series:{}};for(var a=this.option.xAxis,d=this._zoom.xAxisIndex,c=0,e=d.length;e>c;c++)this._originalData.xAxis[d[c]]=a[d[c]].data;a=this.option.yAxis;d=this._zoom.yAxisIndex;c=0;for(e=d.length;e>c;c++)this._originalData.yAxis[d[c]]=a[d[c]].data;for(var d=this.option.series,b=this._zoom.seriesIndex,c=0,e=b.length;e>c;c++)a=d[b[c]],(this._originalData.series[b[c]]=a.data)&&this.getDataFromOption(a.data[0])instanceof Array&&(a.type==h.CHART_TYPE_SCATTER||a.type==h.CHART_TYPE_LINE||a.type==h.CHART_TYPE_BAR)&&(this._backupScale(),this._calculScatterMap(b[c]))},_calculScatterMap:function(a){this._zoom.scatterMap=this._zoom.scatterMap||{};this._zoom.scatterMap[a]=this._zoom.scatterMap[a]||{};var d=f("../component").get("axis"),c=r.clone(this.option.xAxis);"category"==c[0].type&&(c[0].type="value");c[1]&&"category"==c[1].type&&(c[1].type="value");var c=new d(this.ecTheme,null,!1,{xAxis:c,series:this.option.series},this,"xAxis"),e=this.option.series[a].xAxisIndex||0;this._zoom.scatterMap[a].x=c.getAxis(e).getExtremum();c.dispose();c=r.clone(this.option.yAxis);"category"==c[0].type&&(c[0].type="value");c[1]&&"category"==c[1].type&&(c[1].type="value");c=new d(this.ecTheme,null,!1,{yAxis:c,series:this.option.series},this,"yAxis");e=this.option.series[a].yAxisIndex||0;this._zoom.scatterMap[a].y=c.getAxis(e).getExtremum();c.dispose()},_buildBackground:function(){var a=this._location.width,d=this._location.height;this.shapeList.push(new u({zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this._location.x,y:this._location.y,width:a,height:d,color:this.zoomOption.backgroundColor}}));for(var c=0,e=this._originalData.xAxis,n=this._zoom.xAxisIndex,g=0,k=n.length;k>g;g++)c=Math.max(c,e[n[g]].length);e=this._originalData.yAxis;n=this._zoom.yAxisIndex;g=0;for(k=n.length;k>g;g++)c=Math.max(c,e[n[g]].length);for(var n=this._zoom.seriesIndex[0],f=this._originalData.series[n],q=Number.MIN_VALUE,m=Number.MAX_VALUE,g=0,k=f.length;k>g;g++)e=this.getDataFromOption(f[g],0),this.option.series[n].type==h.CHART_TYPE_K&&(e=e[1]),isNaN(e)&&(e=0),q=Math.max(q,e),m=Math.min(m,e);var q=q-m,l=[],r=a/(c-(1<c?1:0)),p=d/(c-(1<c?1:0)),G=1;"horizontal"==this.zoomOption.orient&&1>r?G=Math.floor(3*c/a):"vertical"==this.zoomOption.orient&&1>p&&(G=Math.floor(3*c/d));g=0;for(k=c;k>g;g+=G)e=this.getDataFromOption(f[g],0),this.option.series[n].type==h.CHART_TYPE_K&&(e=e[1]),isNaN(e)&&(e=0),l.push("horizontal"==this.zoomOption.orient?[this._location.x+r*g,this._location.y+d-1-Math.round((e-m)/q*(d-10))]:[this._location.x+1+Math.round((e-m)/q*(a-10)),this._location.y+p*(k-g-1)]);"horizontal"==this.zoomOption.orient?(l.push([this._location.x+a,this._location.y+d]),l.push([this._location.x,this._location.y+d])):(l.push([this._location.x,this._location.y]),l.push([this._location.x,this._location.y+d]));this.shapeList.push(new b({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{pointList:l,color:this.zoomOption.dataBackgroundColor},hoverable:!1}))},_buildFiller:function(){this._fillerShae={zlevel:this.getZlevelBase(),z:this.getZBase(),draggable:!0,ondrift:this._ondrift,ondragend:this._ondragend,_type:"filler"};this._fillerShae.style="horizontal"==this.zoomOption.orient?{x:this._location.x+Math.round(this._zoom.start/100*this._location.width)+this._handleSize,y:this._location.y,width:this._zoom.size-2*this._handleSize,height:this._location.height,color:this.zoomOption.fillerColor,text:":::",textPosition:"inside"}:{x:this._location.x,y:this._location.y+Math.round(this._zoom.start/100*this._location.height)+this._handleSize,width:this._location.width,height:this._zoom.size-2*this._handleSize,color:this.zoomOption.fillerColor,text:"::",textPosition:"inside"};this._fillerShae.highlightStyle={brushType:"fill",color:"rgba(0,0,0,0)"};this._fillerShae=new u(this._fillerShae);this.shapeList.push(this._fillerShae)},_buildHandle:function(){var a=this.zoomOption.showDetail?this._getDetail():{start:"",end:""};this._startShape={zlevel:this.getZlevelBase(),z:this.getZBase(),draggable:!0,style:{iconType:"rectangle",x:this._location.x,y:this._location.y,width:this._handleSize,height:this._handleSize,color:this.zoomOption.handleColor,text:"\x3d",textPosition:"inside"},highlightStyle:{text:a.start,brushType:"fill",textPosition:"left"},ondrift:this._ondrift,ondragend:this._ondragend};"horizontal"==this.zoomOption.orient?(this._startShape.style.height=this._location.height,this._endShape=r.clone(this._startShape),this._startShape.style.x=this._fillerShae.style.x-this._handleSize,this._endShape.style.x=this._fillerShae.style.x+this._fillerShae.style.width,this._endShape.highlightStyle.text=a.end,this._endShape.highlightStyle.textPosition="right"):(this._startShape.style.width=this._location.width,this._endShape=r.clone(this._startShape),this._startShape.style.y=this._fillerShae.style.y+this._fillerShae.style.height,this._startShape.highlightStyle.textPosition="bottom",this._endShape.style.y=this._fillerShae.style.y-this._handleSize,this._endShape.highlightStyle.text=a.end,this._endShape.highlightStyle.textPosition="top");this._startShape=new t(this._startShape);this._endShape=new t(this._endShape);this.shapeList.push(this._startShape);this.shapeList.push(this._endShape)},_buildFrame:function(){var a=this.subPixelOptimize(this._location.x,1),d=this.subPixelOptimize(this._location.y,1);this._startFrameShape={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:a,y:d,width:this._location.width-(a>this._location.x?1:0),height:this._location.height-(d>this._location.y?1:0),lineWidth:1,brushType:"stroke",strokeColor:this.zoomOption.handleColor}};this._endFrameShape=r.clone(this._startFrameShape);this._startFrameShape=new u(this._startFrameShape);this._endFrameShape=new u(this._endFrameShape);this.shapeList.push(this._startFrameShape);this.shapeList.push(this._endFrameShape)},_syncHandleShape:function(){"horizontal"==this.zoomOption.orient?(this._startShape.style.x=this._fillerShae.style.x-this._handleSize,this._endShape.style.x=this._fillerShae.style.x+this._fillerShae.style.width,this._zoom.start=(this._startShape.style.x-this._location.x)/this._location.width*100,this._zoom.end=(this._endShape.style.x+this._handleSize-this._location.x)/this._location.width*100):(this._startShape.style.y=this._fillerShae.style.y+this._fillerShae.style.height,this._endShape.style.y=this._fillerShae.style.y-this._handleSize,this._zoom.start=(this._location.y+this._location.height-this._startShape.style.y)/this._location.height*100,this._zoom.end=(this._location.y+this._location.height-this._endShape.style.y-this._handleSize)/this._location.height*100);this.zr.modShape(this._startShape.id);this.zr.modShape(this._endShape.id);this._syncFrameShape();this.zr.refreshNextFrame()},_syncFillerShape:function(){var a,d;"horizontal"==this.zoomOption.orient?(a=this._startShape.style.x,d=this._endShape.style.x,this._fillerShae.style.x=Math.min(a,d)+this._handleSize,this._fillerShae.style.width=Math.abs(a-d)-this._handleSize,this._zoom.start=(Math.min(a,d)-this._location.x)/this._location.width*100,this._zoom.end=(Math.max(a,d)+this._handleSize-this._location.x)/this._location.width*100):(a=this._startShape.style.y,d=this._endShape.style.y,this._fillerShae.style.y=Math.min(a,d)+this._handleSize,this._fillerShae.style.height=Math.abs(a-d)-this._handleSize,this._zoom.start=(this._location.y+this._location.height-Math.max(a,d))/this._location.height*100,this._zoom.end=(this._location.y+this._location.height-Math.min(a,d)-this._handleSize)/this._location.height*100);this.zr.modShape(this._fillerShae.id);this._syncFrameShape();this.zr.refreshNextFrame()},_syncFrameShape:function(){"horizontal"==this.zoomOption.orient?(this._startFrameShape.style.width=this._fillerShae.style.x-this._location.x,this._endFrameShape.style.x=this._fillerShae.style.x+this._fillerShae.style.width,this._endFrameShape.style.width=this._location.x+this._location.width-this._endFrameShape.style.x):(this._startFrameShape.style.y=this._fillerShae.style.y+this._fillerShae.style.height,this._startFrameShape.style.height=this._location.y+this._location.height-this._startFrameShape.style.y,this._endFrameShape.style.height=this._fillerShae.style.y-this._location.y);this.zr.modShape(this._startFrameShape.id);this.zr.modShape(this._endFrameShape.id)},_syncShape:function(){this.zoomOption.show&&("horizontal"==this.zoomOption.orient?(this._startShape.style.x=this._location.x+this._zoom.start/100*this._location.width,this._endShape.style.x=this._location.x+this._zoom.end/100*this._location.width-this._handleSize,this._fillerShae.style.x=this._startShape.style.x+this._handleSize,this._fillerShae.style.width=this._endShape.style.x-this._startShape.style.x-this._handleSize):(this._startShape.style.y=this._location.y+this._location.height-this._zoom.start/100*this._location.height,this._endShape.style.y=this._location.y+this._location.height-this._zoom.end/100*this._location.height-this._handleSize,this._fillerShae.style.y=this._endShape.style.y+this._handleSize,this._fillerShae.style.height=this._startShape.style.y-this._endShape.style.y-this._handleSize),this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this.zr.modShape(this._fillerShae.id),this._syncFrameShape(),this.zr.refresh())},_syncData:function(a){var d,c,e,b,g,k;for(k in this._originalData){d=this._originalData[k];for(var f in d)g=d[f],null!=g&&(b=g.length,c=Math.floor(this._zoom.start/100*b),e=Math.ceil(this._zoom.end/100*b),this.getDataFromOption(g[0])instanceof Array&&this.option[k][f].type!=h.CHART_TYPE_K?(this._setScale(),this.option[k][f].data=this._synScatterData(f,g)):this.option[k][f].data=g.slice(c,e))}this._isSilence||!this.zoomOption.realtime&&!a||this.messageCenter.dispatch(h.EVENT.DATA_ZOOM,null,{zoom:this._zoom},this.myChart)},_synScatterData:function(a,d){if(0===this._zoom.start&&100==this._zoom.end&&0===this._zoom.start2&&100==this._zoom.end2)return d;var c,e,b,g,k,h=[],q=this._zoom.scatterMap[a];"horizontal"==this.zoomOption.orient?(c=q.x.max-q.x.min,e=this._zoom.start/100*c+q.x.min,b=this._zoom.end/100*c+q.x.min,c=q.y.max-q.y.min,g=this._zoom.start2/100*c+q.y.min,k=this._zoom.end2/100*c+q.y.min):(c=q.x.max-q.x.min,e=this._zoom.start2/100*c+q.x.min,b=this._zoom.end2/100*c+q.x.min,c=q.y.max-q.y.min,g=this._zoom.start/100*c+q.y.min,k=this._zoom.end/100*c+q.y.min);for(var q=0,f=d.length;f>q;q++)c=d[q].value||d[q],c[0]>=e&&c[0]<=b&&c[1]>=g&&c[1]<=k&&h.push(d[q]);return h},_setScale:function(){var a=0!==this._zoom.start||100!==this._zoom.end||0!==this._zoom.start2||100!==this._zoom.end2,d={xAxis:this.option.xAxis,yAxis:this.option.yAxis},c;for(c in d)for(var e=0,b=d[c].length;b>e;e++)d[c][e].scale=a||d[c][e]._scale},_backupScale:function(){var a={xAxis:this.option.xAxis,yAxis:this.option.yAxis},d;for(d in a)for(var c=0,e=a[d].length;e>c;c++)a[d][c]._scale=a[d][c].scale},_getDetail:function(){var a="horizontal"==this.zoomOption.orient?"xAxis":"yAxis",d=this._originalData[a],c;for(c in d){var e=d[c];if(null!=e)return d=e.length,a=Math.floor(this._zoom.start/100*d),d=Math.ceil(this._zoom.end/100*d),d-=0<d?1:0,{start:this.getDataFromOption(e[a]),end:this.getDataFromOption(e[d])}}c=this._zoom.seriesIndex[0];d=this.option[a][this.option.series[c][a+"Index"]||0].type;e=this._zoom.scatterMap[c][a.charAt(0)].min;a=this._zoom.scatterMap[c][a.charAt(0)].max;c=a-e;return"value"==d?{start:e+c*this._zoom.start/100,end:e+c*this._zoom.end/100}:"time"==d?(a=e+c*this._zoom.end/100,e+=c*this._zoom.start/100,d=m.getAutoFormatter(e,a).formatter,{start:m.format(d,e),end:m.format(d,a)}):{start:"",end:""}},__ondrift:function(a,d,c){this.zoomOption.zoomLock&&(a=this._fillerShae);var e="filler"==a._type?this._handleSize:0;if("horizontal"==this.zoomOption.orient?a.style.x+d-e<=this._location.x?a.style.x=this._location.x+e:a.style.x+d+a.style.width+e>=this._location.x+this._location.width?a.style.x=this._location.x+this._location.width-a.style.width-e:a.style.x+=d:a.style.y+c-e<=this._location.y?a.style.y=this._location.y+e:a.style.y+c+a.style.height+e>=this._location.y+this._location.height?a.style.y=this._location.y+this._location.height-a.style.height-e:a.style.y+=c,"filler"==a._type?this._syncHandleShape():this._syncFillerShape(),this.zoomOption.realtime&&this._syncData(),this.zoomOption.showDetail)a=this._getDetail(),this._startShape.style.text=this._startShape.highlightStyle.text=a.start,this._endShape.style.text=this._endShape.highlightStyle.text=a.end,this._startShape.style.textPosition=this._startShape.highlightStyle.textPosition,this._endShape.style.textPosition=this._endShape.highlightStyle.textPosition;return!0},__ondragend:function(){this.zoomOption.showDetail&&(this._startShape.style.text=this._endShape.style.text="\x3d",this._startShape.style.textPosition=this._endShape.style.textPosition="inside",this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this.zr.refreshNextFrame());this.isDragend=!0},ondragend:function(a,d){this.isDragend&&a.target&&(!this.zoomOption.realtime&&this._syncData(),d.dragOut=!0,d.dragIn=!0,this._isSilence||this.zoomOption.realtime||this.messageCenter.dispatch(h.EVENT.DATA_ZOOM,null,{zoom:this._zoom},this.myChart),d.needRefresh=!1,this.isDragend=!1)},ondataZoom:function(a,d){d.needRefresh=!0},absoluteZoom:function(a){this._zoom.start=a.start;this._zoom.end=a.end;this._zoom.start2=a.start2;this._zoom.end2=a.end2;this._syncShape();this._syncData(!0)},rectZoom:function(a){if(!a)return this._zoom.start=this._zoom.start2=0,this._zoom.end=this._zoom.end2=100,this._syncShape(),this._syncData(!0),this._zoom;var d=this.component.grid.getArea(),c=a.x,e=a.y,b=a.width,g=a.height;if(0>b&&(c+=b,b=-b),0>g&&(e+=g,g=-g),c>d.x+d.width||e>d.y+d.height)return!1;c<d.x&&(c=d.x);c+b>d.x+d.width&&(b=d.x+d.width-c);e+g>d.y+d.height&&(g=d.y+d.height-e);var k;a=(c-d.x)/d.width;c=1-(c+b-d.x)/d.width;b=1-(e+g-d.y)/d.height;d=(e-d.y)/d.height;return"horizontal"==this.zoomOption.orient?(k=this._zoom.end-this._zoom.start,this._zoom.start+=k*a,this._zoom.end-=k*c,k=this._zoom.end2-this._zoom.start2,this._zoom.start2+=k*b,this._zoom.end2-=k*d):(k=this._zoom.end-this._zoom.start,this._zoom.start+=k*b,this._zoom.end-=k*d,k=this._zoom.end2-this._zoom.start2,this._zoom.start2+=k*a,this._zoom.end2-=k*c),this._syncShape(),this._syncData(!0),this._zoom},syncBackupData:function(a){for(var d,c=this._originalData.series,e=a.series,b=0,g=e.length;g>b;b++){d=e[b].data||e[b].eventList;a=c[b]?Math.floor(this._zoom.start/100*c[b].length):0;for(var k=0,h=d.length;h>k;k++)c[b]&&(c[b][k+a]=d[k])}},syncOption:function(a){this.silence(!0);this.option=a;this.option.dataZoom=this.reformOption(this.option.dataZoom);this.zoomOption=this.option.dataZoom;this.clear();this._location=this._getLocation();this._zoom=this._getZoom();this._backupData();this.option.dataZoom&&this.option.dataZoom.show&&this._buildShape();this._syncData();this.silence(!1)},silence:function(a){this._isSilence=a},getRealDataIndex:function(a,d){if(!this._originalData||0===this._zoom.start&&100==this._zoom.end)return d;var c=this._originalData.series;return c[a]?Math.floor(this._zoom.start/100*c[a].length)+d:-1},resize:function(){this.clear();this._location=this._getLocation();this._zoom=this._getZoom();this.option.dataZoom.show&&this._buildShape()}},r.inherits(l,p),f("../component").define("dataZoom",l),l});define("echarts/util/date",[],function(){function f(b){return 10>b?"0"+b:b}function l(b,f,h){return b=p(b),b.setMonth(Math.ceil((b.getMonth()+1)/h)*h),b.setDate(f),b}function p(b){return b instanceof Date?b:new Date("string"==typeof b?b.replace(/-/g,"/"):b)}var u=[{formatter:"hh : mm : ss",value:1E3},{formatter:"hh : mm : ss",value:5E3},{formatter:"hh : mm : ss",value:1E4},{formatter:"hh : mm : ss",value:15E3},{formatter:"hh : mm : ss",value:3E4},{formatter:"hh : mm\nMM - dd",value:6E4},{formatter:"hh : mm\nMM - dd",value:3E5},{formatter:"hh : mm\nMM - dd",value:6E5},{formatter:"hh : mm\nMM - dd",value:9E5},{formatter:"hh : mm\nMM - dd",value:18E5},{formatter:"hh : mm\nMM - dd",value:36E5},{formatter:"hh : mm\nMM - dd",value:72E5},{formatter:"hh : mm\nMM - dd",value:216E5},{formatter:"hh : mm\nMM - dd",value:432E5},{formatter:"MM - dd\nyyyy",value:864E5},{formatter:"week",value:6048E5},{formatter:"month",value:26784E5},{formatter:"quarter",value:8208E6},{formatter:"half-year",value:16416E6},{formatter:"year",value:32832E6}];return{getAutoFormatter:function(b,f,h){h=1<h?h:2;for(var m,l,a,d,c=0,e=u.length;e>c;c++)if(m=u[c].value,l=Math.ceil(f/m)*m-Math.floor(b/m)*m,Math.round(l/m)<=1.2*h){a=u[c].formatter;d=u[c].value;break}return null==a&&(a="year",m=317088E5,l=Math.ceil(f/m)*m-Math.floor(b/m)*m,d=Math.round(l/(h-1)/m)*m),{formatter:a,gapValue:d}},getNewDate:p,format:function(b,l){"week"!=b&&"month"!=b&&"quarter"!=b&&"half-year"!=b&&"year"!=b||(b="MM - dd\nyyyy");var h=p(l),m=h.getFullYear(),r=h.getMonth()+1,a=h.getDate(),d=h.getHours(),c=h.getMinutes(),h=h.getSeconds();return b=b.replace("MM",f(r)),b=b.toLowerCase(),b=b.replace("yyyy",m),b=b.replace("yy",m%100),b=b.replace("dd",f(a)),b=b.replace("d",a),b=b.replace("hh",f(d)),b=b.replace("h",d),b=b.replace("mm",f(c)),b=b.replace("m",c),b=b.replace("ss",f(h)),b.replace("s",h)},nextMonday:function(b){return b=p(b),b.setDate(b.getDate()+8-b.getDay()),b},nextNthPerNmonth:l,nextNthOnMonth:function(b,f){return l(b,f,1)},nextNthOnQuarterYear:function(b,f){return l(b,f,3)},nextNthOnHalfYear:function(b,f){return l(b,f,6)},nextNthOnYear:function(b,f){return l(b,f,12)}}});define("echarts/component/categoryAxis","require ./base zrender/shape/Text zrender/shape/Line zrender/shape/Rectangle ../config zrender/tool/util zrender/tool/area ../component".split(" "),function(f){function l(a,d,c,e,b,g){if(1>e.data.length)return void console.error("option.data.length \x3c 1.");p.call(this,a,d,c,e,b);this.grid=this.component.grid;for(var k in g)this[k]=g[k];this.refresh(e)}var p=f("./base"),u=f("zrender/shape/Text"),b=f("zrender/shape/Line"),t=f("zrender/shape/Rectangle"),h=f("../config");h.categoryAxis={zlevel:0,z:0,show:!0,position:"bottom",name:"",nameLocation:"end",nameTextStyle:{},boundaryGap:!0,axisLine:{show:!0,onZero:!0,lineStyle:{color:"#48b",width:2,type:"solid"}},axisTick:{show:!0,interval:"auto",inside:!1,length:5,lineStyle:{color:"#333",width:1}},axisLabel:{show:!0,interval:"auto",rotate:0,margin:8,textStyle:{color:"#333"}},splitLine:{show:!1,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}};var m=f("zrender/tool/util"),r=f("zrender/tool/area");return l.prototype={type:h.COMPONENT_TYPE_AXIS_CATEGORY,_getReformedLabel:function(a){var d=this.getDataFromOption(this.option.data[a]);a=this.option.data[a].formatter||this.option.axisLabel.formatter;return a&&("function"==typeof a?d=a.call(this.myChart,d):"string"==typeof a&&(d=a.replace("{value}",d))),d},_getInterval:function(){var a=this.option.axisLabel.interval;if("auto"==a){var d=this.option.axisLabel.textStyle.fontSize,c=this.option.data,e=this.option.data.length;if(this.isHorizontal())if(3<e)for(var b,g,k=this.getGap(),f=!1,h=Math.floor(.5/k),h=1>h?1:h,a=Math.floor(15/k);!f&&e>a;){a+=h;f=!0;b=Math.floor(k*a);for(var l=Math.floor((e-1)/a)*a;0<=l;l-=a){if(0!==this.option.axisLabel.rotate)g=d;else if(c[l].textStyle)g=r.getTextWidth(this._getReformedLabel(l),this.getFont(m.merge(c[l].textStyle,this.option.axisLabel.textStyle)));else{g=this._getReformedLabel(l)+"";var z=(g.match(/\w/g)||"").length;g=z*d*2/3+(g.length-z)*d}if(g>b){f=!1;break}}}else a=1;else if(3<e)for(k=this.getGap(),a=Math.floor(11/k);d>k*a-6&&e>a;)a++;else a=1}else a="function"==typeof a?1:a-0+1;return a},_buildShape:function(){if(this._interval=this._getInterval(),this.option.show){this.option.splitArea.show&&this._buildSplitArea();this.option.splitLine.show&&this._buildSplitLine();this.option.axisLine.show&&this._buildAxisLine();this.option.axisTick.show&&this._buildAxisTick();this.option.axisLabel.show&&this._buildAxisLabel();for(var a=0,d=this.shapeList.length;d>a;a++)this.zr.addShape(this.shapeList[a])}},_buildAxisTick:function(){var a,d=this.option.data,c=this.option.data.length,e=this.option.axisTick,n=e.length,g=e.lineStyle.color,k=e.lineStyle.width,h="function"==typeof e.interval?e.interval:"auto"==e.interval&&"function"==typeof this.option.axisLabel.interval?this.option.axisLabel.interval:!1,f=h?1:"auto"==e.interval?this._interval:e.interval-0+1,m=e.onGap,m=m?this.getGap()/2:"undefined"==typeof m&&this.option.boundaryGap?this.getGap()/2:0,l=0<m?-f:0;if(this.isHorizontal())for(var p,r="bottom"==this.option.position?e.inside?this.grid.getYend()-n-1:this.grid.getYend()+1:e.inside?this.grid.getY()+1:this.grid.getY()-n-1;c>l;l+=f)h&&!h(l,d[l])||(p=this.subPixelOptimize(this.getCoordByIndex(l)+(0<=l?m:0),k),a={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:p,yStart:r,xEnd:p,yEnd:r+n,strokeColor:g,lineWidth:k}},this.shapeList.push(new b(a)));else for(p="left"==this.option.position?e.inside?this.grid.getX()+1:this.grid.getX()-n-1:e.inside?this.grid.getXend()-n-1:this.grid.getXend()+1;c>l;l+=f)h&&!h(l,d[l])||(r=this.subPixelOptimize(this.getCoordByIndex(l)-(0<=l?m:0),k),a={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:p,yStart:r,xEnd:p+n,yEnd:r,strokeColor:g,lineWidth:k}},this.shapeList.push(new b(a)))},_buildAxisLabel:function(){var a,d,c=this.option.data,e=this.option.data.length,b=this.option.axisLabel,g=b.rotate,k=b.margin,h=b.clickable,f=b.textStyle,b="function"==typeof b.interval?b.interval:!1;if(this.isHorizontal()){var l,p;"bottom"==this.option.position?(l=this.grid.getYend()+k,p="top"):(l=this.grid.getY()-k,p="bottom");for(k=0;e>k;k+=this._interval)b&&!b(k,c[k])||""===this._getReformedLabel(k)||(d=m.merge(c[k].textStyle||{},f),a={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:this.getCoordByIndex(k),y:l,color:d.color,text:this._getReformedLabel(k),textFont:this.getFont(d),textAlign:d.align||"center",textBaseline:d.baseline||p}},g&&(a.style.textAlign=0<g?"bottom"==this.option.position?"right":"left":"bottom"==this.option.position?"left":"right",a.rotation=[g*Math.PI/180,a.style.x,a.style.y]),this.shapeList.push(new u(this._axisLabelClickable(h,a))))}else{var r,t;"left"==this.option.position?(r=this.grid.getX()-k,t="right"):(r=this.grid.getXend()+k,t="left");for(k=0;e>k;k+=this._interval)b&&!b(k,c[k])||""===this._getReformedLabel(k)||(d=m.merge(c[k].textStyle||{},f),a={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:r,y:this.getCoordByIndex(k),color:d.color,text:this._getReformedLabel(k),textFont:this.getFont(d),textAlign:d.align||t,textBaseline:d.baseline||0===k&&""!==this.option.name?"bottom":k==e-1&&""!==this.option.name?"top":"middle"}},g&&(a.rotation=[g*Math.PI/180,a.style.x,a.style.y]),this.shapeList.push(new u(this._axisLabelClickable(h,a))))}},_buildSplitLine:function(){var a,d=this.option.data,c=this.option.data.length,e=this.option.splitLine,n=e.lineStyle.type,g=e.lineStyle.width,k=e.lineStyle.color,k=k instanceof Array?k:[k],h=k.length,f="function"==typeof this.option.axisLabel.interval?this.option.axisLabel.interval:!1,l=e.onGap,e=l?this.getGap()/2:"undefined"==typeof l&&this.option.boundaryGap?this.getGap()/2:0;if(c-=l||"undefined"==typeof l&&this.option.boundaryGap?1:0,this.isHorizontal())for(var m,p=this.grid.getY(),r=this.grid.getYend(),l=0;c>l;l+=this._interval)f&&!f(l,d[l])||(m=this.subPixelOptimize(this.getCoordByIndex(l)+e,g),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:m,yStart:p,xEnd:m,yEnd:r,strokeColor:k[l/this._interval%h],lineType:n,lineWidth:g}},this.shapeList.push(new b(a)));else for(m=this.grid.getX(),r=this.grid.getXend(),l=0;c>l;l+=this._interval)f&&!f(l,d[l])||(p=this.subPixelOptimize(this.getCoordByIndex(l)-e,g),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:m,yStart:p,xEnd:r,yEnd:p,strokeColor:k[l/this._interval%h],lineType:n,lineWidth:g}},this.shapeList.push(new b(a)))},_buildSplitArea:function(){var a,d=this.option.data,c=this.option.splitArea,e=c.areaStyle.color;if(e instanceof Array){var b=e.length,g=this.option.data.length,k="function"==typeof this.option.axisLabel.interval?this.option.axisLabel.interval:!1,c=(c=c.onGap)?this.getGap()/2:"undefined"==typeof c&&this.option.boundaryGap?this.getGap()/2:0;if(this.isHorizontal())for(var h,f=this.grid.getY(),l=this.grid.getHeight(),m=this.grid.getX(),p=0;g>=p;p+=this._interval)k&&!k(p,d[p])&&g>p||(h=g>p?this.getCoordByIndex(p)+c:this.grid.getXend(),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:m,y:f,width:h-m,height:l,color:e[p/this._interval%b]}},this.shapeList.push(new t(a)),m=h);else for(h=this.grid.getX(),l=this.grid.getWidth(),m=this.grid.getYend(),p=0;g>=p;p+=this._interval)k&&!k(p,d[p])&&g>p||(f=g>p?this.getCoordByIndex(p)-c:this.grid.getY(),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:h,y:f,width:l,height:m-f,color:e[p/this._interval%b]}},this.shapeList.push(new t(a)),m=f)}else a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this.grid.getX(),y:this.grid.getY(),width:this.grid.getWidth(),height:this.grid.getHeight(),color:e}},this.shapeList.push(new t(a))},refresh:function(a){a&&(this.option=this.reformOption(a),this.option.axisLabel.textStyle=this.getTextStyle(this.option.axisLabel.textStyle));this.clear();this._buildShape()},getGap:function(){var a=this.option.data.length,d=this.isHorizontal()?this.grid.getWidth():this.grid.getHeight();return this.option.boundaryGap?d/a:d/(1<a?a-1:1)},getCoord:function(a){for(var d=this.option.data,c=d.length,b=this.getGap(),n=this.option.boundaryGap?b/2:0,g=0;c>g;g++){if(this.getDataFromOption(d[g])==a)return this.isHorizontal()?this.grid.getX()+n:this.grid.getYend()-n;n+=b}},getCoordByIndex:function(a){if(0>a)return this.isHorizontal()?this.grid.getX():this.grid.getYend();if(a>this.option.data.length-1)return this.isHorizontal()?this.grid.getXend():this.grid.getY();var d=this.getGap(),c=this.option.boundaryGap?d/2:0;return c+=a*d,this.isHorizontal()?this.grid.getX()+c:this.grid.getYend()-c},getNameByIndex:function(a){return this.getDataFromOption(this.option.data[a])},getIndexByName:function(a){for(var d=this.option.data,c=d.length,b=0;c>b;b++)if(this.getDataFromOption(d[b])==a)return b;return-1},getValueFromCoord:function(){return""},isMainAxis:function(a){return 0===a%this._interval}},m.inherits(l,p),f("../component").define("categoryAxis",l),l});define("echarts/component/valueAxis","require ./base zrender/shape/Text zrender/shape/Line zrender/shape/Rectangle ../config ../util/date zrender/tool/util ../util/smartSteps ../util/accMath ../component".split(" "),function(f){function l(a,d,c,b,n,g,k){if(!k||0===k.length)return void console.err("option.series.length \x3d\x3d 0.");p.call(this,a,d,c,b,n);this.series=k;this.grid=this.component.grid;for(var h in g)this[h]=g[h];this.refresh(b,k)}var p=f("./base"),u=f("zrender/shape/Text"),b=f("zrender/shape/Line"),t=f("zrender/shape/Rectangle"),h=f("../config");h.valueAxis={zlevel:0,z:0,show:!0,position:"left",name:"",nameLocation:"end",nameTextStyle:{},boundaryGap:[0,0],axisLine:{show:!1,onZero:!0,lineStyle:{color:"#48b",width:2,type:"solid"}},axisTick:{show:!1,inside:!1,length:5,lineStyle:{color:"#333",width:1}},axisLabel:{show:!0,rotate:0,margin:-1,textStyle:{align:"left",baseline:"bottom",color:"#333"}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}};var m=f("../util/date"),r=f("zrender/tool/util");return l.prototype={type:h.COMPONENT_TYPE_AXIS_VALUE,_buildShape:function(){if(this._hasData=!1,this._calculateValue(),this._hasData&&this.option.show){this.option.splitArea.show&&this._buildSplitArea();this.option.splitLine.show&&this._buildSplitLine();this.option.axisLine.show&&this._buildAxisLine();this.option.axisTick.show&&this._buildAxisTick();this.option.axisLabel.show&&this._buildAxisLabel();for(var a=0,d=this.shapeList.length;d>a;a++)this.zr.addShape(this.shapeList[a])}},_buildAxisTick:function(){var a,d=this._valueList,c=this._valueList.length,e=this.option.axisTick,h=e.length,g=e.lineStyle.color,k=e.lineStyle.width;if(this.isHorizontal())for(var f="bottom"===this.option.position?e.inside?this.grid.getYend()-h-1:this.grid.getYend()+1:e.inside?this.grid.getY()+1:this.grid.getY()-h-1,e=0;c>e;e++)a=this.subPixelOptimize(this.getCoord(d[e]),k),a={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:a,yStart:f,xEnd:a,yEnd:f+h,strokeColor:g,lineWidth:k}},this.shapeList.push(new b(a));else for(f="left"===this.option.position?e.inside?this.grid.getX()+1:this.grid.getX()-h-1:e.inside?this.grid.getXend()-h-1:this.grid.getXend()+1,e=0;c>e;e++)a=this.subPixelOptimize(this.getCoord(d[e]),k),a={_axisShape:"axisTick",zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:f,yStart:a,xEnd:f+h,yEnd:a,strokeColor:g,lineWidth:k}},this.shapeList.push(new b(a))},_buildAxisLabel:function(){var a,d=this._valueList,c=this._valueList.length,b=this.option.axisLabel.rotate;a=this.option.axisLabel.margin;var h=this.option.axisLabel.clickable,g=this.option.axisLabel.textStyle;if(this.isHorizontal()){var k,f;"bottom"===this.option.position?(k=this.grid.getYend()+a,f="top"):(k=this.grid.getY()-a,f="bottom");for(var l=0;c>l;l++)a={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:this.getCoord(d[l]),y:k,color:"function"==typeof g.color?g.color(d[l]):g.color,text:this._valueLabel[l],textFont:this.getFont(g),textAlign:g.align||"center",textBaseline:g.baseline||f}},b&&(a.style.textAlign=0<b?"bottom"===this.option.position?"right":"left":"bottom"===this.option.position?"left":"right",a.rotation=[b*Math.PI/180,a.style.x,a.style.y]),this.shapeList.push(new u(this._axisLabelClickable(h,a)))}else{var m,p;"left"===this.option.position?(m=this.grid.getX()-a,p="right"):(m=this.grid.getXend()+a,p="left");for(l=0;c>l;l++)a={zlevel:this.getZlevelBase(),z:this.getZBase()+3,hoverable:!1,style:{x:m,y:this.getCoord(d[l]),color:"function"==typeof g.color?g.color(d[l]):g.color,text:this._valueLabel[l],textFont:this.getFont(g),textAlign:g.align||p,textBaseline:g.baseline||(0===l&&""!==this.option.name?"bottom":l===c-1&&""!==this.option.name?"top":"middle")}},b&&(a.rotation=[b*Math.PI/180,a.style.x,a.style.y]),this.shapeList.push(new u(this._axisLabelClickable(h,a)))}},_buildSplitLine:function(){var a,d=this._valueList,c=this._valueList.length,e=this.option.splitLine,h=e.lineStyle.type,g=e.lineStyle.width,e=e.lineStyle.color,e=e instanceof Array?e:[e],k=e.length;if(this.isHorizontal())for(var f=this.grid.getY(),l=this.grid.getYend(),m=0;c>m;m++)a=this.subPixelOptimize(this.getCoord(d[m]),g),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:a,yStart:f,xEnd:a,yEnd:l,strokeColor:e[m%k],lineType:h,lineWidth:g}},this.shapeList.push(new b(a));else for(f=this.grid.getX(),l=this.grid.getXend(),m=0;c>m;m++)a=this.subPixelOptimize(this.getCoord(d[m]),g),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{xStart:f,yStart:a,xEnd:l,yEnd:a,strokeColor:e[m%k],lineType:h,lineWidth:g}},this.shapeList.push(new b(a))},_buildSplitArea:function(){var a,d=this.option.splitArea.areaStyle.color;if(d instanceof Array){var c=d.length,b=this._valueList,h=this._valueList.length;if(this.isHorizontal()){var g,f=this.grid.getY(),l=this.grid.getHeight();a=this.grid.getX();for(var m=0;h>=m;m++)g=h>m?this.getCoord(b[m]):this.grid.getXend(),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:a,y:f,width:g-a,height:l,color:d[m%c]}},this.shapeList.push(new t(a)),a=g}else for(f=this.grid.getX(),l=this.grid.getWidth(),a=this.grid.getYend(),m=0;h>=m;m++)g=h>m?this.getCoord(b[m]):this.grid.getY(),a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:f,y:g,width:l,height:a-g,color:d[m%c]}},this.shapeList.push(new t(a)),a=g}else a={zlevel:this.getZlevelBase(),z:this.getZBase(),hoverable:!1,style:{x:this.grid.getX(),y:this.grid.getY(),width:this.grid.getWidth(),height:this.grid.getHeight(),color:d}},this.shapeList.push(new t(a))},_calculateValue:function(){if(isNaN(this.option.min-0)||isNaN(this.option.max-0)){for(var a,d,c={},b=this.component.legend,f=0,g=this.series.length;g>f;f++)!(this.series[f].type!=h.CHART_TYPE_LINE&&this.series[f].type!=h.CHART_TYPE_BAR&&this.series[f].type!=h.CHART_TYPE_SCATTER&&this.series[f].type!=h.CHART_TYPE_K&&this.series[f].type!=h.CHART_TYPE_EVENTRIVER||b&&!b.isSelected(this.series[f].name)||(a=this.series[f].xAxisIndex||0,d=this.series[f].yAxisIndex||0,this.option.xAxisIndex!=a&&this.option.yAxisIndex!=d||!this._calculSum(c,f)));for(f in c){a=c[f];d=0;for(b=a.length;b>d;d++)if(!isNaN(a[d])){this._hasData=!0;this._min=a[d];this._max=a[d];break}if(this._hasData)break}for(f in c)for(a=c[f],d=0,b=a.length;b>d;d++)isNaN(a[d])||(this._min=Math.min(this._min,a[d]),this._max=Math.max(this._max,a[d]));c=Math.abs(this._max-this._min);this._min=isNaN(this.option.min-0)?this._min-Math.abs(c*this.option.boundaryGap[0]):this.option.min-0;this._max=isNaN(this.option.max-0)?this._max+Math.abs(c*this.option.boundaryGap[1]):this.option.max-0;this._min===this._max&&(0===this._max?this._max=1:0<this._max?this._min=this.option.splitNumber:this._max=this.option.splitNumber);"time"!=this.option.type?this._reformValue(this.option.scale):this._reformTimeValue()}else this._hasData=!0,this._min=this.option.min-0,this._max=this.option.max-0,"time"!=this.option.type?this._customerValue():this._reformTimeValue()},_calculSum:function(a,d){var c,b,f=this.series[d].name||"kener";if(this.series[d].stack){var g="__Magic_Key_Positive__"+this.series[d].stack,k="__Magic_Key_Negative__"+this.series[d].stack;a[g]=a[g]||[];a[k]=a[k]||[];a[f]=a[f]||[];b=this.series[d].data;for(var l=0,p=b.length;p>l;l++)c=this.getDataFromOption(b[l]),"-"!==c&&(c-=0,0<=c?null!=a[g][l]?a[g][l]+=c:a[g][l]=c:null!=a[k][l]?a[k][l]+=c:a[k][l]=c,this.option.scale&&a[f].push(c))}else if(a[f]=a[f]||[],this.series[d].type!=h.CHART_TYPE_EVENTRIVER)for(b=this.series[d].data,l=0,p=b.length;p>l;l++)c=this.getDataFromOption(b[l]),this.series[d].type===h.CHART_TYPE_K?(a[f].push(c[0]),a[f].push(c[1]),a[f].push(c[2]),a[f].push(c[3])):c instanceof Array?(-1!=this.option.xAxisIndex&&a[f].push("time"!=this.option.type?c[0]:m.getNewDate(c[0])),-1!=this.option.yAxisIndex&&a[f].push("time"!=this.option.type?c[1]:m.getNewDate(c[1]))):a[f].push(c);else for(b=this.series[d].eventList,l=0,p=b.length;p>l;l++)for(c=b[l].evolution,g=0,k=c.length;k>g;g++)a[f].push(m.getNewDate(c[g].time))},_reformValue:function(a){var d=f("../util/smartSteps"),c=this.option.splitNumber;!a&&0<=this._min&&0<=this._max&&(this._min=0);!a&&0>=this._min&&0>=this._max&&(this._max=0);a=d(this._min,this._max,c);this._min=a.min;this._max=a.max;this._valueList=a.pnts;this._reformLabelData()},_reformTimeValue:function(){var a=null!=this.option.splitNumber?this.option.splitNumber:5,d=m.getAutoFormatter(this._min,this._max,a),c=d.formatter,b=d.gapValue;this._valueList=[m.getNewDate(this._min)];var f;switch(c){case "week":f=m.nextMonday(this._min);break;case "month":f=m.nextNthOnMonth(this._min,1);break;case "quarter":f=m.nextNthOnQuarterYear(this._min,1);break;case "half-year":f=m.nextNthOnHalfYear(this._min,1);break;case "year":f=m.nextNthOnYear(this._min,1);break;default:72E5>=b?f=(Math.floor(this._min/b)+1)*b:(f=m.getNewDate(this._min- -b),f.setHours(6*Math.round(f.getHours()/6)),f.setMinutes(0),f.setSeconds(0))}f-this._min<b/2&&(f-=-b);d=m.getNewDate(f);for(a*=1.5;0<=a--&&(("month"==c||"quarter"==c||"half-year"==c||"year"==c)&&d.setDate(1),!(this._max-d<b/2));)this._valueList.push(d),d=m.getNewDate(d- -b);this._valueList.push(m.getNewDate(this._max));this._reformLabelData(c)},_customerValue:function(){var a=f("../util/accMath"),d=null!=this.option.splitNumber?this.option.splitNumber:5,c=(this._max-this._min)/d;this._valueList=[];for(var b=0;d>=b;b++)this._valueList.push(a.accAdd(this._min,a.accMul(c,b)));this._reformLabelData()},_reformLabelData:function(a){this._valueLabel=[];var b=this.option.axisLabel.formatter;if(b)for(var c=0,e=this._valueList.length;e>c;c++)"function"==typeof b?this._valueLabel.push(a?b.call(this.myChart,this._valueList[c],a):b.call(this.myChart,this._valueList[c])):"string"==typeof b&&this._valueLabel.push(a?m.format(b,this._valueList[c]):b.replace("{value}",this._valueList[c]));else if(a)for(c=0,e=this._valueList.length;e>c;c++)this._valueLabel.push(m.format(a,this._valueList[c]));else for(c=0,e=this._valueList.length;e>c;c++)this._valueLabel.push(this.numAddCommas(this._valueList[c]))},getExtremum:function(){return this._calculateValue(),{min:this._min,max:this._max}},refresh:function(a,b){a&&(this.option=this.reformOption(a),this.option.axisLabel.textStyle=r.merge(this.option.axisLabel.textStyle||{},this.ecTheme.textStyle),this.series=b);this.zr&&(this.clear(),this._buildShape())},getCoord:function(a){a=a<this._min?this._min:a;a=a>this._max?this._max:a;return this.isHorizontal()?this.grid.getX()+(a-this._min)/(this._max-this._min)*this.grid.getWidth():this.grid.getYend()-(a-this._min)/(this._max-this._min)*this.grid.getHeight()},getCoordSize:function(a){return Math.abs(this.isHorizontal()?a/(this._max-this._min)*this.grid.getWidth():a/(this._max-this._min)*this.grid.getHeight())},getValueFromCoord:function(a){var b;return this.isHorizontal()?(a=a<this.grid.getX()?this.grid.getX():a,a=a>this.grid.getXend()?this.grid.getXend():a,b=this._min+(a-this.grid.getX())/this.grid.getWidth()*(this._max-this._min)):(a=a<this.grid.getY()?this.grid.getY():a,a=a>this.grid.getYend()?this.grid.getYend():a,b=this._max-(a-this.grid.getY())/this.grid.getHeight()*(this._max-this._min)),b.toFixed(2)-0},isMaindAxis:function(a){for(var b=0,c=this._valueList.length;c>b;b++)if(this._valueList[b]===a)return!0;return!1}},r.inherits(l,p),f("../component").define("valueAxis",l),l});define("echarts/util/smartSteps",[],function(){function f(a,b,f,g){g=g||0;var h=l((b-a)/f,-1);a=l(a,-1,1);b=l(b,-1);var k=q.min(h.e,a.e,b.e);0===a.c?k=q.min(h.e,b.e):0===b.c&&(k=q.min(h.e,a.e));p(h,{c:0,e:k});p(a,h,1);p(b,h);g+=k;a=a.c;b=b.c;for(var h=(b-a)/f,k=q.pow(10,g),m=0,n=[],r=f+1;r--;)n[r]=(a+h*r)*k;if(0>g)for(r=k,m=(r=(+r).toFixed(15).split("."),r.pop().replace(/0+$/,"").length),h=+(h*k).toFixed(m),a=+(a*k).toFixed(m),b=+(b*k).toFixed(m),r=n.length;r--;)n[r]=n[r].toFixed(m),0===+n[r]&&(n[r]="0");else a*=k,b*=k,h*=k;return e=0,c=0,d=0,{min:a,max:b,secs:f,step:h,fix:m,exp:g,pnts:n}}function l(a,b,c){b=C(b%10)||2;0>b&&(a===z(a)?b=(""+E(a)).replace(/0+$/,"").length||1:(a=a.toFixed(15).replace(/0+$/,""),b=a.replace(".","").replace(/^[-0]+/,"").length,a=+a));var d=z(q.log(E(a))/q.LN10)-b+1;a=+(a*q.pow(10,-d)).toFixed(15)||0;return a=c?z(a):F(a),!a&&(d=0),(""+E(a)).length>b&&(d+=1,a/=10),{c:a,e:d}}function p(a,b,c){(b=b.e-a.e)&&(a.e+=b,a.c*=q.pow(10,-b),a.c=c?z(a.c):F(a.c))}function u(a,b,c){a.e<b.e?p(b,a,c):p(a,b,c)}function b(a,b){b=b||k;a=l(a);for(var c=a.c,d=0;c>b[d];)d++;if(!b[d])for(c/=10,a.e+=1,d=0;c>b[d];)d++;return a.c=b[d],a}function t(a,d,k){var B=k||+e.slice(-1),v=b((d-a)/B,c),t=l(d-a),x=l(a,-1,1),w=l(d,-1);p(t,v);p(x,v,1);p(w,v);if(k){var t=B,D,A;D=w.c;for(v=(w.c-x.c)/t-1;D>x.c;)v=b(v+1,c),v=v.c*q.pow(10,v.e),D=v*t,A=F(w.c/v)*v,D=A-D;t=x.c-D-(A-w.c);t>1.1*v&&(t=C(t/v/2)*v,D+=t,A+=t);x.c=D;w.c=A}else B=h(x,w);if(a===z(a)&&d===z(d)&&0<=a*d){if(B>d-a)return m(a,d,B);A=w.c-x.c;v=A/B*q.pow(10,w.e);v!==z(v)&&(v=z(v),A=v*B,d-a>A&&(v+=1,A=v*B,!k&&v*(B-1)>=d-a&&(--B,A=v*B)),A>=d-a)&&(k=A-(d-a),x.c=C(a-k/2),w.c=C(d+k/2),x.e=0,w.e=0)}k=r(a,d,x.c,w.c);x.c=k[0];w.c=k[1];if(n||g)n?(a=l(a,4,1),6<x.e-a.e&&(a={c:0,e:x.e}),u(x,a),u(w,a),w.c+=a.c-x.c,x.c=a.c):g&&(a=l(d,4),6<w.e-a.e&&(a={c:0,e:w.e}),u(x,a),u(w,a),x.c+=a.c-w.c,w.c=a.c);return f(x.c,w.c,B,w.e)}function h(a,d){for(var f,g,h,k,l=[],m=e.length;m--;)f=e[m],g=b((d.c-a.c)/f,c),g=g.c*q.pow(10,g.e),h=z(a.c/g)*g,k=F(d.c/g)*g,l[m]={min:h,max:k,step:g,span:k-h};return l.sort(function(a,b){var c=a.span-b.span;return 0===c&&(c=a.step-b.step),c}),l=l[0],f=l.span/l.step,a.c=l.min,d.c=l.max,3>f?2*f:f}function m(a,b,c){if(c=c||5,n)b=a+c;else if(g)a=b-c;else{var d=c-(b-a),e=C(a-d/2),d=C(b+d/2);b=r(a,b,e,d);a=b[0];b=b[1]}return f(a,b,c)}function r(a,b,c,d){return 0<=a&&0>c?(d-=c,c=0):0>=b&&0<d&&(c-=d,d=0),[c,d]}function a(a,b,c){var d=c?[c]:e,g=b-a;if(0===g)return b=l(b,3),c=d[0],b.c=C(b.c+c/2),f(b.c-c,b.c,c,b.e);1E-6>E(b/g)&&(b=0);1E-6>E(a/g)&&(a=0);var h,k,m=[[5,10],[10,2],[50,10],[100,2]],n=[],q=l(b-a,3);a=l(a,-1,1);var r=l(b,-1);p(a,q,1);p(r,q);g=r.c-a.c;q.c=g;for(var t=d.length;t--;){c=d[t];b=F(g/c);h=b*c-g;k=3*(h+3);k+=2*(c-d[0]+2);0===c%5&&(k-=10);for(var u=m.length;u--;)0===b%m[u][0]&&(k/=m[u][1]);[c,b,h,k].join();n[t]={secs:c,step:b,delta:h,score:k}}return n.sort(function(a,b){return a.score-b.score}),n=n[0],a.c=C(a.c-n.delta/2),r.c=C(r.c+n.delta/2),f(a.c,r.c,n.secs,q.e)}var d,c,e,n,g,k=[10,20,25,50],y=[4,5,6],q=Math,C=q.round,z=q.floor,F=q.ceil,E=q.abs;return function(b,f,h,l){d=l||{};c=d.steps||k;e=d.secs||y;h=C(+h||0)%99;b=+b||0;f=+f||0;n=g=0;"min"in d&&(b=+d.min||0,n=1);"max"in d&&(f=+d.max||0,g=1);b>f&&(f=[b,b=f][0]);l=f-b;if(n&&g)return a(b,f,h);if((h||5)>l){if(b===z(b)&&f===z(f))return m(b,f,h);if(0===l)return h=h||5,l=q.min(E(f/h),h)/2.1,n?f=b+l:g?b=f-l:(b-=l,f+=l),t(b,f,h)}return t(b,f,h)}});
|