UNPKG

@dfsj/echarts

Version:

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

12 lines (10 loc) 5.18 kB
/** * * @dfsj/echarts: 专业的水文曲线组件或构造函数以及通用的echart二次封装图表 * 版本: v4.0.0-alpha.9 * 作者:yangbo <1747837358@qq.com> * 日期:2026-07-10 17:09:23 * * */ import{objectSpread2 as t}from"../_virtual/_rollupPluginBabelHelpers.js";import e from"./assign.js";import o from"../config.js";import{to as l,ensure as a}from"./tools.js";import{EMPTY_ARRAY as r}from"@dfsj/utils";function i(t,e,a){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=e.coord([e.value(0),e.value(1)]),n=e.coord([e.value(2),e.value(3)]),d=e.coord([e.value(4),e.value(5)]),s=e.value(7),f=e.value(1),u="".concat(e.value(6),":").concat(l(e.value(1)),"(m)"),x=a>=f&&o.indexColor[e.value(8)]||o.markColor.safe,c="rgba(51,51,51,0.8)";return"stage"===s?{type:"group",children:[{type:"path",shape:{pathData:o.icon.stage,x:i[0]-9*r,y:i[1]-18.5*r,width:190*r,height:30*r},style:{fill:x,shadowBlur:8*r,shadowColor:"rgba(255,255,255,0.3)"},styleEmphasis:{shadowBlur:5*r,shadowColor:c,shadowOffsetX:r,shadowOffsetY:3*r}},{type:"text",style:{text:u,x:i[0]+10*r,y:i[1]-10*r,fontSize:11*r,textFill:"#fff",textBorderWidth:1,textBorderRadius:20*r,textBackgroundColor:x,textLineWidth:100*r,textVerticalAlign:"middle",textAlign:"left",textPadding:[4*r,5*r,2*r,5*r]},styleEmphasis:{fontSize:12*r,textBoxShadowColor:c,textBoxShadowBlur:10*r,textBoxShadowOffsetX:r,textBoxShadowOffsetY:3*r,textBackgroundColor:"#fff",textFill:x}}]}:"altitude"===s?{type:"group",children:[{type:"path",shape:{pathData:o.icon.altitude,x:i[0]-9*r,y:i[1]-23*r,width:190*r,height:30*r},style:{fill:x,shadowBlur:8*r,shadowColor:"rgba(255,255,255,0.3)"},styleEmphasis:{shadowBlur:2*r,shadowColor:c,shadowOffsetX:r,shadowOffsetY:3*r}},{type:"text",style:{text:u,x:i[0]+10*r,y:i[1]-10*r,fontSize:11*r,textFill:"#fff",textBorderWidth:1,textBorderRadius:20*r,textBackgroundColor:x,textLineWidth:100*r,textVerticalAlign:"middle",textAlign:"left",textPadding:[4*r,5*r,2*r,5*r]},styleEmphasis:{fontSize:12*r,textBoxShadowColor:c,textBoxShadowBlur:10*r,textBoxShadowOffsetX:r,textBoxShadowOffsetY:3*r,textBackgroundColor:"#fff",textFill:x}}]}:"exception"===s?(x=o.markColor[4],{type:"group",children:[{type:"path",shape:{pathData:o.icon.exception,x:i[0],y:i[1],width:10,height:30},style:{fill:x,shadowBlur:8*r,shadowColor:"rgba(255,255,255,0.3)"},styleEmphasis:{shadowBlur:2*r,shadowColor:c,shadowOffsetX:r,shadowOffsetY:3*r}}]}):{type:"group",children:[{z2:5,type:"circle",shape:{cx:i[0],cy:i[1],r:4*r},style:{fill:"#fff",stroke:x}},{z2:4,type:"polyline",shape:{points:[i,n,d]},style:{fill:null,lineWidth:2*r,stroke:x,shadowBlur:8*r,shadowColor:"#fff"},styleEmphasis:{shadowBlur:2*r,shadowColor:c,shadowOffsetX:r,shadowOffsetY:3*r}},{type:"text",style:{text:u,x:d[0],y:d[1]-12*r,fontSize:13*r,textFill:"#fff",textBorderWidth:1,textBorderRadius:20*r,textBackgroundColor:x,textLineWidth:100*r,textAlign:"right",textPadding:[6*r,10*r,3*r,10*r]},styleEmphasis:{textBoxShadowColor:c,textBoxShadowBlur:10*r,textBoxShadowOffsetX:r,textBoxShadowOffsetY:3*r,textBackgroundColor:"#fff",textFill:x}}]}}function n(t,l,i){var n,d,s=(null===(n=t.indices)||void 0===n?void 0:n.reduce(function(t,a){return t.concat(a.indices.filter(function(t){var r=t.color||o.indexColor[t.level],n=l.yAxis.findIndex(function(t){return t&&t.$layout&a.code});if(n>-1)return e({color:r,yAxisIndex:n,shape:"symbol",name:t.label,value:t.value,label:{text:"".concat(t.label,":").concat(t.value)+(a.unit?"(".concat(a.unit,")"):""),textBackgroundColor:r},itemStyle:{fill:r}},i.shape.symbol,i.side[n])}))},[]))||r,f=(null===(d=t.areas)||void 0===d?void 0:d.map(function(t){return e({shape:"rect",value:t.time,gridIndex:[0,1],itemStyle:{fill:t.back||o.areaColor[t.type]}},i.shape.rect)}))||r,u=a(t.split).reduce(function(t,o){return t.concat([e({shape:"line",value:o},i.shape.line),e({shape:"text",value:o,label:{text:o,offset:[0,-15]}},i.shape.text)])},[]);return s.concat(f).concat(u)}function d(t,e,o){var l;return null===(l=t.indices)||void 0===l?void 0:l.reduce(function(l,a){return l.concat(a.indices.map(function(l){var r=null==o?void 0:o.findIndex(function(t){return t&a.code}),i=e.yAxis.findIndex(function(t){return t&&!!(t.$layout&a.code)}),n=t.dimensions.filter(function(t){return t.code===a.code}).some(function(e){var o=t.dimensions.indexOf(e);return t.source.some(function(t){return null!=t[o]})});if(i>-1&&n)return s(l,r,i)})).filter(function(t){return!!t})},[])}function s(e){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e.color;return null==r&&(r=o.markColor[e.level]||o.markColor.safe),{z:10,type:"mark",name:e.label,color:r,selected:e.light,data:[{xAxisIndex:l,yAxisIndex:a,shape:"index",value:e.value,gridIndex:[a>1?1:0],label:{text:"".concat(e.label,":").concat(e.value)+(e.unit?"(".concat(e.unit,")"):""),fill:"#fff",offset:[5*(a%2?-1:1),-5],align:a%2?"right":"left",padding:[4,5,2,10],verticalAlign:"bottom",backgroundColor:r,borderWidth:1,borderRadius:20},lineStyle:t({stroke:r},o.mark.shape.index.lineStyle)}]}}export{i as renderAltitudeMark,s as toIndex,d as toIndices,n as toMarks};