2 lines
58 KiB
JavaScript
2 lines
58 KiB
JavaScript
|
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"],function(t){function e(t,e,s,o,a){i.call(this,t,e,s,o,a);var n=this;n._ondragend=function(){n.isDragend=!0},this.refresh(o)}var i=t("./base"),s=t("../layout/eventRiver"),o=t("zrender/shape/Polygon");t("../component/axis"),t("../component/grid"),t("../component/dataZoom");var a=t("../config");a.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 n=t("../util/ecData"),r=t("../util/date"),h=t("zrender/tool/util"),l=t("zrender/tool/color");return e.prototype={type:a.CHART_TYPE_EVENTRIVER,_buildShape:function(){var t=this.series;this.selectedMap={},this._dataPreprocessing();for(var e=this.component.legend,i=[],o=0;o<t.length;o++)if(t[o].type===this.type){t[o]=this.reformOption(t[o]),this.legendHoverLink=t[o].legendHoverLink||this.legendHoverLink;var a=t[o].name||"";if(this.selectedMap[a]=e?e.isSelected(a):!0,!this.selectedMap[a])continue;this.buildMark(o),i.push(this.series[o])}s(i,this._intervalX,this.component.grid.getArea()),this._drawEventRiver(),this.addShapeList()},_dataPreprocessing:function(){for(var t,e,i=this.series,s=0,o=i.length;o>s;s++)if(i[s].type===this.type){t=this.component.xAxis.getAxis(i[s].xAxisIndex||0);for(var a=0,n=i[s].eventList.length;n>a;a++){e=i[s].eventList[a].evolution;for(var h=0,l=e.length;l>h;h++)e[h].timeScale=t.getCoord(r.getNewDate(e[h].time)-0),e[h].valueScale=Math.pow(e[h].value,.8)}}this._intervalX=Math.round(this.component.grid.getWidth()/40)},_drawEventRiver:function(){for(var t=this.series,e=0;e<t.length;e++){var i=t[e].name||"";if(t[e].type===this.type&&this.selectedMap[i])for(var s=0;s<t[e].eventList.length;s++)this._drawEventBubble(t[e].eventList[s],e,s)}},_drawEventBubble:function(t,e,i){var s=this.series,a=s[e],r=a.name||"",h=a.eventList[i],d=[h,a],p=this.component.legend,c=p?p.getColor(r):this.zr.getColor(e),u=this.deepMerge(d,"itemStyle.normal")||{},g=this.deepMerge(d,"itemStyle.emphasis")||{},f=this.getItemStyleColor(u.color,e,i,h)||c,y=this.getItemStyleColor(g.color,e,i,h)||("string"==typeof f?l.lift(f,-.2):f),m=this._calculateControlPoints(t),_={zlevel:this.getZlevelBase(),z:this.getZBase(),clickable:this.deepQuery(d,"clickable"),style:{pointList:m,smooth:"spline",brushType:"both",lineJoin:"round",color:f,lineWidth:u.borderWidth,strokeColor:u.borderColor},highlightStyle:{color:y,lineWidth:g.borderWidth,strokeColor:g.borderColor},draggable:"vertical",ondragend:this._ondragend};_=new o(_),this.addLabel(_,a,h,t.name),n.pack(_,s[e],e,s[e].eventList[i],i,s[e].eventList[i].name),this.shapeList.push(_)},_calculateControlPoints:function(t){var e=this._intervalX,i=t.y,s=t.evolution,o=s.length;if(!(1>o)){for(var a=[],n=[],r=0;o>r;r++)a.push(s[r].timeScale),n.push(s[r].valueScale);var h=[];h.push([a[0],i]);var r=0;for(r=0;o-1>r;r++)h.push([(a[r]+a[r+1])/2,n[r]/-2+i]);for(h.push([(a[r]+(a[r]+e))/2,n[r]/-2+i]),h.push([a[r]+e,i]),h.push([(a[r]+(a[r]+e))/2,n[r]/2+i]),r=o-1;r>0;r--)h.push([(a[r]+a[r-1])/2,n[r-1]/2+i]);return h}},ondragend:function(t,e){this.isDragend&&t.target&&(e.dragOut=!0,e.dragIn=!0,e.needRefresh=!1,this.isDragend=!1)},refresh:function(t){t&&(this.option=t,this.series=t.series),this.backupShapeList(),this._buildShape()}},h.inherits(e,i),t("../chart").define("eventRiver",e),e}),define("echarts/layout/eventRiver",["require"],function(){function t(t,a,n){function r(t,e){var i=t.importance,s=e.importance;return i>s?-1:s>i?1:0}function h(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,s=t.length;s>i;i++)if(t[i]===e)return i;return-1}for(var l=5,d=a,p=0;p<t.length;p++){for(var c=0;c<t[p].eventList.length;c++){null==t[p].eventList[c].weight&&(t[p].eventList[c].weight=1);for(var u=0,g=0;g<t[p].eventList[c].evolution.length;g++)u+=
|
||
|
},silence:function(t){this._isSilence=t},getRealDataIndex:function(t,e){if(!this._originalData||0===this._zoom.start&&100==this._zoom.end)return e;var i=this._originalData.series;return i[t]?Math.floor(this._zoom.start/100*i[t].length)+e:-1},resize:function(){this.clear(),this._location=this._getLocation(),this._zoom=this._getZoom(),this.option.dataZoom.show&&this._buildShape()}},h.inherits(e,i),t("../component").define("dataZoom",e),e}),define("echarts/util/date",[],function(){function t(t,e,i){i=i>1?i:2;for(var s,o,a,n,r=0,h=d.length;h>r;r++)if(s=d[r].value,o=Math.ceil(e/s)*s-Math.floor(t/s)*s,Math.round(o/s)<=1.2*i){a=d[r].formatter,n=d[r].value;break}return null==a&&(a="year",s=317088e5,o=Math.ceil(e/s)*s-Math.floor(t/s)*s,n=Math.round(o/(i-1)/s)*s),{formatter:a,gapValue:n}}function e(t){return 10>t?"0"+t:t}function i(t,i){("week"==t||"month"==t||"quarter"==t||"half-year"==t||"year"==t)&&(t="MM - dd\nyyyy");var s=l(i),o=s.getFullYear(),a=s.getMonth()+1,n=s.getDate(),r=s.getHours(),h=s.getMinutes(),d=s.getSeconds();return t=t.replace("MM",e(a)),t=t.toLowerCase(),t=t.replace("yyyy",o),t=t.replace("yy",o%100),t=t.replace("dd",e(n)),t=t.replace("d",n),t=t.replace("hh",e(r)),t=t.replace("h",r),t=t.replace("mm",e(h)),t=t.replace("m",h),t=t.replace("ss",e(d)),t=t.replace("s",d)}function s(t){return t=l(t),t.setDate(t.getDate()+8-t.getDay()),t}function o(t,e,i){return t=l(t),t.setMonth(Math.ceil((t.getMonth()+1)/i)*i),t.setDate(e),t}function a(t,e){return o(t,e,1)}function n(t,e){return o(t,e,3)}function r(t,e){return o(t,e,6)}function h(t,e){return o(t,e,12)}function l(t){return t instanceof Date?t:new Date("string"==typeof t?t.replace(/-/g,"/"):t)}var d=[{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:t,getNewDate:l,format:i,nextMonday:s,nextNthPerNmonth:o,nextNthOnMonth:a,nextNthOnQuarterYear:n,nextNthOnHalfYear:r,nextNthOnYear:h}}),define("echarts/component/categoryAxis",["require","./base","zrender/shape/Text","zrender/shape/Line","zrender/shape/Rectangle","../config","zrender/tool/util","zrender/tool/area","../component"],function(t){function e(t,e,s,o,a,n){if(o.data.length<1)return void console.error("option.data.length < 1.");i.call(this,t,e,s,o,a),this.grid=this.component.grid;for(var r in n)this[r]=n[r];this.refresh(o)}var i=t("./base"),s=t("zrender/shape/Text"),o=t("zrender/shape/Line"),a=t("zrender/shape/Rectangle"),n=t("../config");n.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 r=t("zrender/tool/util"),h=t("zrender/tool/area");return e.prototype={type:n.COMPONENT_TYPE_AXIS_CATEGORY,_getReformedLabel:function(t){var e=this.getDataFromOption(this.option.data[t]),i=this.option.data[t].formatter||this.option.axisLabel.formatter;return i&&("function"==typeof i?e=i.call(this.myChart,e):"string"==typeof i&&(e=i.replace("{value}",e))),e},_getInterval:function(){var t=this.option.axisLabel.interval;if("auto"==t){var e=this.
|