UNPKG

@dfsj/echarts

Version:

专业的水文曲线组件或构造函数以及通用的echart二次封装图表

12 lines (10 loc) 2.72 kB
/** * * @dfsj/echarts: 专业的水文曲线组件或构造函数以及通用的echart二次封装图表 * 版本: v4.0.0-alpha.9 * 作者:yangbo <1747837358@qq.com> * 日期:2026-07-10 17:09:23 * * */ import{classCallCheck as e,createClass as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import*as l from"echarts";import{parsePercent as i}from"../utils.js";import a from"../../utils/assign.js";var r=function(){return t(function t(){e(this,t)},null,[{key:"symbol",value:function(e,t,i){var r=e.get("value"),n=e.get("yAxisIndex"),g=e.get("itemStyle"),o=t.getRect(),u=n%2==0?o.x:o.width,c=t.convertToPixel(null,i,[0,r])[1],s=e.get("itemStyle.offset")||[0,0];if(c<=o.y+o.height&&c>=o.y){var h=new l.graphic.Group;h.add(l.graphic.makePath(e.get("symbol"),a({z2:10,x:u+s[0],y:c+s[1],scale:g.scale},{style:g}),void 0));var y=e.get("label"),v=e.get("label.offset")||[0,0];return h.add(new l.graphic.Text(a({z2:10,x:u+v[0],y:c+v[1]},{style:y}))),h}}},{key:"index",value:function(e,t,i,r){var n=e.get("value"),g=e.get("yAxisIndex"),o=t.getRect(),u=t.convertToPixel(null,i,[0,n])[1];if(u<=o.y+o.height&&u>=o.y){var c,s,h=new l.graphic.Group;h.add(new l.graphic.Line(a({z2:10,shape:{x1:o.x,y1:u,x2:o.x+o.width,y2:u}},{style:e.get("lineStyle")})));var y,v=e.get("label"),x=e.get("label.offset"),d=null!==(c=e.get("label.width"))&&void 0!==c?c:135,f=g%2==0?o.x:o.width+o.x,p=g%2==0?1:-1,w=e.ecModel.get("series"),m=e.get("name");y=null!==(s=(null==w?void 0:w.filter(function(e){return"mark"==(null==e?void 0:e.type)})).findIndex(function(e){return e.name==m}))&&void 0!==s?s:0;var b=f+x[0]+y*d*p,T=u+x[1];return h.add(new l.graphic.Text(a({z2:10,x:b,y:T},{style:v}))),h}}},{key:"rect",value:function(e,t,i,r){var n=e.get("value"),g=t.convertToPixel(null,i,[n[0],0])[0],o=t.convertToPixel(null,i,[n[1],0])[0],u=t.getRect(),c=e.get("itemStyle"),s=l.graphic.clipRectByRect({x:g,y:u.y,width:o-g,height:u.height},u);return s&&new l.graphic.Rect(a({shape:s},{style:c}))}},{key:"line",value:function(e,t,r){var n=e.get("value"),g=t.getRect(),o=t.convertToPixel(null,r,[n,0])[0];if(o>=g.x&&o<=g.x+g.width){var u=new l.graphic.Group;u.add(new l.graphic.Line(a({z2:1,shape:{x1:o,y1:g.y,x2:o,y2:g.y+g.height}},{style:e.get("itemStyle")})));var c=e.get("label"),s=e.get("label.offset")||[0,0];return u.add(new l.graphic.Text(a({x:o+i(s[0],g.width),y:g.y+i(s[1],g.height)},{style:c}))),u}}},{key:"text",value:function(e,t,r){var n=e.get("value"),g=t.convertToPixel(null,r,[n,0])[0],o=t.getRect();if(g>=o.x&&g<=o.x+o.width){var u=e.get("label"),c=e.get("label.offset")||[0,0];return new l.graphic.Text(a({position:[g+i(c[0],o.width),o.y+i(c[1],o.height)]},{style:u}))}}}])}();export{r as default};