a;a++)n[a]=e[Math.floor(i/t*a)];return n},_getCandle:function(e,t,i,n,o,r,l,h,d,m,c,p,u,V,U){var g=this.series,y={zlevel:this._zlevelBase,clickable:this.deepQuery([g[e].data[t],g[e]],"clickable"),style:{x:n,y:[r,l,h,d],width:o,color:m,strokeColor:p,lineWidth:c,brushType:"both"},highlightStyle:{color:u,strokeColor:U,lineWidth:V},_seriesIndex:e};return s.pack(y,g[e],e,g[e].data[t],t,i),y=new a(y)},getMarkCoord:function(e,t){var i=this.series[e],n=this.component.xAxis.getAxis(i.xAxisIndex),a=this.component.yAxis.getAxis(i.yAxisIndex);return["string"!=typeof t.xAxis&&n.getCoordByIndex?n.getCoordByIndex(t.xAxis||0):n.getCoord(t.xAxis||0),"string"!=typeof t.yAxis&&a.getCoordByIndex?a.getCoordByIndex(t.yAxis||0):a.getCoord(t.yAxis||0)]},refresh:function(e){e&&(this.option=e,this.series=e.series),this.backupShapeList(),this._buildShape()},addDataAnimation:function(e){for(var t=this.series,i={},n=0,a=e.length;a>n;n++)i[e[n][0]]=e[n];for(var o,r,l,h,d,m,n=0,a=this.shapeList.length;a>n;n++)if(d=this.shapeList[n]._seriesIndex,i[d]&&!i[d][3]&&"candle"===this.shapeList[n].type){if(m=s.get(this.shapeList[n],"dataIndex"),h=t[d],i[d][2]&&m===h.data.length-1){this.zr.delShape(this.shapeList[n].id);continue}if(!i[d][2]&&0===m){this.zr.delShape(this.shapeList[n].id);continue}r=this.component.xAxis.getAxis(h.xAxisIndex||0).getGap(),o=i[d][2]?r:-r,l=0,this.zr.animate(this.shapeList[n].id,"").when(500,{position:[o,l]}).start()}}},r.inherits(t,n),r.inherits(t,i),e("../chart").define("k",t),t});
--------------------------------------------------------------------------------
/smarttable/echarts/chart/line.js:
--------------------------------------------------------------------------------
1 | define("echarts/chart/line",["require","../component/base","./base","zrender/shape/BrokenLine","../util/shape/Icon","../util/shape/HalfSmoothPolygon","../component/axis","../component/grid","../component/dataZoom","../config","../util/ecData","zrender/tool/util","zrender/tool/color","../chart"],function(e){function t(e,t,i,o,r){n.call(this,e,t,i,o,r),a.call(this),this.refresh(o)}function i(e,t,i){var n=t.x,a=t.y,o=t.width,s=t.height,l=s/2;t.symbol.match("empty")&&(e.fillStyle="#fff"),t.brushType="both";var h=t.symbol.replace("empty","").toLowerCase();h.match("star")?(l=h.replace("star","")-0||5,a-=1,h="star"):("rectangle"===h||"arrow"===h)&&(n+=(o-s)/2,o=s);var d="";if(h.match("image")&&(d=h.replace(new RegExp("^image:\\/\\/"),""),h="image",n+=Math.round((o-s)/2)-1,o=s+=2),h=r.prototype.iconLibrary[h]){var m=t.x,c=t.y;e.moveTo(m,c+l),e.lineTo(m+5,c+l),e.moveTo(m+t.width-5,c+l),e.lineTo(m+t.width,c+l);var p=this;h(e,{x:n+4,y:a+4,width:o-8,height:s-8,n:l,image:d},function(){p.modSelf(),i()})}else e.moveTo(n,a+l),e.lineTo(n+o,a+l)}var n=e("../component/base"),a=e("./base"),o=e("zrender/shape/BrokenLine"),r=e("../util/shape/Icon"),s=e("../util/shape/HalfSmoothPolygon");e("../component/axis"),e("../component/grid"),e("../component/dataZoom");var l=e("../config"),h=e("../util/ecData"),d=e("zrender/tool/util"),m=e("zrender/tool/color");return t.prototype={type:l.CHART_TYPE_LINE,_buildShape:function(){this.finalPLMap={},this._bulidPosition()},_buildHorizontal:function(e,t,i,n){for(var a,o,r,s,l,h,d,m,c,p,u=this.series,V=i[0][0],U=u[V],y=U.xAxisIndex,g=this.component.xAxis.getAxis(y),f={},b=0,_=t;_>b&&null!=g.getNameByIndex(b);b++){r=g.getCoordByIndex(b);for(var x=0,k=i.length;k>x;x++){a=u[i[x][0]].yAxisIndex||0,o=this.component.yAxis.getAxis(a),h=l=m=d=o.getCoord(0);for(var L=0,v=i[x].length;v>L;L++)V=i[x][L],U=u[V],c=U.data[b],p=null!=c?null!=c.value?c.value:c:"-",f[V]=f[V]||[],n[V]=n[V]||{min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,sum:0,counter:0,average:0},"-"!==p?(p>=0?(l-=L>0?o.getCoordSize(p):h-o.getCoord(p),s=l):0>p&&(d+=L>0?o.getCoordSize(p):o.getCoord(p)-m,s=d),f[V].push([r,s,b,g.getNameByIndex(b),r,h]),n[V].min>p&&(n[V].min=p,n[V].minY=s,n[V].minX=r),n[V].max0&&(this.finalPLMap[V]=this.finalPLMap[V]||[],this.finalPLMap[V].push(f[V]),f[V]=[])}l=this.component.grid.getY();for(var W,x=0,k=i.length;k>x;x++)for(var L=0,v=i[x].length;v>L;L++)V=i[x][L],U=u[V],c=U.data[b],p=null!=c?null!=c.value?c.value:c:"-","-"==p&&this.deepQuery([c,U,this.option],"calculable")&&(W=this.deepQuery([c,U],"symbolSize"),l+=2*W+5,s=l,this.shapeList.push(this._getCalculableItem(V,b,g.getNameByIndex(b),r,s,"horizontal")))}for(var w in f)f[w].length>0&&(this.finalPLMap[w]=this.finalPLMap[w]||[],this.finalPLMap[w].push(f[w]),f[w]=[]);this._calculMarkMapXY(n,i,"y"),this._buildBorkenLine(e,this.finalPLMap,g,"horizontal")},_buildVertical:function(e,t,i,n){for(var a,o,r,s,l,h,d,m,c,p,u=this.series,V=i[0][0],U=u[V],y=U.yAxisIndex,g=this.component.yAxis.getAxis(y),f={},b=0,_=t;_>b&&null!=g.getNameByIndex(b);b++){s=g.getCoordByIndex(b);for(var x=0,k=i.length;k>x;x++){a=u[i[x][0]].xAxisIndex||0,o=this.component.xAxis.getAxis(a),h=l=m=d=o.getCoord(0);for(var L=0,v=i[x].length;v>L;L++)V=i[x][L],U=u[V],c=U.data[b],p=null!=c?null!=c.value?c.value:c:"-",f[V]=f[V]||[],n[V]=n[V]||{min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY,sum:0,counter:0,average:0},"-"!==p?(p>=0?(l+=L>0?o.getCoordSize(p):o.getCoord(p)-h,r=l):0>p&&(d-=L>0?o.getCoordSize(p):m-o.getCoord(p),r=d),f[V].push([r,s,b,g.getNameByIndex(b),h,s]),n[V].min>p&&(n[V].min=p,n[V].minX=r,n[V].minY=s),n[V].max
0&&(this.finalPLMap[V]=this.finalPLMap[V]||[],this.finalPLMap[V].push(f[V]),f[V]=[])}l=this.component.grid.getXend();for(var W,x=0,k=i.length;k>x;x++)for(var L=0,v=i[x].length;v>L;L++)V=i[x][L],U=u[V],c=U.data[b],p=null!=c?null!=c.value?c.value:c:"-","-"==p&&this.deepQuery([c,U,this.option],"calculable")&&(W=this.deepQuery([c,U],"symbolSize"),l-=2*W+5,r=l,this.shapeList.push(this._getCalculableItem(V,b,g.getNameByIndex(b),r,s,"vertical")))}for(var w in f)f[w].length>0&&(this.finalPLMap[w]=this.finalPLMap[w]||[],this.finalPLMap[w].push(f[w]),f[w]=[]);this._calculMarkMapXY(n,i,"x"),this._buildBorkenLine(e,this.finalPLMap,g,"vertical")},_buildOther:function(e,t,i,n){for(var a,o,r=this.series,s={},l=0,h=i.length;h>l;l++)for(var d=0,m=i[l].length;m>d;d++){var c=i[l][d],p=r[c],u=p.xAxisIndex||0;a=this.component.xAxis.getAxis(u);var V=p.yAxisIndex||0;o=this.component.yAxis.getAxis(V);var U=o.getCoord(0);s[c]=s[c]||[],n[c]=n[c]||{min0:Number.POSITIVE_INFINITY,min1:Number.POSITIVE_INFINITY,max0:Number.NEGATIVE_INFINITY,max1:Number.NEGATIVE_INFINITY,sum0:0,sum1:0,counter0:0,counter1:0,average0:0,average1:0};for(var y=0,g=p.data.length;g>y;y++){var f=p.data[y],b=null!=f?null!=f.value?f.value:f:"-";if(b instanceof Array){var _=a.getCoord(b[0]),x=o.getCoord(b[1]);s[c].push([_,x,y,b[0],_,U]),n[c].min0>b[0]&&(n[c].min0=b[0],n[c].minY0=x,n[c].minX0=_),n[c].max0b[1]&&(n[c].min1=b[1],n[c].minY1=x,n[c].minX1=_),n[c].max10&&(this.finalPLMap[k]=this.finalPLMap[k]||[],this.finalPLMap[k].push(s[k]),s[k]=[]);this._calculMarkMapXY(n,i,"xy"),this._buildBorkenLine(e,this.finalPLMap,a,"other")},_buildBorkenLine:function(e,t,i,n){for(var a,r="other"==n?"horizontal":n,l=this.series,c=e.length-1;c>=0;c--){var p=e[c],u=l[p],V=t[p];if(u.type===this.type&&null!=V)for(var U=this._getBbox(p,r),y=this._sIndex2ColorMap[p],g=this.query(u,"itemStyle.normal.lineStyle.width"),f=this.query(u,"itemStyle.normal.lineStyle.type"),b=this.query(u,"itemStyle.normal.lineStyle.color"),_=this.getItemStyleColor(this.query(u,"itemStyle.normal.color"),p,-1),x=null!=this.query(u,"itemStyle.normal.areaStyle"),k=this.query(u,"itemStyle.normal.areaStyle.color"),L=0,v=V.length;v>L;L++){var W=V[L],w="other"!=n&&this._isLarge(r,W);if(w)W=this._getLargePointList(r,W);else for(var X=0,I=W.length;I>X;X++)a=u.data[W[X][2]],(this.deepQuery([a,u,this.option],"calculable")||this.deepQuery([a,u],"showAllSymbol")||"categoryAxis"===i.type&&i.isMainAxis(W[X][2])&&"none"!=this.deepQuery([a,u],"symbol"))&&this.shapeList.push(this._getSymbol(p,W[X][2],W[X][3],W[X][0],W[X][1],r));var K=new o({zlevel:this._zlevelBase,style:{miterLimit:g,pointList:W,strokeColor:b||_||y,lineWidth:g,lineType:f,smooth:this._getSmooth(u.smooth),smoothConstraint:U,shadowColor:this.query(u,"itemStyle.normal.lineStyle.shadowColor"),shadowBlur:this.query(u,"itemStyle.normal.lineStyle.shadowBlur"),shadowOffsetX:this.query(u,"itemStyle.normal.lineStyle.shadowOffsetX"),shadowOffsetY:this.query(u,"itemStyle.normal.lineStyle.shadowOffsetY")},hoverable:!1,_main:!0,_seriesIndex:p,_orient:r});if(h.pack(K,l[p],p,0,L,l[p].name),this.shapeList.push(K),x){var S=new s({zlevel:this._zlevelBase,style:{miterLimit:g,pointList:d.clone(W).concat([[W[W.length-1][4],W[W.length-1][5]],[W[0][4],W[0][5]]]),brushType:"fill",smooth:this._getSmooth(u.smooth),smoothConstraint:U,color:k?k:m.alpha(y,.5)},highlightStyle:{brushType:"fill"},hoverable:!1,_main:!0,_seriesIndex:p,_orient:r});h.pack(S,l[p],p,0,L,l[p].name),this.shapeList.push(S)}}}},_getBbox:function(e,t){var i=this.component.grid.getBbox(),n=this.xMarkMap[e];return null!=n.minX0?[[Math.min(n.minX0,n.maxX0,n.minX1,n.maxX1),Math.min(n.minY0,n.maxY0,n.minY1,n.maxY1)],[Math.max(n.minX0,n.maxX0,n.minX1,n.maxX1),Math.max(n.minY0,n.maxY0,n.minY1,n.maxY1)]]:("horizontal"===t?(i[0][1]=Math.min(n.minY,n.maxY),i[1][1]=Math.max(n.minY,n.maxY)):(i[0][0]=Math.min(n.minX,n.maxX),i[1][0]=Math.max(n.minX,n.maxX)),i)},_isLarge:function(e,t){return t.length<2?!1:"horizontal"===e?Math.abs(t[0][0]-t[1][0])<.5:Math.abs(t[0][1]-t[1][1])<.5},_getLargePointList:function(e,t){var i;i="horizontal"===e?this.component.grid.getWidth():this.component.grid.getHeight();for(var n=t.length,a=[],o=0;i>o;o++)a[o]=t[Math.floor(n/i*o)];return a},_getSmooth:function(e){return e?.3:0},_getCalculableItem:function(e,t,i,n,a,o){var r=this.series,s=r[e].calculableHolderColor||this.ecTheme.calculableHolderColor,l=this._getSymbol(e,t,i,n,a,o);return l.style.color=s,l.style.strokeColor=s,l.rotation=[0,0],l.hoverable=!1,l.draggable=!1,l.style.text=void 0,l},_getSymbol:function(e,t,i,n,a,o){var r=this.series,s=r[e],l=s.data[t],h=this.getSymbolShape(s,e,l,t,i,n,a,this._sIndex2ShapeMap[e],this._sIndex2ColorMap[e],"#fff","vertical"===o?"horizontal":"vertical");return h.zlevel=this._zlevelBase+1,this.deepQuery([l,s,this.option],"calculable")&&(this.setCalculable(h),h.draggable=!0),h},getMarkCoord:function(e,t){var i=this.series[e],n=this.xMarkMap[e],a=this.component.xAxis.getAxis(i.xAxisIndex),o=this.component.yAxis.getAxis(i.yAxisIndex);if(t.type&&("max"===t.type||"min"===t.type||"average"===t.type)){var r=null!=t.valueIndex?t.valueIndex:null!=n.maxX0?"1":"";return[n[t.type+"X"+r],n[t.type+"Y"+r],n[t.type+"Line"+r],n[t.type+r]]}return["string"!=typeof t.xAxis&&a.getCoordByIndex?a.getCoordByIndex(t.xAxis||0):a.getCoord(t.xAxis||0),"string"!=typeof t.yAxis&&o.getCoordByIndex?o.getCoordByIndex(t.yAxis||0):o.getCoord(t.yAxis||0)]},refresh:function(e){e&&(this.option=e,this.series=e.series),this.backupShapeList(),this._buildShape()},ontooltipHover:function(e,t){for(var i,n,a=e.seriesIndex,o=e.dataIndex,r=a.length;r--;)if(i=this.finalPLMap[a[r]])for(var s=0,l=i.length;l>s;s++){n=i[s];for(var h=0,d=n.length;d>h;h++)o===n[h][2]&&t.push(this._getSymbol(a[r],n[h][2],n[h][3],n[h][0],n[h][1],"horizontal"))}},addDataAnimation:function(e){for(var t=this.series,i={},n=0,a=e.length;a>n;n++)i[e[n][0]]=e[n];for(var o,r,s,l,h,d,m,n=this.shapeList.length-1;n>=0;n--)if(h=this.shapeList[n]._seriesIndex,i[h]&&!i[h][3]){if(this.shapeList[n]._main&&this.shapeList[n].style.pointList.length>1){if(d=this.shapeList[n].style.pointList,r=Math.abs(d[0][0]-d[1][0]),l=Math.abs(d[0][1]-d[1][1]),m="horizontal"===this.shapeList[n]._orient,i[h][2]){if("half-smooth-polygon"===this.shapeList[n].type){var c=d.length;this.shapeList[n].style.pointList[c-3]=d[c-2],this.shapeList[n].style.pointList[c-3][m?0:1]=d[c-4][m?0:1],this.shapeList[n].style.pointList[c-2]=d[c-1]}this.shapeList[n].style.pointList.pop(),m?(o=r,s=0):(o=0,s=-l)}else{if(this.shapeList[n].style.pointList.shift(),"half-smooth-polygon"===this.shapeList[n].type){var p=this.shapeList[n].style.pointList.pop();m?p[0]=d[0][0]:p[1]=d[0][1],this.shapeList[n].style.pointList.push(p)}m?(o=-r,s=0):(o=0,s=l)}this.zr.modShape(this.shapeList[n].id,{style:{pointList:this.shapeList[n].style.pointList}},!0)}else{if(i[h][2]&&this.shapeList[n]._dataIndex===t[h].data.length-1){this.zr.delShape(this.shapeList[n].id);continue}if(!i[h][2]&&0===this.shapeList[n]._dataIndex){this.zr.delShape(this.shapeList[n].id);continue}}this.shapeList[n].position=[0,0],this.zr.animate(this.shapeList[n].id,"").when(500,{position:[o,s]}).start()}}},r.prototype.iconLibrary.legendLineIcon=i,d.inherits(t,a),d.inherits(t,n),e("../chart").define("line",t),t}),define("echarts/util/shape/HalfSmoothPolygon",["require","zrender/shape/Base","zrender/shape/util/smoothBezier","zrender/tool/util","zrender/shape/Polygon"],function(e){function t(e){i.call(this,e)}var i=e("zrender/shape/Base"),n=e("zrender/shape/util/smoothBezier"),a=e("zrender/tool/util");return t.prototype={type:"half-smooth-polygon",buildPath:function(t,i){var a=i.pointList;if(!(a.length<2))if(i.smooth){var o=n(a.slice(0,-2),i.smooth,!1,i.smoothConstraint);t.moveTo(a[0][0],a[0][1]);for(var r,s,l,h=a.length,d=0;h-3>d;d++)r=o[2*d],s=o[2*d+1],l=a[d+1],t.bezierCurveTo(r[0],r[1],s[0],s[1],l[0],l[1]);t.lineTo(a[h-2][0],a[h-2][1]),t.lineTo(a[h-1][0],a[h-1][1]),t.lineTo(a[0][0],a[0][1])}else e("zrender/shape/Polygon").prototype.buildPath(t,i)}},a.inherits(t,i),t});
--------------------------------------------------------------------------------
/smarttable/echarts/chart/pie.js:
--------------------------------------------------------------------------------
1 | define("echarts/chart/pie",["require","../component/base","./base","zrender/shape/Text","zrender/shape/Ring","zrender/shape/Circle","zrender/shape/Sector","zrender/shape/BrokenLine","../config","../util/ecData","zrender/tool/util","zrender/tool/math","zrender/tool/color","../chart"],function(e){function t(e,t,a,o,s){i.call(this,e,t,a,o,s),n.call(this);var r=this;r.shapeHandler.onmouseover=function(e){var t=e.target,i=d.get(t,"seriesIndex"),n=d.get(t,"dataIndex"),a=d.get(t,"special"),o=[t.style.x,t.style.y],s=t.style.startAngle,l=t.style.endAngle,h=((l+s)/2+360)%360,m=t.highlightStyle.color,c=r.getLabel(i,n,a,o,h,m,!0);c&&r.zr.addHoverShape(c);var p=r.getLabelLine(i,n,o,t.style.r0,t.style.r,h,m,!0);p&&r.zr.addHoverShape(p)},this.refresh(o)}var i=e("../component/base"),n=e("./base"),a=e("zrender/shape/Text"),o=e("zrender/shape/Ring"),s=e("zrender/shape/Circle"),r=e("zrender/shape/Sector"),l=e("zrender/shape/BrokenLine"),h=e("../config"),d=e("../util/ecData"),m=e("zrender/tool/util"),c=e("zrender/tool/math"),p=e("zrender/tool/color");return t.prototype={type:h.CHART_TYPE_PIE,_buildShape:function(){var e=this.series,t=this.component.legend;this.selectedMap={},this._selected={};var i,n,a;this._selectedMode=!1;for(var r,l=0,m=e.length;m>l;l++)if(e[l].type===h.CHART_TYPE_PIE){if(e[l]=this.reformOption(e[l]),this.legendHoverLink=e[l].legendHoverLink||this.legendHoverLink,r=e[l].name||"",this.selectedMap[r]=t?t.isSelected(r):!0,!this.selectedMap[r])continue;i=this.parseCenter(this.zr,e[l].center),n=this.parseRadius(this.zr,e[l].radius),this._selectedMode=this._selectedMode||e[l].selectedMode,this._selected[l]=[],this.deepQuery([e[l],this.option],"calculable")&&(a={zlevel:this._zlevelBase,hoverable:!1,style:{x:i[0],y:i[1],r0:n[0]<=10?0:n[0]-10,r:n[1]+10,brushType:"stroke",lineWidth:1,strokeColor:e[l].calculableHolderColor||this.ecTheme.calculableHolderColor}},d.pack(a,e[l],l,void 0,-1),this.setCalculable(a),a=n[0]<=10?new s(a):new o(a),this.shapeList.push(a)),this._buildSinglePie(l),this.buildMark(l)}this.addShapeList()},_buildSinglePie:function(e){for(var t,i=this.series,n=i[e],a=n.data,o=this.component.legend,s=0,r=0,l=0,h=Number.NEGATIVE_INFINITY,d=[],m=0,c=a.length;c>m;m++)t=a[m].name,this.selectedMap[t]=o?o.isSelected(t):!0,this.selectedMap[t]&&!isNaN(a[m].value)&&(0!==+a[m].value?s++:r++,l+=+a[m].value,h=Math.max(h,+a[m].value));if(0!==l){for(var p,u,V,U,g,y,f=100,_=n.clockWise,b=(n.startAngle.toFixed(2)-0+360)%360,x=n.minAngle||.01,k=360-x*s-.01*r,L=n.roseType,m=0,c=a.length;c>m;m++)if(t=a[m].name,this.selectedMap[t]&&!isNaN(a[m].value)){if(u=o?o.getColor(t):this.zr.getColor(m),f=a[m].value/l,p="area"!=L?_?b-f*k-(0!==f?x:.01):f*k+b+(0!==f?x:.01):_?b-360/c:360/c+b,p=p.toFixed(2)-0,f=(100*f).toFixed(2),V=this.parseCenter(this.zr,n.center),U=this.parseRadius(this.zr,n.radius),g=+U[0],y=+U[1],"radius"===L?y=a[m].value/h*(y-g)*.8+.2*(y-g)+g:"area"===L&&(y=Math.sqrt(a[m].value/h)*(y-g)+g),_){var v;v=b,b=p,p=v}this._buildItem(d,e,m,f,a[m].selected,V,g,y,b,p,u),_||(b=p)}this._autoLabelLayout(d,V,y);for(var m=0,c=d.length;c>m;m++)this.shapeList.push(d[m]);d=null}},_buildItem:function(e,t,i,n,a,o,s,r,l,h,m){var c=this.series,p=((h+l)/2+360)%360,u=this.getSector(t,i,n,a,o,s,r,l,h,m);d.pack(u,c[t],t,c[t].data[i],i,c[t].data[i].name,n),e.push(u);var V=this.getLabel(t,i,n,o,p,m,!1),U=this.getLabelLine(t,i,o,s,r,p,m,!1);U&&(d.pack(U,c[t],t,c[t].data[i],i,c[t].data[i].name,n),e.push(U)),V&&(d.pack(V,c[t],t,c[t].data[i],i,c[t].data[i].name,n),V._labelLine=U,e.push(V))},getSector:function(e,t,i,n,a,o,s,l,h,d){var m=this.series,u=m[e],V=u.data[t],U=[V,u],g=this.deepMerge(U,"itemStyle.normal")||{},y=this.deepMerge(U,"itemStyle.emphasis")||{},f=this.getItemStyleColor(g.color,e,t,V)||d,_=this.getItemStyleColor(y.color,e,t,V)||("string"==typeof f?p.lift(f,-.2):f),b={zlevel:this._zlevelBase,clickable:this.deepQuery(U,"clickable"),style:{x:a[0],y:a[1],r0:o,r:s,startAngle:l,endAngle:h,brushType:"both",color:f,lineWidth:g.borderWidth,strokeColor:g.borderColor,lineJoin:"round"},highlightStyle:{color:_,lineWidth:y.borderWidth,strokeColor:y.borderColor,lineJoin:"round"},_seriesIndex:e,_dataIndex:t};if(n){var x=((b.style.startAngle+b.style.endAngle)/2).toFixed(2)-0;b.style._hasSelected=!0,b.style._x=b.style.x,b.style._y=b.style.y;var k=this.query(u,"selectedOffset");b.style.x+=c.cos(x,!0)*k,b.style.y-=c.sin(x,!0)*k,this._selected[e][t]=!0}else this._selected[e][t]=!1;return this._selectedMode&&(b.onclick=this.shapeHandler.onclick),this.deepQuery([V,u,this.option],"calculable")&&(this.setCalculable(b),b.draggable=!0),(this._needLabel(u,V,!0)||this._needLabelLine(u,V,!0))&&(b.onmouseover=this.shapeHandler.onmouseover),b=new r(b)},getLabel:function(e,t,i,n,o,s,r){var l=this.series,h=l[e],d=h.data[t];if(this._needLabel(h,d,r)){var p,u,V,U=r?"emphasis":"normal",g=m.merge(m.clone(d.itemStyle)||{},h.itemStyle),y=g[U].label,f=y.textStyle||{},_=n[0],b=n[1],x=this.parseRadius(this.zr,h.radius),k="middle";y.position=y.position||g.normal.label.position,"center"===y.position?(p=_,u=b,V="center"):"inner"===y.position||"inside"===y.position?(x=(x[0]+x[1])/2,p=Math.round(_+x*c.cos(o,!0)),u=Math.round(b-x*c.sin(o,!0)),s="#fff",V="center"):(x=x[1]- -g[U].labelLine.length,p=Math.round(_+x*c.cos(o,!0)),u=Math.round(b-x*c.sin(o,!0)),V=o>=90&&270>=o?"right":"left"),"center"!=y.position&&"inner"!=y.position&&"inside"!=y.position&&(p+="left"===V?20:-20),d.__labelX=p-("left"===V?5:-5),d.__labelY=u;var L=new a({zlevel:this._zlevelBase+1,hoverable:!1,style:{x:p,y:u,color:f.color||s,text:this.getLabelText(e,t,i,U),textAlign:f.align||V,textBaseline:f.baseline||k,textFont:this.getFont(f)},highlightStyle:{brushType:"fill"}});return L._radius=x,L._labelPosition=y.position||"outer",L._rect=L.getRect(L.style),L._seriesIndex=e,L._dataIndex=t,L}},getLabelText:function(e,t,i,n){var a=this.series,o=a[e],s=o.data[t],r=this.deepQuery([s,o],"itemStyle."+n+".label.formatter");return r?"function"==typeof r?r.call(this.myChart,o.name,s.name,s.value,i):"string"==typeof r?(r=r.replace("{a}","{a0}").replace("{b}","{b0}").replace("{c}","{c0}").replace("{d}","{d0}"),r=r.replace("{a0}",o.name).replace("{b0}",s.name).replace("{c0}",s.value).replace("{d0}",i)):void 0:s.name},getLabelLine:function(e,t,i,n,a,o,s,r){var h=this.series,d=h[e],p=d.data[t];if(this._needLabelLine(d,p,r)){var u=r?"emphasis":"normal",V=m.merge(m.clone(p.itemStyle)||{},d.itemStyle),U=V[u].labelLine,g=U.lineStyle||{},y=i[0],f=i[1],_=a,b=this.parseRadius(this.zr,d.radius)[1]- -U.length,x=c.cos(o,!0),k=c.sin(o,!0);return new l({zlevel:this._zlevelBase+1,hoverable:!1,style:{pointList:[[y+_*x,f-_*k],[y+b*x,f-b*k],[p.__labelX,p.__labelY]],strokeColor:g.color||s,lineType:g.type,lineWidth:g.width},_seriesIndex:e,_dataIndex:t})}},_needLabel:function(e,t,i){return this.deepQuery([t,e],"itemStyle."+(i?"emphasis":"normal")+".label.show")},_needLabelLine:function(e,t,i){return this.deepQuery([t,e],"itemStyle."+(i?"emphasis":"normal")+".labelLine.show")},_autoLabelLayout:function(e,t,i){for(var n=[],a=[],o=0,s=e.length;s>o;o++)("outer"===e[o]._labelPosition||"outside"===e[o]._labelPosition)&&(e[o]._rect._y=e[o]._rect.y,e[o]._rect.xa;a++)if(e[a]._rect.y+=n,e[a].style.y+=n,e[a]._labelLine&&(e[a]._labelLine.style.pointList[1][1]+=n,e[a]._labelLine.style.pointList[2][1]+=n),a>t&&i>a+1&&e[a+1]._rect.y>e[a]._rect.y+e[a]._rect.height)return void o(a,n/2);o(i-1,n/2)}function o(t,i){for(var n=t;n>=0&&(e[n]._rect.y-=i,e[n].style.y-=i,e[n]._labelLine&&(e[n]._labelLine.style.pointList[1][1]-=i,e[n]._labelLine.style.pointList[2][1]-=i),!(n>0&&e[n]._rect.y>e[n-1]._rect.y+e[n-1]._rect.height));n--);}function s(e,t,i,n,a){for(var o,s,r,l=i[0],h=i[1],d=a>0?t?Number.MAX_VALUE:0:t?Number.MAX_VALUE:0,m=0,c=e.length;c>m;m++)s=Math.abs(e[m]._rect.y-h),r=e[m]._radius-n,o=n+r>s?Math.sqrt((n+r+20)*(n+r+20)-Math.pow(e[m]._rect.y-h,2)):Math.abs(e[m]._rect.x+(a>0?0:e[m]._rect.width)-l),t&&o>=d&&(o=d-10),!t&&d>=o&&(o=d+10),e[m]._rect.x=e[m].style.x=l+o*a,e[m]._labelLine.style.pointList[2][0]=l+(o-5)*a,e[m]._labelLine.style.pointList[1][0]=l+(o-20)*a,d=o}e.sort(function(e,t){return e._rect.y-t._rect.y});for(var r,l=0,h=e.length,d=[],m=[],c=0;h>c;c++)r=e[c]._rect.y-l,0>r&&a(c,h,-r,n),l=e[c]._rect.y+e[c]._rect.height;this.zr.getHeight()-l<0&&o(h-1,l-this.zr.getHeight());for(var c=0;h>c;c++)e[c]._rect.y>=t[1]?m.push(e[c]):d.push(e[c]);s(m,!0,t,i,n),s(d,!1,t,i,n)},reformOption:function(e){var t=m.merge;return e=t(e||{},this.ecTheme.pie),e.itemStyle.normal.label.textStyle=t(e.itemStyle.normal.label.textStyle||{},this.ecTheme.textStyle),e.itemStyle.emphasis.label.textStyle=t(e.itemStyle.emphasis.label.textStyle||{},this.ecTheme.textStyle),e},refresh:function(e){e&&(this.option=e,this.series=e.series),this.backupShapeList(),this._buildShape()},addDataAnimation:function(e){for(var t=this.series,i={},n=0,a=e.length;a>n;n++)i[e[n][0]]=e[n];var o={},s={},r={},l=this.shapeList;this.shapeList=[];for(var d,m,c,p={},n=0,a=e.length;a>n;n++)d=e[n][0],m=e[n][2],c=e[n][3],t[d]&&t[d].type===h.CHART_TYPE_PIE&&(m?(c||(o[d+"_"+t[d].data.length]="delete"),p[d]=1):c?p[d]=0:(o[d+"_-1"]="delete",p[d]=-1),this._buildSinglePie(d));for(var u,V,n=0,a=this.shapeList.length;a>n;n++)switch(d=this.shapeList[n]._seriesIndex,u=this.shapeList[n]._dataIndex,V=d+"_"+u,this.shapeList[n].type){case"sector":o[V]=this.shapeList[n];break;case"text":s[V]=this.shapeList[n];break;case"broken-line":r[V]=this.shapeList[n]}this.shapeList=[];for(var U,n=0,a=l.length;a>n;n++)if(d=l[n]._seriesIndex,i[d]){if(u=l[n]._dataIndex+p[d],V=d+"_"+u,U=o[V],!U)continue;if("sector"===l[n].type)"delete"!=U?this.zr.animate(l[n].id,"style").when(400,{startAngle:U.style.startAngle,endAngle:U.style.endAngle}).start():this.zr.animate(l[n].id,"style").when(400,p[d]<0?{startAngle:l[n].style.startAngle}:{endAngle:l[n].style.endAngle}).start();else if("text"===l[n].type||"broken-line"===l[n].type)if("delete"===U)this.zr.delShape(l[n].id);else switch(l[n].type){case"text":U=s[V],this.zr.animate(l[n].id,"style").when(400,{x:U.style.x,y:U.style.y}).start();break;case"broken-line":U=r[V],this.zr.animate(l[n].id,"style").when(400,{pointList:U.style.pointList}).start()}}this.shapeList=l},onclick:function(e){var t=this.series;if(this.isClick&&e.target){this.isClick=!1;for(var i,n=e.target,a=n.style,o=d.get(n,"seriesIndex"),s=d.get(n,"dataIndex"),r=0,l=this.shapeList.length;l>r;r++)if(this.shapeList[r].id===n.id){if(o=d.get(n,"seriesIndex"),s=d.get(n,"dataIndex"),a._hasSelected)n.style.x=n.style._x,n.style.y=n.style._y,n.style._hasSelected=!1,this._selected[o][s]=!1;else{var m=((a.startAngle+a.endAngle)/2).toFixed(2)-0;n.style._hasSelected=!0,this._selected[o][s]=!0,n.style._x=n.style.x,n.style._y=n.style.y,i=this.query(t[o],"selectedOffset"),n.style.x+=c.cos(m,!0)*i,n.style.y-=c.sin(m,!0)*i}this.zr.modShape(n.id,n)}else this.shapeList[r].style._hasSelected&&"single"===this._selectedMode&&(o=d.get(this.shapeList[r],"seriesIndex"),s=d.get(this.shapeList[r],"dataIndex"),this.shapeList[r].style.x=this.shapeList[r].style._x,this.shapeList[r].style.y=this.shapeList[r].style._y,this.shapeList[r].style._hasSelected=!1,this._selected[o][s]=!1,this.zr.modShape(this.shapeList[r].id,this.shapeList[r]));this.messageCenter.dispatch(h.EVENT.PIE_SELECTED,e.event,{selected:this._selected,target:d.get(n,"name")},this.myChart),this.zr.refresh()}}},m.inherits(t,n),m.inherits(t,i),e("../chart").define("pie",t),t});
--------------------------------------------------------------------------------
/smarttable/echarts/chart/radar.js:
--------------------------------------------------------------------------------
1 | define("echarts/chart/radar",["require","../component/base","./base","zrender/shape/Polygon","../component/polar","../config","../util/ecData","zrender/tool/util","zrender/tool/color","../util/accMath","../chart"],function(e){function t(e,t,a,o,s){i.call(this,e,t,a,o,s),n.call(this),this.refresh(o)}var i=e("../component/base"),n=e("./base"),a=e("zrender/shape/Polygon");e("../component/polar");var o=e("../config"),s=e("../util/ecData"),r=e("zrender/tool/util"),l=e("zrender/tool/color");return t.prototype={type:o.CHART_TYPE_RADAR,_buildShape:function(){this.selectedMap={},this._symbol=this.option.symbolList,this._queryTarget,this._dropBoxList=[],this._radarDataCounter=0;for(var e,t=this.series,i=this.component.legend,n=0,a=t.length;a>n;n++)t[n].type===o.CHART_TYPE_RADAR&&(this.serie=this.reformOption(t[n]),this.legendHoverLink=t[n].legendHoverLink||this.legendHoverLink,e=this.serie.name||"",this.selectedMap[e]=i?i.isSelected(e):!0,this.selectedMap[e]&&(this._queryTarget=[this.serie,this.option],this.deepQuery(this._queryTarget,"calculable")&&this._addDropBox(n),this._buildSingleRadar(n),this.buildMark(n)));this.addShapeList()},_buildSingleRadar:function(e){for(var t,i,n,a,o=this.component.legend,s=this.serie.data,r=this.deepQuery(this._queryTarget,"calculable"),l=0;ls;s++)n=null!=t.value[s].value?t.value[s].value:t.value[s],i="-"!=n?o.getVector(e,s,n):!1,i&&a.push(i);return a},_addSymbol:function(e,t,i,n,a){for(var o,r=this.series,l=this.component.polar,h=0,d=e.length;d>h;h++)o=this.getSymbolShape(this.deepMerge([r[n].data[i],r[n]]),n,r[n].data[i].value[h],h,l.getIndicatorText(a,h),e[h][0],e[h][1],this._symbol[this._radarDataCounter%this._symbol.length],t,"#fff","vertical"),o.zlevel=this._zlevelBase+1,s.set(o,"data",r[n].data[i]),s.set(o,"value",r[n].data[i].value),s.set(o,"dataIndex",i),s.set(o,"special",h),this.shapeList.push(o)},_addDataShape:function(e,t,i,n,o,r){var h=this.series,d=[i,this.serie],m=this.getItemStyleColor(this.deepQuery(d,"itemStyle.normal.color"),n,o,i),c=this.deepQuery(d,"itemStyle.normal.lineStyle.width"),p=this.deepQuery(d,"itemStyle.normal.lineStyle.type"),u=this.deepQuery(d,"itemStyle.normal.areaStyle.color"),V=this.deepQuery(d,"itemStyle.normal.areaStyle"),U={zlevel:this._zlevelBase,style:{pointList:e,brushType:V?"both":"stroke",color:u||m||("string"==typeof t?l.alpha(t,.5):t),strokeColor:m||t,lineWidth:c,lineType:p},highlightStyle:{brushType:this.deepQuery(d,"itemStyle.emphasis.areaStyle")||V?"both":"stroke",color:this.deepQuery(d,"itemStyle.emphasis.areaStyle.color")||u||m||("string"==typeof t?l.alpha(t,.5):t),strokeColor:this.getItemStyleColor(this.deepQuery(d,"itemStyle.emphasis.color"),n,o,i)||m||t,lineWidth:this.deepQuery(d,"itemStyle.emphasis.lineStyle.width")||c,lineType:this.deepQuery(d,"itemStyle.emphasis.lineStyle.type")||p}};s.pack(U,h[n],n,i,o,i.name,this.component.polar.getIndicator(h[n].polarIndex)),r&&(U.draggable=!0,this.setCalculable(U)),U=new a(U),this.shapeList.push(U)},_addDropBox:function(e){var t=this.series,i=this.deepQuery(this._queryTarget,"polarIndex");if(!this._dropBoxList[i]){var n=this.component.polar.getDropBox(i);n.zlevel=this._zlevelBase,this.setCalculable(n),s.pack(n,t,e,void 0,-1),this.shapeList.push(n),this._dropBoxList[i]=!0}},ondragend:function(e,t){var i=this.series;if(this.isDragend&&e.target){var n=e.target,a=s.get(n,"seriesIndex"),o=s.get(n,"dataIndex");this.component.legend&&this.component.legend.del(i[a].data[o].name),i[a].data.splice(o,1),t.dragOut=!0,t.needRefresh=!0,this.isDragend=!1}},ondrop:function(t,i){var n=this.series;if(this.isDrop&&t.target){var a,o,r=t.target,l=t.dragged,h=s.get(r,"seriesIndex"),d=s.get(r,"dataIndex"),m=this.component.legend;if(-1===d)a={value:s.get(l,"value"),name:s.get(l,"name")},n[h].data.push(a),m&&m.add(a.name,l.style.color||l.style.strokeColor);else{var c=e("../util/accMath");a=n[h].data[d],m&&m.del(a.name),a.name+=this.option.nameConnector+s.get(l,"name"),o=s.get(l,"value");for(var p=0;ph;h++)t=d.polar2cartesian(r,o*Math.PI/180+s*h),l.push({vector:[t[1],-t[0]]})},_getRadius:function(){var e=this.polar[this._index];return this.parsePercent(e.radius,Math.min(this.zr.getWidth(),this.zr.getHeight())/2)},_buildSpiderWeb:function(e){var t=this.polar[e],i=t.__ecIndicator,n=t.splitArea,a=t.splitLine,o=this.getCenter(e),s=t.splitNumber,r=a.lineStyle.color,l=a.lineStyle.width,h=a.show,d=this.deepQuery(this._queryTarget,"axisLine");this._addArea(i,s,o,n,r,l,h),d.show&&this._addLine(i,o,d)},_addAxisLabel:function(t){for(var i,a,o,s,a,r,l,d,m,c,p=e("../util/accMath"),u=this.polar[t],V=this.deepQuery(this._queryTarget,"indicator"),U=u.__ecIndicator,g=this.deepQuery(this._queryTarget,"splitNumber"),y=this.getCenter(t),f=0;f=_;_+=c+1)s=h.merge({},o),l=p.accAdd(r.min,p.accMul(r.step,_)),s.text=this.numAddCommas(l),s.x=_*a[0]/g+Math.cos(d)*m+y[0],s.y=_*a[1]/g+Math.sin(d)*m+y[1],this.shapeList.push(new n({zlevel:this._zlevelBase,style:s,draggable:!1,hoverable:!1}))}},_buildText:function(e){for(var t,i,a,o,s,r,l,h=this.polar[e],d=h.__ecIndicator,m=this.deepQuery(this._queryTarget,"indicator"),c=this.getCenter(e),p=0,u=0,V=0;V0?"left":Math.round(t[0])<0?"right":"center",o.margin?(r=o.margin,p=t[0]>0?r:-r,u=t[1]>0?r:-r,p=0===t[0]?0:p,u=0===t[1]?0:u,t=this._mapVector(t,c,1)):t=this._mapVector(t,c,1.2),i.textAlign=a,i.x=t[0]+p,i.y=t[1]+u,s=o.rotate?[o.rotate/180*Math.PI,t[0],t[1]]:[0,0,0],this.shapeList.push(new n({zlevel:this._zlevelBase,style:i,draggable:!1,hoverable:!1,rotation:s})))},getIndicatorText:function(e,t){return this.polar[e]&&this.polar[e].__ecIndicator[t]&&this.polar[e].__ecIndicator[t].text},getDropBox:function(e){var t,i,e=e||0,n=this.polar[e],a=this.getCenter(e),o=n.__ecIndicator,s=o.length,r=[],l=n.type;if("polygon"==l){for(var h=0;s>h;h++)t=o[h].vector,r.push(this._mapVector(t,a,1.2));i=this._getShape(r,"fill","rgba(0,0,0,0)","",1)}else"circle"==l&&(i=this._getCircle("",1,1.2,a,"fill","rgba(0,0,0,0)"));return i},_addArea:function(e,t,i,n,a,o,s){for(var r,l,h,d,m=this.deepQuery(this._queryTarget,"type"),c=0;t>c;c++)l=(t-c)/t,s&&("polygon"==m?(d=this._getPointList(e,l,i),r=this._getShape(d,"stroke","",a,o)):"circle"==m&&(r=this._getCircle(a,o,l,i,"stroke")),this.shapeList.push(r)),n.show&&(h=(t-c-1)/t,this._addSplitArea(e,n,l,h,i,c))},_getCircle:function(e,t,i,n,a,o){var r=this._getRadius();return new s({zlevel:this._zlevelBase,style:{x:n[0],y:n[1],r:r*i,brushType:a,strokeColor:e,lineWidth:t,color:o},hoverable:!1,draggable:!1})},_getRing:function(e,t,i,n){var a=this._getRadius();return new r({zlevel:this._zlevelBase,style:{x:n[0],y:n[1],r:t*a,r0:i*a,color:e,brushType:"fill"},hoverable:!1,draggable:!1})},_getPointList:function(e,t,i){for(var n,a=[],o=e.length,s=0;o>s;s++)n=e[s].vector,a.push(this._mapVector(n,i,t));return a},_getShape:function(e,t,i,n,a){return new o({zlevel:this._zlevelBase,style:{pointList:e,brushType:t,color:i,strokeColor:n,lineWidth:a},hoverable:!1,draggable:!1})},_addSplitArea:function(e,t,i,n,a,o){var s,r,l,h,d,m=e.length,c=t.areaStyle.color,p=[],m=e.length,u=this.deepQuery(this._queryTarget,"type");if("string"==typeof c&&(c=[c]),r=c.length,s=c[o%r],"polygon"==u)for(var V=0;m>V;V++)p=[],l=e[V].vector,h=e[(V+1)%m].vector,p.push(this._mapVector(l,a,i)),p.push(this._mapVector(l,a,n)),p.push(this._mapVector(h,a,n)),p.push(this._mapVector(h,a,i)),d=this._getShape(p,"fill",s,"",1),this.shapeList.push(d);else"circle"==u&&(d=this._getRing(s,i,n,a),this.shapeList.push(d))},_mapVector:function(e,t,i){return[e[0]*i+t[0],e[1]*i+t[1]]},getCenter:function(e){var e=e||0;return this.parseCenter(this.zr,this.polar[e].center)},_addLine:function(e,t,i){for(var n,a,o=e.length,s=i.lineStyle,r=s.color,l=s.width,h=s.type,d=0;o>d;d++)a=e[d].vector,n=this._getLine(t[0],t[1],a[0]+t[0],a[1]+t[1],r,l,h),this.shapeList.push(n)},_getLine:function(e,t,i,n,o,s,r){return new a({zlevel:this._zlevelBase,style:{xStart:e,yStart:t,xEnd:i,yEnd:n,strokeColor:o,lineWidth:s,lineType:r},hoverable:!1})},_adjustIndicatorValue:function(t){for(var i,n,a=this.polar[t],o=this.deepQuery(this._queryTarget,"indicator"),s=o.length,r=a.__ecIndicator,l=this._getSeriesData(t),h=a.boundaryGap,d=a.splitNumber,m=a.scale,c=e("../util/smartSteps"),p=0;s>p;p++){if("number"==typeof o[p].max)i=o[p].max,n=o[p].min||0;else{var u=this._findValue(l,p,d,h);n=u.min,i=u.max}!m&&n>=0&&i>=0&&(n=0),!m&&0>=n&&0>=i&&(i=0);var V=c(n,i,d);r[p].value={min:V.min,max:V.max,step:V.step}}},_getSeriesData:function(e){for(var t,i,n,a=[],o=this.component.legend,s=0;so||void 0===o)&&(o=e),(s>e||void 0===s)&&(s=e)}var o,s,r,l;if(e&&0!==e.length){if(1==e.length&&(s=0),1!=e.length)for(var h=0;h0?s=o/i:o/=i),{max:o,min:s}}},getVector:function(e,t,i){e=e||0,t=t||0;var n=this.polar[e].__ecIndicator;if(!(t>=n.length)){var a,o=this.polar[e].__ecIndicator[t],s=this.getCenter(e),r=o.vector,l=o.value.max,h=o.value.min;if("undefined"==typeof i)return s;switch(i){case"min":i=h;break;case"max":i=l;break;case"center":i=(l+h)/2}return a=l!=h?(i-h)/(l-h):.5,this._mapVector(r,s,a)}},isInside:function(e){var t=this.getNearestIndex(e);return t?t.polarIndex:-1},getNearestIndex:function(e){for(var t,i,n,a,o,s,r,l,h,m=0;ma[0])return{polarIndex:m,valueIndex:Math.floor((h+l/2)/l)%r}}},getIndicator:function(e){var e=e||0;return this.polar[e].indicator},refresh:function(e){e&&(this.option=e,this.polar=this.option.polar,this.series=this.option.series),this.clear(),this._buildShape()}},h.inherits(t,i),e("../component").define("polar",t),t}),define("echarts/util/coordinates",["require","zrender/tool/math"],function(e){function t(e,t){return[e*n.sin(t),e*n.cos(t)]}function i(e,t){return[Math.sqrt(e*e+t*t),Math.atan(t/e)]}var n=e("zrender/tool/math");return{polar2cartesian:t,cartesian2polar:i}});
--------------------------------------------------------------------------------
/smarttable/echarts/chart/scatter.js:
--------------------------------------------------------------------------------
1 | define("echarts/chart/scatter",["require","../component/base","./base","../util/shape/Symbol","../component/axis","../component/grid","../component/dataZoom","../component/dataRange","../config","zrender/tool/util","zrender/tool/color","../chart"],function(e){function t(e,t,a,o,s){i.call(this,e,t,a,o,s),n.call(this),this.refresh(o)}var i=e("../component/base"),n=e("./base"),a=e("../util/shape/Symbol");e("../component/axis"),e("../component/grid"),e("../component/dataZoom"),e("../component/dataRange");var o=e("../config"),s=e("zrender/tool/util"),r=e("zrender/tool/color");return t.prototype={type:o.CHART_TYPE_SCATTER,_buildShape:function(){var e=this.series;this._sIndex2ColorMap={},this._symbol=this.option.symbolList,this._sIndex2ShapeMap={},this.selectedMap={},this.xMarkMap={};for(var t,i,n,a,s=this.component.legend,l=[],h=0,d=e.length;d>h;h++)if(t=e[h],i=t.name,t.type===o.CHART_TYPE_SCATTER){if(e[h]=this.reformOption(e[h]),this.legendHoverLink=e[h].legendHoverLink||this.legendHoverLink,this._sIndex2ShapeMap[h]=this.query(t,"symbol")||this._symbol[h%this._symbol.length],s){if(this.selectedMap[i]=s.isSelected(i),this._sIndex2ColorMap[h]=r.alpha(s.getColor(i),.5),n=s.getItemShape(i)){var a=this._sIndex2ShapeMap[h];n.style.brushType=a.match("empty")?"stroke":"both",a=a.replace("empty","").toLowerCase(),a.match("rectangle")&&(n.style.x+=Math.round((n.style.width-n.style.height)/2),n.style.width=n.style.height),a.match("star")&&(n.style.n=a.replace("star","")-0||5,a="star"),a.match("image")&&(n.style.image=a.replace(new RegExp("^image:\\/\\/"),""),n.style.x+=Math.round((n.style.width-n.style.height)/2),n.style.width=n.style.height,a="image"),n.style.iconType=a,s.setItemShape(i,n)}}else this.selectedMap[i]=!0,this._sIndex2ColorMap[h]=r.alpha(this.zr.getColor(h),.5);this.selectedMap[i]&&l.push(h)}this._buildSeries(l),this.addShapeList()},_buildSeries:function(e){if(0!==e.length){for(var t,i,n,a,o,s,r,l,h=this.series,d={},m=0,c=e.length;c>m;m++)if(t=e[m],i=h[t],0!==i.data.length){o=this.component.xAxis.getAxis(i.xAxisIndex||0),s=this.component.yAxis.getAxis(i.yAxisIndex||0),d[t]=[];for(var p=0,u=i.data.length;u>p;p++)n=i.data[p],a=null!=n?null!=n.value?n.value:n:"-","-"===a||a.length<2||(r=o.getCoord(a[0]),l=s.getCoord(a[1]),d[t].push([r,l,p,n.name||""]));this.xMarkMap[t]=this._markMap(o,s,i.data,d[t]),this.buildMark(t)}this._buildPointList(d)}},_markMap:function(e,t,i,n){for(var a,o={min0:Number.POSITIVE_INFINITY,max0:Number.NEGATIVE_INFINITY,sum0:0,counter0:0,average0:0,min1:Number.POSITIVE_INFINITY,max1:Number.NEGATIVE_INFINITY,sum1:0,counter1:0,average1:0},s=0,r=n.length;r>s;s++)a=i[n[s][2]].value||i[n[s][2]],o.min0>a[0]&&(o.min0=a[0],o.minY0=n[s][1],o.minX0=n[s][0]),o.max0a[1]&&(o.min1=a[1],o.minY1=n[s][1],o.minX1=n[s][0]),o.max1 t.largeThreshold)this.shapeList.push(this._getLargeSymbol(i,this.getItemStyleColor(this.query(t,"itemStyle.normal.color"),s,-1)||this._sIndex2ColorMap[s]));else for(var r=0,l=i.length;l>r;r++)n=i[r],a=this._getSymbol(s,n[2],n[3],n[0],n[1]),a&&this.shapeList.push(a)},_getSymbol:function(e,t,i,n,a){var o,s=this.series,r=s[e],l=r.data[t],h=this.component.dataRange;if(h){if(o=isNaN(l[2])?this._sIndex2ColorMap[e]:h.getColor(l[2]),!o)return null}else o=this._sIndex2ColorMap[e];var d=this.getSymbolShape(r,e,l,t,i,n,a,this._sIndex2ShapeMap[e],o,"rgba(0,0,0,0)","vertical");return d.zlevel=this._zlevelBase,d._main=!0,d},_getLargeSymbol:function(e,t){return new a({zlevel:this._zlevelBase,_main:!0,hoverable:!1,style:{pointList:e,color:t,strokeColor:t},highlightStyle:{pointList:[]}})},getMarkCoord:function(e,t){var i,n=this.series[e],a=this.xMarkMap[e],o=this.component.xAxis.getAxis(n.xAxisIndex),s=this.component.yAxis.getAxis(n.yAxisIndex);if(!t.type||"max"!==t.type&&"min"!==t.type&&"average"!==t.type)i=["string"!=typeof t.xAxis&&o.getCoordByIndex?o.getCoordByIndex(t.xAxis||0):o.getCoord(t.xAxis||0),"string"!=typeof t.yAxis&&s.getCoordByIndex?s.getCoordByIndex(t.yAxis||0):s.getCoord(t.yAxis||0)];else{var r=null!=t.valueIndex?t.valueIndex:1;i=[a[t.type+"X"+r],a[t.type+"Y"+r],a[t.type+"Line"+r],a[t.type+r]]}return i},refresh:function(e){e&&(this.option=e,this.series=e.series),this.backupShapeList(),this._buildShape()},ondataRange:function(e,t){this.component.dataRange&&(this.refresh(),t.needRefresh=!0)}},s.inherits(t,n),s.inherits(t,i),e("../chart").define("scatter",t),t}),define("echarts/component/dataRange",["require","./base","zrender/shape/Text","zrender/shape/Rectangle","../util/shape/HandlePolygon","../config","zrender/tool/util","zrender/tool/event","zrender/tool/area","zrender/tool/color","../component"],function(e){function t(e,t,n,a,o){if("undefined"==typeof this.query(a,"dataRange.min")||"undefined"==typeof this.query(a,"dataRange.max"))return void console.error("option.dataRange.min or option.dataRange.max has not been defined.");i.call(this,e,t,n,a,o);var r=this;r._ondrift=function(e,t){return r.__ondrift(this,e,t)},r._ondragend=function(){return r.__ondragend()},r._dataRangeSelected=function(e){return r.__dataRangeSelected(e)},r._dispatchHoverLink=function(e){return r.__dispatchHoverLink(e)},r._onhoverlink=function(e){return r.__onhoverlink(e)},this._selectedMap={},this._range={},this.refresh(a),t.bind(s.EVENT.HOVER,this._onhoverlink)}var i=e("./base"),n=e("zrender/shape/Text"),a=e("zrender/shape/Rectangle"),o=e("../util/shape/HandlePolygon"),s=e("../config"),r=e("zrender/tool/util"),l=e("zrender/tool/event"),h=e("zrender/tool/area"),d=e("zrender/tool/color");return t.prototype={type:s.COMPONENT_TYPE_DATARANGE,_textGap:10,_buildShape:function(){if(this._itemGroupLocation=this._getItemGroupLocation(),this._buildBackground(),this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?this._buildGradient():this._buildItem(),this.dataRangeOption.show)for(var e=0,t=this.shapeList.length;t>e;e++)this.zr.addShape(this.shapeList[e]);this._syncShapeFromRange()},_buildItem:function(){var e,t,i,o,s=this._valueTextList,r=s.length,l=this.getFont(this.dataRangeOption.textStyle),d=this._itemGroupLocation.x,m=this._itemGroupLocation.y,c=this.dataRangeOption.itemWidth,p=this.dataRangeOption.itemHeight,u=this.dataRangeOption.itemGap,V=h.getTextHeight("国",l);"vertical"==this.dataRangeOption.orient&&"right"==this.dataRangeOption.x&&(d=this._itemGroupLocation.x+this._itemGroupLocation.width-c);var U=!0;this.dataRangeOption.text&&(U=!1,this.dataRangeOption.text[0]&&(i=this._getTextShape(d,m,this.dataRangeOption.text[0]),"horizontal"==this.dataRangeOption.orient?d+=h.getTextWidth(this.dataRangeOption.text[0],l)+this._textGap:(m+=V+this._textGap,i.style.y+=V/2+this._textGap,i.style.textBaseline="bottom"),this.shapeList.push(new n(i))));for(var g=0;r>g;g++)e=s[g],o=this.getColorByIndex(g),t=this._getItemShape(d,m,c,p,this._selectedMap[g]?o:"#ccc"),t._idx=g,t.onmousemove=this._dispatchHoverLink,t.onclick=this._dataRangeSelected,this.shapeList.push(new a(t)),U&&(i={zlevel:this._zlevelBase,style:{x:d+c+5,y:m,color:this._selectedMap[g]?this.dataRangeOption.textStyle.color:"#ccc",text:s[g],textFont:l,textBaseline:"top"},highlightStyle:{brushType:"fill"},clickable:!0},"vertical"==this.dataRangeOption.orient&&"right"==this.dataRangeOption.x&&(i.style.x-=c+10,i.style.textAlign="right"),i._idx=g,i.onclick=this._dataRangeSelected,this.shapeList.push(new n(i))),"horizontal"==this.dataRangeOption.orient?d+=c+(U?5:0)+(U?h.getTextWidth(e,l):0)+u:m+=p+u;!U&&this.dataRangeOption.text[1]&&("horizontal"==this.dataRangeOption.orient?d=d-u+this._textGap:m=m-u+this._textGap,i=this._getTextShape(d,m,this.dataRangeOption.text[1]),"horizontal"!=this.dataRangeOption.orient&&(i.style.y-=5,i.style.textBaseline="top"),this.shapeList.push(new n(i)))},_buildGradient:function(){var t,i,o=this.getFont(this.dataRangeOption.textStyle),s=this._itemGroupLocation.x,r=this._itemGroupLocation.y,l=this.dataRangeOption.itemWidth,d=this.dataRangeOption.itemHeight,m=h.getTextHeight("国",o),c=!0;this.dataRangeOption.text&&(c=!1,this.dataRangeOption.text[0]&&(i=this._getTextShape(s,r,this.dataRangeOption.text[0]),"horizontal"==this.dataRangeOption.orient?s+=h.getTextWidth(this.dataRangeOption.text[0],o)+this._textGap:(r+=m+this._textGap,i.style.y+=m/2+this._textGap,i.style.textBaseline="bottom"),this.shapeList.push(new n(i))));for(var p=e("zrender/tool/color"),u=1/(this.dataRangeOption.color.length-1),V=[],U=0,g=this.dataRangeOption.color.length;g>U;U++)V.push([U*u,this.dataRangeOption.color[U]]);"horizontal"==this.dataRangeOption.orient?(t={zlevel:this._zlevelBase,style:{x:s,y:r,width:10*l,height:d,color:p.getLinearGradient(s,r,s+10*l,r,V)},hoverable:!1},s+=10*l+this._textGap):(t={zlevel:this._zlevelBase,style:{x:s,y:r,width:l,height:10*d,color:p.getLinearGradient(s,r,s,r+10*d,V)},hoverable:!1},r+=10*d+this._textGap),this.shapeList.push(new a(t)),this._calculableLocation=t.style,this.dataRangeOption.calculable&&(this._buildFiller(),this._bulidMask(),this._bulidHandle()),this._buildIndicator(),!c&&this.dataRangeOption.text[1]&&(i=this._getTextShape(s,r,this.dataRangeOption.text[1]),this.shapeList.push(new n(i)))},_buildIndicator:function(){var e,t,i=this._calculableLocation.x,n=this._calculableLocation.y,a=this._calculableLocation.width,s=this._calculableLocation.height,r=5;"horizontal"==this.dataRangeOption.orient?"bottom"!=this.dataRangeOption.y?(e=[[i,n+s],[i-r,n+s+r],[i+r,n+s+r]],t="bottom"):(e=[[i,n],[i-r,n-r],[i+r,n-r]],t="top"):"right"!=this.dataRangeOption.x?(e=[[i+a,n],[i+a+r,n-r],[i+a+r,n+r]],t="right"):(e=[[i,n],[i-r,n-r],[i-r,n+r]],t="left"),this._indicatorShape={style:{pointList:e,color:"#fff",__rect:{x:Math.min(e[0][0],e[1][0]),y:Math.min(e[0][1],e[1][1]),width:r*("horizontal"==this.dataRangeOption.orient?2:1),height:r*("horizontal"==this.dataRangeOption.orient?1:2)}},highlightStyle:{brushType:"fill",textPosition:t,textColor:this.dataRangeOption.textStyle.color},hoverable:!1},this._indicatorShape=new o(this._indicatorShape)},_buildFiller:function(){this._fillerShape={zlevel:this._zlevelBase+1,style:{x:this._calculableLocation.x,y:this._calculableLocation.y,width:this._calculableLocation.width,height:this._calculableLocation.height,color:"rgba(255,255,255,0)"},highlightStyle:{strokeColor:"rgba(255,255,255,0.5)",lineWidth:1},draggable:!0,ondrift:this._ondrift,ondragend:this._ondragend,onmousemove:this._dispatchHoverLink,_type:"filler"},this._fillerShape=new a(this._fillerShape),this.shapeList.push(this._fillerShape)},_bulidHandle:function(){var e,t,i,n,a,s,r,l,d=this._calculableLocation.x,m=this._calculableLocation.y,c=this._calculableLocation.width,p=this._calculableLocation.height,u=this.getFont(this.dataRangeOption.textStyle),V=h.getTextHeight("国",u),U=Math.max(h.getTextWidth(this._textFormat(this.dataRangeOption.max),u),h.getTextWidth(this._textFormat(this.dataRangeOption.min),u))+2;"horizontal"==this.dataRangeOption.orient?"bottom"!=this.dataRangeOption.y?(e=[[d,m],[d,m+p+V],[d-V,m+p+V],[d-1,m+p],[d-1,m]],t=d-U/2-V,i=m+p+V/2+2,n={x:d-U-V,y:m+p,width:U+V,height:V},a=[[d+c,m],[d+c,m+p+V],[d+c+V,m+p+V],[d+c+1,m+p],[d+c+1,m]],s=d+c+U/2+V,r=i,l={x:d+c,y:m+p,width:U+V,height:V}):(e=[[d,m+p],[d,m-V],[d-V,m-V],[d-1,m],[d-1,m+p]],t=d-U/2-V,i=m-V/2-2,n={x:d-U-V,y:m-V,width:U+V,height:V},a=[[d+c,m+p],[d+c,m-V],[d+c+V,m-V],[d+c+1,m],[d+c+1,m+p]],s=d+c+U/2+V,r=i,l={x:d+c,y:m-V,width:U+V,height:V}):(U+=V,"right"!=this.dataRangeOption.x?(e=[[d,m],[d+c+V,m],[d+c+V,m-V],[d+c,m-1],[d,m-1]],t=d+c+U/2+V/2,i=m-V/2,n={x:d+c,y:m-V,width:U+V,height:V},a=[[d,m+p],[d+c+V,m+p],[d+c+V,m+V+p],[d+c,m+1+p],[d,m+p+1]],s=t,r=m+p+V/2,l={x:d+c,y:m+p,width:U+V,height:V}):(e=[[d+c,m],[d-V,m],[d-V,m-V],[d,m-1],[d+c,m-1]],t=d-U/2-V/2,i=m-V/2,n={x:d-U-V,y:m-V,width:U+V,height:V},a=[[d+c,m+p],[d-V,m+p],[d-V,m+V+p],[d,m+1+p],[d+c,m+p+1]],s=t,r=m+p+V/2,l={x:d-U-V,y:m+p,width:U+V,height:V})),this._startShape={style:{pointList:e,text:this._textFormat(this.dataRangeOption.max),textX:t,textY:i,color:this.getColor(this.dataRangeOption.max),rect:n,x:e[0][0],y:e[0][1],_x:e[0][0],_y:e[0][1]}},this._startShape.highlightStyle={strokeColor:this._startShape.style.color,lineWidth:1},this._endShape={style:{pointList:a,text:this._textFormat(this.dataRangeOption.min),textX:s,textY:r,color:this.getColor(this.dataRangeOption.min),rect:l,x:a[0][0],y:a[0][1],_x:a[0][0],_y:a[0][1]}},this._endShape.highlightStyle={strokeColor:this._endShape.style.color,lineWidth:1},this._startShape.zlevel=this._endShape.zlevel=this._zlevelBase+1,this._startShape.draggable=this._endShape.draggable=!0,this._startShape.ondrift=this._endShape.ondrift=this._ondrift,this._startShape.ondragend=this._endShape.ondragend=this._ondragend,this._startShape.style.textColor=this._endShape.style.textColor=this.dataRangeOption.textStyle.color,this._startShape.style.textAlign=this._endShape.style.textAlign="center",this._startShape.style.textPosition=this._endShape.style.textPosition="specific",this._startShape.style.textBaseline=this._endShape.style.textBaseline="middle",this._startShape.style.width=this._endShape.style.width=0,this._startShape.style.height=this._endShape.style.height=0,this._startShape.style.textPosition=this._endShape.style.textPosition="specific",this._startShape=new o(this._startShape),this._endShape=new o(this._endShape),this.shapeList.push(this._startShape),this.shapeList.push(this._endShape)},_bulidMask:function(){var e=this._calculableLocation.x,t=this._calculableLocation.y,i=this._calculableLocation.width,n=this._calculableLocation.height;this._startMask={zlevel:this._zlevelBase+1,style:{x:e,y:t,width:"horizontal"==this.dataRangeOption.orient?0:i,height:"horizontal"==this.dataRangeOption.orient?n:0,color:"#ccc"},hoverable:!1},this._endMask={zlevel:this._zlevelBase+1,style:{x:"horizontal"==this.dataRangeOption.orient?e+i:e,y:"horizontal"==this.dataRangeOption.orient?t:t+n,width:"horizontal"==this.dataRangeOption.orient?0:i,height:"horizontal"==this.dataRangeOption.orient?n:0,color:"#ccc"},hoverable:!1},this._startMask=new a(this._startMask),this._endMask=new a(this._endMask),this.shapeList.push(this._startMask),this.shapeList.push(this._endMask)},_buildBackground:function(){var e=this.reformCssArray(this.dataRangeOption.padding);this.shapeList.push(new a({zlevel:this._zlevelBase,hoverable:!1,style:{x:this._itemGroupLocation.x-e[3],y:this._itemGroupLocation.y-e[0],width:this._itemGroupLocation.width+e[3]+e[1],height:this._itemGroupLocation.height+e[0]+e[2],brushType:0===this.dataRangeOption.borderWidth?"fill":"both",color:this.dataRangeOption.backgroundColor,strokeColor:this.dataRangeOption.borderColor,lineWidth:this.dataRangeOption.borderWidth}}))},_getItemGroupLocation:function(){var e=this._valueTextList,t=e.length,i=this.dataRangeOption.itemGap,n=this.dataRangeOption.itemWidth,a=this.dataRangeOption.itemHeight,o=0,s=0,r=this.getFont(this.dataRangeOption.textStyle),l=h.getTextHeight("国",r);if("horizontal"==this.dataRangeOption.orient){if(this.dataRangeOption.text||this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable)o=(this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?10*n+i:t*(n+i))+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[0]?h.getTextWidth(this.dataRangeOption.text[0],r)+this._textGap:0)+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[1]?h.getTextWidth(this.dataRangeOption.text[1],r)+this._textGap:0);else{n+=5;for(var d=0;t>d;d++)o+=n+h.getTextWidth(e[d],r)+i}o-=i,s=Math.max(l,a)}else{var m;if(this.dataRangeOption.text||this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable)s=(this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?10*a+i:t*(a+i))+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[0]?this._textGap+l:0)+(this.dataRangeOption.text&&"undefined"!=typeof this.dataRangeOption.text[1]?this._textGap+l:0),m=Math.max(h.getTextWidth(this.dataRangeOption.text&&this.dataRangeOption.text[0]||"",r),h.getTextWidth(this.dataRangeOption.text&&this.dataRangeOption.text[1]||"",r)),o=Math.max(n,m);else{s=(a+i)*t,n+=5,m=0;for(var d=0;t>d;d++)m=Math.max(m,h.getTextWidth(e[d],r));o=n+m}s-=i}var c,p=this.reformCssArray(this.dataRangeOption.padding),u=this.zr.getWidth();switch(this.dataRangeOption.x){case"center":c=Math.floor((u-o)/2);break;case"left":c=p[3]+this.dataRangeOption.borderWidth;break;case"right":c=u-o-p[1]-this.dataRangeOption.borderWidth;break;default:c=this.parsePercent(this.dataRangeOption.x,u),c=isNaN(c)?0:c}var V,U=this.zr.getHeight();switch(this.dataRangeOption.y){case"top":V=p[0]+this.dataRangeOption.borderWidth;break;case"bottom":V=U-s-p[2]-this.dataRangeOption.borderWidth;break;case"center":V=Math.floor((U-s)/2);break;default:V=this.parsePercent(this.dataRangeOption.y,U),V=isNaN(V)?0:V}if(this.dataRangeOption.calculable){var g=Math.max(h.getTextWidth(this.dataRangeOption.max,r),h.getTextWidth(this.dataRangeOption.min,r))+l;"horizontal"==this.dataRangeOption.orient?(g>c&&(c=g),c+o+g>u&&(c-=g)):(l>V&&(V=l),V+s+l>U&&(V-=l))}return{x:c,y:V,width:o,height:s}},_getTextShape:function(e,t,i){return{zlevel:this._zlevelBase,style:{x:"horizontal"==this.dataRangeOption.orient?e:this._itemGroupLocation.x+this._itemGroupLocation.width/2,y:"horizontal"==this.dataRangeOption.orient?this._itemGroupLocation.y+this._itemGroupLocation.height/2:t,color:this.dataRangeOption.textStyle.color,text:i,textFont:this.getFont(this.dataRangeOption.textStyle),textBaseline:"horizontal"==this.dataRangeOption.orient?"middle":"top",textAlign:"horizontal"==this.dataRangeOption.orient?"left":"center"},hoverable:!1}},_getItemShape:function(e,t,i,n,a){return{zlevel:this._zlevelBase,style:{x:e,y:t+1,width:i,height:n-2,color:a},highlightStyle:{strokeColor:a,lineWidth:1},clickable:!0}},__ondrift:function(e,t,i){var n=this._calculableLocation.x,a=this._calculableLocation.y,o=this._calculableLocation.width,s=this._calculableLocation.height;return"horizontal"==this.dataRangeOption.orient?e.style.x+t<=n?e.style.x=n:e.style.x+t+e.style.width>=n+o?e.style.x=n+o-e.style.width:e.style.x+=t:e.style.y+i<=a?e.style.y=a:e.style.y+i+e.style.height>=a+s?e.style.y=a+s-e.style.height:e.style.y+=i,"filler"==e._type?this._syncHandleShape():this._syncFillerShape(e),this.dataRangeOption.realtime&&this._syncData(),!0},__ondragend:function(){this.isDragend=!0},ondragend:function(e,t){this.isDragend&&e.target&&(!this.dataRangeOption.realtime&&this._syncData(),t.dragOut=!0,t.dragIn=!0,this.dataRangeOption.realtime||this.messageCenter.dispatch(s.EVENT.DATA_RANGE,null,{range:{start:this._range.end,end:this._range.start}},this.myChart),t.needRefresh=!1,this.isDragend=!1)},_syncShapeFromRange:function(){var e=this.dataRangeOption.range||{};if(this._range.end="undefined"!=typeof this._range.end?this._range.end:"undefined"!=typeof e.start?e.start:0,this._range.start="undefined"!=typeof this._range.start?this._range.start:"undefined"!=typeof e.end?e.end:100,100!=this._range.start||0!==this._range.end){if("horizontal"==this.dataRangeOption.orient){var t=this._fillerShape.style.width;this._fillerShape.style.x+=t*(100-this._range.start)/100,this._fillerShape.style.width=t*(this._range.start-this._range.end)/100}else{var i=this._fillerShape.style.height;this._fillerShape.style.y+=i*(100-this._range.start)/100,this._fillerShape.style.height=i*(this._range.start-this._range.end)/100}this.zr.modShape(this._fillerShape.id),this._syncHandleShape()}},_syncHandleShape:function(){var e=this._calculableLocation.x,t=this._calculableLocation.y,i=this._calculableLocation.width,n=this._calculableLocation.height;"horizontal"==this.dataRangeOption.orient?(this._startShape.style.x=this._fillerShape.style.x,this._startMask.style.width=this._startShape.style.x-e,this._endShape.style.x=this._fillerShape.style.x+this._fillerShape.style.width,this._endMask.style.x=this._endShape.style.x,this._endMask.style.width=e+i-this._endShape.style.x,this._range.start=Math.ceil(100-(this._startShape.style.x-e)/i*100),this._range.end=Math.floor(100-(this._endShape.style.x-e)/i*100)):(this._startShape.style.y=this._fillerShape.style.y,this._startMask.style.height=this._startShape.style.y-t,this._endShape.style.y=this._fillerShape.style.y+this._fillerShape.style.height,this._endMask.style.y=this._endShape.style.y,this._endMask.style.height=t+n-this._endShape.style.y,this._range.start=Math.ceil(100-(this._startShape.style.y-t)/n*100),this._range.end=Math.floor(100-(this._endShape.style.y-t)/n*100)),this._syncShape()},_syncFillerShape:function(e){var t,i,n=this._calculableLocation.x,a=this._calculableLocation.y,o=this._calculableLocation.width,s=this._calculableLocation.height;"horizontal"==this.dataRangeOption.orient?(t=this._startShape.style.x,i=this._endShape.style.x,e.id==this._startShape.id&&t>=i?(i=t,this._endShape.style.x=t):e.id==this._endShape.id&&t>=i&&(t=i,this._startShape.style.x=t),this._fillerShape.style.x=t,this._fillerShape.style.width=i-t,this._startMask.style.width=t-n,this._endMask.style.x=i,this._endMask.style.width=n+o-i,this._range.start=Math.ceil(100-(t-n)/o*100),this._range.end=Math.floor(100-(i-n)/o*100)):(t=this._startShape.style.y,i=this._endShape.style.y,e.id==this._startShape.id&&t>=i?(i=t,this._endShape.style.y=t):e.id==this._endShape.id&&t>=i&&(t=i,this._startShape.style.y=t),this._fillerShape.style.y=t,this._fillerShape.style.height=i-t,this._startMask.style.height=t-a,this._endMask.style.y=i,this._endMask.style.height=a+s-i,this._range.start=Math.ceil(100-(t-a)/s*100),this._range.end=Math.floor(100-(i-a)/s*100)),this._syncShape()},_syncShape:function(){this._startShape.position=[this._startShape.style.x-this._startShape.style._x,this._startShape.style.y-this._startShape.style._y],this._startShape.style.text=this._textFormat(this._gap*this._range.start+this.dataRangeOption.min),this._startShape.style.color=this._startShape.highlightStyle.strokeColor=this.getColor(this._gap*this._range.start+this.dataRangeOption.min),this._endShape.position=[this._endShape.style.x-this._endShape.style._x,this._endShape.style.y-this._endShape.style._y],this._endShape.style.text=this._textFormat(this._gap*this._range.end+this.dataRangeOption.min),this._endShape.style.color=this._endShape.highlightStyle.strokeColor=this.getColor(this._gap*this._range.end+this.dataRangeOption.min),this.zr.modShape(this._startShape.id),this.zr.modShape(this._endShape.id),this.zr.modShape(this._startMask.id),this.zr.modShape(this._endMask.id),this.zr.modShape(this._fillerShape.id),this.zr.refresh()},_syncData:function(){this.dataRangeOption.realtime&&this.messageCenter.dispatch(s.EVENT.DATA_RANGE,null,{range:{start:this._range.end,end:this._range.start}},this.myChart)},__dataRangeSelected:function(e){var t=e.target._idx;this._selectedMap[t]=!this._selectedMap[t],this.messageCenter.dispatch(s.EVENT.REFRESH,null,null,this.myChart)},__dispatchHoverLink:function(e){var t,i;if(this.dataRangeOption.calculable){var n,a=this.dataRangeOption.max-this.dataRangeOption.min;n="horizontal"==this.dataRangeOption.orient?(1-(l.getX(e.event)-this._calculableLocation.x)/this._calculableLocation.width)*a:(1-(l.getY(e.event)-this._calculableLocation.y)/this._calculableLocation.height)*a,t=n-.05*a,i=n+.05*a}else{var o=e.target._idx;i=(this._colorList.length-o)*this._gap+this.dataRangeOption.min,t=i-this._gap}this.messageCenter.dispatch(s.EVENT.DATA_RANGE_HOVERLINK,e.event,{valueMin:t,valueMax:i},this.myChart)},__onhoverlink:function(e){if(this.dataRangeOption.show&&this.dataRangeOption.hoverLink&&this._indicatorShape&&e&&null!=e.seriesIndex&&null!=e.dataIndex){var t=e.value;if(isNaN(t))return;tthis.dataRangeOption.max&&(t=this.dataRangeOption.max),this._indicatorShape.position="horizontal"==this.dataRangeOption.orient?[(this.dataRangeOption.max-t)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._calculableLocation.width,0]:[0,(this.dataRangeOption.max-t)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._calculableLocation.height],this._indicatorShape.style.text=e.value,this._indicatorShape.style.color=this.getColor(t),this.zr.addHoverShape(this._indicatorShape)}},_textFormat:function(e,t){if(e=e.toFixed(this.dataRangeOption.precision),t="undefined"!=typeof t?t.toFixed(this.dataRangeOption.precision):"",this.dataRangeOption.formatter){if("string"==typeof this.dataRangeOption.formatter)return this.dataRangeOption.formatter.replace("{value}",e).replace("{value2}",t);if("function"==typeof this.dataRangeOption.formatter)return this.dataRangeOption.formatter.call(this.myChart,e,t)}return""!==t?e+" - "+t:e},refresh:function(e){if(e){this.option=e,this.option.dataRange=this.reformOption(this.option.dataRange),this.dataRangeOption=this.option.dataRange,this.myChart.canvasSupported||(this.dataRangeOption.realtime=!1);var t=this.dataRangeOption.splitNumber<=0||this.dataRangeOption.calculable?100:this.dataRangeOption.splitNumber;if(this._colorList=d.getGradientColors(this.dataRangeOption.color,Math.max((t-this.dataRangeOption.color.length)/(this.dataRangeOption.color.length-1),0)+1),this._colorList.length>t){for(var i=this._colorList.length,n=[this._colorList[0]],a=i/(t-1),o=1;t-1>o;o++)n.push(this._colorList[Math.floor(o*a)]);n.push(this._colorList[i-1]),this._colorList=n}var s=this.dataRangeOption.precision;for(this._gap=(this.dataRangeOption.max-this.dataRangeOption.min)/t;this._gap.toFixed(s)-0!=this._gap&&5>s;)s++;this.dataRangeOption.precision=s,this._gap=((this.dataRangeOption.max-this.dataRangeOption.min)/t).toFixed(s)-0,this._valueTextList=[];for(var o=0;t>o;o++)this._selectedMap[o]=!0,this._valueTextList.unshift(this._textFormat(o*this._gap+this.dataRangeOption.min,(o+1)*this._gap+this.dataRangeOption.min))}this.clear(),this._buildShape()},getColor:function(e){if(isNaN(e))return null;if(this.dataRangeOption.min==this.dataRangeOption.max)return this._colorList[0];if(ethis.dataRangeOption.max&&(e=this.dataRangeOption.max),this.dataRangeOption.calculable&&(e-(this._gap*this._range.start+this.dataRangeOption.min)>5e-5||e-(this._gap*this._range.end+this.dataRangeOption.min)<-5e-5))return null;var t=this._colorList.length-Math.ceil((e-this.dataRangeOption.min)/(this.dataRangeOption.max-this.dataRangeOption.min)*this._colorList.length);return t==this._colorList.length&&t--,this._selectedMap[t]?this._colorList[t]:null},getColorByIndex:function(e){return e>=this._colorList.length?e=this._colorList.length-1:0>e&&(e=0),this._colorList[e]},onbeforDispose:function(){this.messageCenter.unbind(s.EVENT.HOVER,this._onhoverlink)}},r.inherits(t,i),e("../component").define("dataRange",t),t}),define("echarts/util/shape/HandlePolygon",["require","zrender/shape/Base","zrender/shape/Polygon","zrender/tool/util"],function(e){function t(e){i.call(this,e)}var i=e("zrender/shape/Base"),n=e("zrender/shape/Polygon"),a=e("zrender/tool/util");return t.prototype={type:"handle-polygon",buildPath:function(e,t){n.prototype.buildPath(e,t)},isCover:function(e,t){var i=this.getTansform(e,t);e=i[0],t=i[1];var n=this.style.rect;return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height?!0:!1}},a.inherits(t,i),t});
--------------------------------------------------------------------------------
/smarttable/images/loading.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toryzen/SmartTable/870e59039c221bf3924d6f759341f0f52162b0fd/smarttable/images/loading.jpg
--------------------------------------------------------------------------------
/smarttable/smarttable.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * SmartTable 3.6
3 | * http://toryzen.com/ | Released under GPLv3 license
4 | */
5 |
6 | //文件导入
7 | function dirname(file_src) {
8 | var dir=''
9 | ns = file_src.split("/")
10 | for (i=0;i');
17 | document.write('');
18 | document.write('');
19 | document.write(' ');
20 | document.write('');
21 |
22 |
23 | $(document).ready(function() {
24 | /*SmartTable*/
25 | var table_data;
26 | var columns;
27 | var smart_i=0;
28 | var all_smart = $(".smart_here").length;
29 | var count_all_smart = 0;
30 | /*SmartTable Comb*/
31 | var smart_comb_columns = [];
32 | var smart_comb_all_data = [];
33 | var smart_comb_data_info = [];
34 | smart_cob_i=-1;
35 | var all_smart = $(".smart_here").length;
36 | var count_all_smart = 0;
37 | //改变图标容器大小
38 | if(all_smart>0){//先检测SmartTable
39 | $(".smart_here").each(function(){
40 | $("body").append(' ');
41 | src = $(this).attr('src'); //数据源
42 | ajax_loop(src,this);
43 | smart_i=smart_i+1;
44 | if(smart_i==1)return false;
45 | });
46 | }else{//后检测SmartTable_Comb
47 | try{
48 | var src_arr_r = $(".smart_comb_here").attr('src').split(";"); //数据源
49 | $("body").append(' ');
50 | smarttable_comb_ajax_loop(src_arr_r);
51 | }
52 | catch (e){
53 | $("#smart_loading").remove();
54 | }
55 | }
56 | function ajax_loop(src,obj){
57 | $.get(src,function(data){
58 | if(!src){
59 | data = $(obj).html();
60 | $(obj).html('');
61 | }
62 | recive_data = eval(data);
63 | param = {}
64 | param = {
65 | "title":" ",
66 | "pdim":"time",
67 | "front":"table",
68 | "graph":{
69 | "ptype":"line",
70 | "markPoint":{"data" : [] },
71 | "markLine":{"data" : [] },
72 | "zoom":{"start":0,"end":100}
73 | },
74 | "table":{
75 | "scrolly":400,
76 | "page":300,
77 | "scrollx":true
78 | }
79 | }
80 | if(recive_data[0]['data']){//新模式
81 | recive_data = recive_data[0]
82 | table_data = recive_data['data'];
83 | columns = recive_data['column'];
84 | param['title'] = recive_data['title']?recive_data['title']:param['title'];
85 | param['pdim'] = recive_data['pdim']?recive_data['pdim']:param['pdim'];
86 | param['front'] = recive_data['front']?recive_data['front']:param['front'];
87 | if(recive_data['graph']){
88 | if(recive_data['graph']['ptype'])
89 | param['graph']['ptype'] = recive_data['graph']['ptype'];
90 | if(recive_data['graph']['markPoint'])
91 | param['graph']['markPoint'] = recive_data['graph']['markPoint'];
92 | if(recive_data['graph']['markLine'])
93 | param['graph']['markLine'] = recive_data['graph']['markLine'];
94 | if(recive_data['graph']['zoom']){
95 | param['graph']['zoom']['start'] = recive_data['graph']['zoom']['start'];
96 | param['graph']['zoom']['end'] = recive_data['graph']['zoom']['end'];
97 |
98 | }
99 |
100 | }
101 | if(recive_data['table']){
102 | if(recive_data['table']['scrolly'])
103 | param['table']['scrolly'] = recive_data['table']['scrolly'];
104 | if(recive_data['table']['page'])
105 | param['table']['page'] = recive_data['table']['page'];
106 | if(recive_data['table']['scrollx'])
107 | param['table']['scrollx'] = recive_data['table']['scrollx'];
108 | }
109 | }else{//兼容3.3之前版本
110 | table_data = recive_data[0];
111 | columns = recive_data[1];
112 | param['title'] = recive_data[2]?recive_data[2]:param['title'];
113 | param['pdim'] = recive_data[3]?recive_data[3]:param['pdim'];
114 | param['front'] = recive_data[4]?recive_data[4]:param['front'];
115 | if(param['front'].indexOf('graph')>=0){
116 | cob_f = param['front'].split(':');
117 | if(cob_f[0]=='graph'){
118 | param['front'] = cob_f[0];
119 | param['graph']['ptype'] = cob_f[1];
120 | }else{
121 | param['front'] = 'table';
122 | param['graph']['ptype'] = cob_f[1]?cob_f[1]:param['graph']['ptype'];
123 | }
124 | }
125 | }
126 | for(var i=0;i
'+param['title']+'
' );
135 | $(obj).append( ''+array_to_string(recive_data)+' ' );
136 | $(obj).append( 'param='+obj2String(param)+' ' );
137 | $(obj).closest('.smart_here').attr('pdim',param['pdim']);
138 | //默认图标绿色
139 | $(obj).find(".pic_dim_tools").find(".tools_pic_dim").each(function(k,v){
140 | if($(this).attr("pdim") == param['pdim']){
141 | $(this).addClass('btn-success');
142 | }
143 | });
144 | //默认图标绿色
145 | $(obj).find(".pic_tools").find(".glyphicon").each(function(k,v){
146 | if($(this).attr("ptype") == param['graph']['ptype']){
147 | $(this).addClass('btn-success');
148 | }
149 | });
150 | //画图与制表
151 | if(table_data!=''){
152 | if(param['front']=='table'){
153 | $(obj).find('.change_table').addClass('btn-success');
154 | $(obj).find('.smart_pic').addClass('hidden');
155 | $(obj).find('.panel-footer').find('.pic_tools').addClass('hidden');
156 | make_table(obj,param,recive_data);
157 | }else if(param['front']=='graph'){
158 | $(obj).find('.change_pic').addClass('btn-success');
159 | $(obj).find('.smart_table').addClass('hidden');
160 | $(obj).find('.panel-footer').find('.table_tools').addClass('hidden');
161 | show_smart_pic(obj,param,recive_data);
162 | }else{
163 | $(obj).find('.change_table').hide();
164 | $(obj).find('.change_pic').hide();
165 | make_table(obj,param,recive_data);
166 | show_smart_pic(obj,param,recive_data);
167 | }
168 | }else{
169 | $(obj).find('.smart_pic').append('没有相关数据
');
170 | $(obj).find('.smart_table').append('没有相关数据
');
171 | }
172 | //删除loading,绑定事件
173 | count_all_smart ++;
174 | if(count_all_smart==all_smart){
175 | band_action();
176 | //Smart Table Comb启动
177 | try{
178 | var src_arr_r = $(".smart_comb_here").attr('src').split(";"); //数据源
179 | smarttable_comb_ajax_loop(src_arr_r);
180 | }
181 | catch (e){
182 | $("#smart_loading").remove();
183 | }
184 | }
185 | var smart_ci=0;
186 | $(".smart_here").each(function(){
187 | if(smart_i==smart_ci){
188 | src = $(this).attr('src'); //数据源
189 | ajax_loop(src,this);
190 | }
191 | smart_ci = smart_ci+1;
192 | });
193 | smart_i = smart_i+1;
194 | });
195 | }
196 | /*SmartTable Comb Loop*/
197 | function smarttable_comb_ajax_loop(src_arr,obj){
198 | smart_cob_i++;
199 | smart_comb_data_info[smart_cob_i] = {};
200 | if(src_arr.length>0){
201 | src = src_arr.pop();
202 | $.get(src,function(data){
203 | revc = eval(data);
204 | if(revc[0]['data']){
205 | recive_data = [];
206 | recive_data[1] = revc[0]['column'];
207 | recive_data[0] = revc[0]['data'];
208 | }else{
209 | recive_data = revc
210 | }
211 | for(i=recive_data[1].length-1;i>0 ;i--){
212 | var sum =0;
213 | var sum_x = 0;
214 | var sum_y = 0;
215 | smart_comb_columns[recive_data[1][i]['title']]=recive_data[1][i]['title']; //首列内容
216 | for(j=0;j
'+title+' ' );
231 | result_column.push({"title":"类型"});
232 | $.each(src_arr_r,function(k,v){
233 | result_column.push({"title":ptitle[k]});
234 | });
235 | var col_i = 0;
236 | for(var x in smart_comb_columns) {
237 | smart_comb_all_data[col_i] = [];
238 | smart_comb_all_data[col_i][0] = smart_comb_columns[x];
239 | for(col_j=0;col_j-1;xi--){
249 | smart_comb_all_data[xy][xi] = smart_comb_all_data[xy][xi-1];
250 | }
251 | }
252 | param = {
253 | "table":{
254 | "scrolly":400,
255 | "page":300,
256 | "scrollx":true
257 | }
258 | }
259 | make_table($(".smart_comb_here"),param,[smart_comb_all_data,result_column]);
260 | $('.down_table').click(function(){
261 | $(this).closest('.smart_comb_here').find('.smart_table').table2CSV()
262 | });
263 | $("#smart_loading").remove();
264 | return true;
265 | }
266 | smarttable_comb_ajax_loop(src_arr,obj);
267 | });
268 | }
269 | }
270 | //事件维度
271 | function do_event_dim(revc){
272 | table_data = revc[0];
273 | columns = revc[1];
274 | columns_x = [];
275 | table_data_x = [];
276 | columns_x[0] = {};
277 | columns_x[0]['title'] = '分类';
278 | for(var z=0;z ' );
382 | $(ts).find('.smart_table').find('.table_val').dataTable( {
383 | "data": table_data,
384 | "scrollY": param['table']['scrolly'],
385 | "bJQueryUI":true,
386 | "bAutoWidth": true,
387 | "bRetrieve": true,
388 | "scrollX": param['table']['scrollx'],
389 | "columns": columns,
390 | "scrollCollapse": true,
391 | "pageLength": param['table']['page'],
392 | "language": {
393 | "emptyTable": "没有相关数据",
394 | "info": "第 _START_ 至 _END_ 条记录 共 _TOTAL_ 条记录",
395 | "infoEmpty": "没有数据",
396 | "infoFiltered": "(filtered from _MAX_ total entries)",
397 | "infoPostFix": "",
398 | "thousands": ",",
399 | "lengthMenu": "每页显示 _MENU_ 条数据",
400 | "loadingRecords": "载入中...",
401 | "processing": "载入中...",
402 | "search": "搜索:",
403 | "zeroRecords": "未找到相应条目",
404 | "paginate": {
405 | "first": "第一页",
406 | "last": "最后一个",
407 | "next": "下一页",
408 | "previous": "前一页"
409 | },
410 | "aria": {
411 | "sortAscending": ": 按正序排列",
412 | "sortDescending": ": 按倒序排列"
413 | }
414 | }
415 | } );
416 |
417 | }
418 | //显示图像
419 | function show_smart_pic(ts,param,recive_data){
420 | if(param['pdim'] == 'total_event'){
421 | recive_data = do_total_dim(recive_data);
422 | }else if(param['pdim'] == 'event'){
423 | recive_data = do_event_dim(recive_data);
424 | }else if(param['pdim'] == 'total_time'){
425 | recive_data = do_total_t_dim(recive_data);
426 | }
427 | table_data = recive_data[0]; //表数据
428 | columns = recive_data[1]; //表格头
429 | ptype = param['graph']['ptype'];
430 | var data_x = new Array();
431 | var series_x = [];
432 | var series_x_x = [];
433 | var columns_x = [];
434 | for(var x=0;x0){
438 | data_x[x].push(parseInt(table_data[y][x]));
439 | }else{
440 | data_x[x].push(table_data[y][x]);
441 | }
442 | }
443 | if(x>0){
444 | series_x[x]={};
445 | ptype_s = ptype.split(';');
446 |
447 | if(ptype_s[x]){
448 | this_ptype = ptype_s[x];
449 | }else{
450 | this_ptype = ptype_s[0];
451 | }
452 | ptype_s_l = this_ptype.split(':');
453 | if(ptype_s_l[1]==1){
454 | series_x[x]['yAxisIndex'] = 1;
455 | }
456 | this_ptype = ptype_s_l[0]
457 | if(this_ptype=='column'){
458 | this_ptype = 'bar';
459 | }
460 | if(this_ptype=='area'){
461 | series_x[x]['itemStyle']= {normal: {areaStyle: {type: 'default'}}};
462 | series_x[x]['type'] = 'line';
463 | }else{
464 | series_x[x]['type']=this_ptype;
465 | }
466 | series_x[x]['name']=columns[x]['title'];
467 | series_x[x]['data'] = data_x[x];
468 | if(param['graph']['markPoint']){
469 | series_x[x]['markPoint'] = param['graph']['markPoint']
470 | }
471 | if(param['graph']['markLine']){
472 | series_x[x]['markLine'] = param['graph']['markLine']
473 | }
474 | series_x_x.push(series_x[x]);
475 | columns_x.push(columns[x]['title']);
476 | }else{
477 | xaxis_x = data_x[x];
478 | }
479 | }
480 | var myChart = echarts.init($(ts).find('.smart_pic')[0]);
481 | var option = {
482 | tooltip : {
483 | trigger: 'axis'
484 | },
485 | legend: {
486 | y: 'bottom',
487 | data:columns_x.length<15?columns_x:[]
488 | },
489 | toolbox: {
490 | show : true,
491 | feature : {
492 | mark : {show: true},
493 | dataView : {show: true, readOnly: false},
494 | magicType : {show: true, type: ['stack', 'tiled']},
495 | restore : {show: true},
496 | saveAsImage : {show: true}
497 | }
498 | },
499 | calculable : true,
500 | dataZoom : {
501 | show : true,
502 | realtime : true,
503 | y: 36,
504 | height: 20,
505 | start : param['graph']['zoom']['start'],
506 | end : param['graph']['zoom']['end']
507 | },
508 | xAxis : [
509 | {
510 | type : 'category',
511 | data : xaxis_x
512 | }
513 | ],
514 | yAxis : [
515 | {
516 | type : 'value'
517 | },
518 | {
519 | type : 'value'
520 | }
521 | ],
522 | series : series_x_x
523 | };
524 | myChart.setOption(option);
525 | }
526 |
527 | //绑定事件
528 | function band_action(){
529 | //切换图片
530 | $('.change_pic').click(function(){
531 | $(this).parent().find(".btn-success").removeClass("btn-success");
532 | $(this).addClass('btn-success');
533 | $(this).closest('.smart_here').find(".smart_pic").removeClass('hidden');
534 | $(this).closest('.smart_here').find('.smart_table').addClass('hidden');
535 | $(this).closest('.smart_here').find('.panel-footer').find('.pic_tools').removeClass('hidden');
536 | $(this).closest('.smart_here').find('.panel-footer').find('.pic_dim_tools').removeClass('hidden');
537 | $(this).closest('.smart_here').find('.panel-footer').find('.table_tools').addClass('hidden');
538 | eval($(this).closest('.smart_here').find('.smart_param').html());
539 | recive_data = eval($(this).closest('.smart_here').find('.smart_data').html());
540 | param['pdim'] = $(this).attr("pdim");
541 | show_smart_pic($(this).closest('.smart_here'),param,recive_data);
542 | });
543 | //切换表格
544 | $('.change_table').click(function(){
545 | $(this).parent().find(".btn-success").removeClass("btn-success");
546 | $(this).addClass('btn-success');
547 | $(this).closest('.smart_here').find('.smart_pic').addClass('hidden');
548 | $(this).closest('.smart_here').find('.smart_table').removeClass('hidden');
549 | $(this).closest('.smart_here').find('.panel-footer').find('.pic_tools').addClass('hidden');
550 | $(this).closest('.smart_here').find('.panel-footer').find('.table_tools').removeClass('hidden');
551 | eval($(this).closest('.smart_here').find('.smart_param').html());
552 | recive_data = eval($(this).closest('.smart_here').find('.smart_data').html());
553 | eval($(this).closest('.smart_here').find('.smart_param').html());
554 | make_table($(this).closest('.smart_here'),param,recive_data);
555 | });
556 | //工具-下载
557 | $('.tools_download').click(function(){
558 | $(this).closest('.smart_here').find('.smart_table').table2CSV()
559 | });
560 | //工具-切换纬度
561 | $('.tools_pic_dim').click(function(){
562 | eval($(this).closest('.smart_here').find('.smart_param').html());
563 | recive_data = eval($(this).closest('.smart_here').find('.smart_data').html());
564 | param['pdim'] = $(this).attr("pdim");
565 | $(this).parents(".panel-footer").find('.pic_dim_tools').find(".btn-success").removeClass("btn-success");
566 | $(this).addClass('btn-success');
567 | //绘图
568 | show_smart_pic($(this).closest('.smart_here'),param,recive_data);
569 | //制表
570 | make_table($(this).closest('.smart_here'),param,recive_data);
571 | $(this).closest('.smart_here').find('.smart_param').html('param='+obj2String(param));
572 |
573 | });
574 | //工具-切换图表
575 | $('.tools_pic_type').click(function(){
576 | eval($(this).closest('.smart_here').find('.smart_param').html());
577 | recive_data = eval($(this).closest('.smart_here').find('.smart_data').html());
578 | param['graph']['ptype'] = $(this).attr("ptype");
579 | $(this).parents(".panel-footer").find('.pic_tools').find(".btn-success").removeClass("btn-success");
580 | $(this).addClass('btn-success');
581 | //绘图
582 | show_smart_pic($(this).closest('.smart_here'),param,recive_data);
583 | $(this).closest('.smart_here').find('.smart_param').html('param='+obj2String(param));
584 | });
585 | }
586 |
587 | });
--------------------------------------------------------------------------------
/smarttable/table2csv/table2CSV.js:
--------------------------------------------------------------------------------
1 | jQuery.fn.table2CSV = function(options) {
2 | var options = jQuery.extend({
3 | separator: '\t',
4 | header: [],
5 | delivery: 'popup' // popup, value
6 | },
7 | options);
8 |
9 | var csvData = [];
10 | var headerArr = [];
11 | var el = this;
12 |
13 | //header
14 | var numCols = options.header.length;
15 | var tmpRow = []; // construct header avalible array
16 | i=0;
17 | $(el).find('thead:first-child').find('tr').find('th').each(function() {
18 | if(i<$(el).find('thead:first-child').find('tr').find('th').length/2){
19 | tmpRow[tmpRow.length] = formatData($(this).html());
20 | }
21 | i++;
22 | });
23 |
24 | row2CSV(tmpRow);
25 |
26 | // actual data
27 | $(el).find('tr').each(function() {
28 | var tmpRow = [];
29 | $(this).find('td').each(function() {
30 | tmpRow[tmpRow.length] = formatData($(this).html());
31 | });
32 | row2CSV(tmpRow);
33 | });
34 | if (options.delivery == 'popup') {
35 | var mydata = csvData.join('\n');
36 | return popup(mydata);
37 | } else {
38 | var mydata = csvData.join('\n');
39 | return mydata;
40 | }
41 |
42 | function row2CSV(tmpRow) {
43 | var tmp = tmpRow.join('') // to remove any blank rows
44 | // alert(tmp);
45 | if (tmpRow.length > 0 && tmp != '') {
46 | var mystr = tmpRow.join(options.separator);
47 | csvData[csvData.length] = mystr;
48 | }
49 | }
50 | function formatData(input) {
51 | // replace " with “
52 | var regexp = new RegExp(/["]/g);
53 | var output = input.replace(regexp, "“");
54 | //HTML
55 | var regexp = new RegExp(/\<[^\<]+\>/g);
56 | var output = output.replace(regexp, "");
57 | if (output == "") return '';
58 | return '"' + output + '"';
59 | }
60 | function popup(data) {
61 | var iWidth=600; //弹出窗口的宽度;
62 | var iHeight=300; //弹出窗口的高度;
63 | var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
64 | var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
65 | var generator = window.open("","请自行全选(Ctril+a)粘贴至EXCEL","height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft);
66 | generator.document.write('请全选(Ctril+a)粘贴至EXCEL ');
67 | generator.document.write('');
68 | generator.document.write('');
71 | generator.document.write('');
72 | generator.document.close();
73 | return true;
74 | }
75 | };
--------------------------------------------------------------------------------