hydro-graph 1.0.38 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- .box[data-v-4880a23b]{position:relative;width:100%;height:100%;display:flex;flex-direction:column}.box .title[data-v-4880a23b]{color:red;font-size:25px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .subTitle[data-v-4880a23b]{color:#3a4ce1;font-size:14px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .legend-box[data-v-4880a23b]{margin-left:33px;z-index:10;display:flex;align-items:center;flex-wrap:wrap}.box .legend-box>.el-checkbox[data-v-4880a23b]{margin-right:8px}.box .legend-box[data-v-4880a23b] .el-dropdown{margin-right:8px}.box .legend-box[data-v-4880a23b] .el-dropdown .el-tooltip__trigger{display:flex;align-items:center}.box .mychart[data-v-4880a23b]{flex:1;position:relative}.box .mychart[data-v-4880a23b] .line-name-tooltip-style{position:absolute;padding:8px;background:#fffffff2;border-radius:4px;box-shadow:0 4px 12px #0000001a;font-size:14px;pointer-events:none;opacity:0;transform:translate(-100%,-120%);transition:all .25s cubic-bezier(.4,0,.2,1);z-index:1000}[data-v-4880a23b] .el-checkbox .el-checkbox__label{color:var(--fill-color);display:flex;align-items:center;padding-left:3px}[data-v-4880a23b] .el-checkbox .el-checkbox__input.is-checked .el-checkbox__inner,[data-v-4880a23b] .el-checkbox .el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--fill-color);border-color:var(--fill-color)!important}[data-v-4880a23b] .el-checkbox .el-checkbox__input.is-focus .el-checkbox__inner,[data-v-4880a23b] .el-checkbox .el-checkbox__inner:hover{border-color:var(--fill-color)!important}
1
+ .box[data-v-0d3f793e]{position:relative;width:100%;height:100%;display:flex;flex-direction:column}.box .title[data-v-0d3f793e]{color:red;font-size:25px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .subTitle[data-v-0d3f793e]{color:#3a4ce1;font-size:14px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .legend-box[data-v-0d3f793e]{margin-left:33px;z-index:10;display:flex;align-items:center;flex-wrap:wrap}.box .legend-box>.el-checkbox[data-v-0d3f793e]{margin-right:8px}.box .legend-box[data-v-0d3f793e] .el-dropdown{margin-right:8px}.box .legend-box[data-v-0d3f793e] .el-dropdown .el-tooltip__trigger{display:flex;align-items:center}.box .mychart[data-v-0d3f793e]{flex:1;position:relative}.box .mychart[data-v-0d3f793e] .line-name-tooltip-style{position:absolute;padding:8px;background:#fffffff2;border-radius:4px;box-shadow:0 4px 12px #0000001a;font-size:14px;pointer-events:none;opacity:0;transform:translate(-100%,-120%);transition:all .25s cubic-bezier(.4,0,.2,1);z-index:1000}[data-v-0d3f793e] .el-checkbox .el-checkbox__label{color:var(--fill-color);display:flex;align-items:center;padding-left:3px}[data-v-0d3f793e] .el-checkbox .el-checkbox__input.is-checked .el-checkbox__inner,[data-v-0d3f793e] .el-checkbox .el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--fill-color);border-color:var(--fill-color)!important}[data-v-0d3f793e] .el-checkbox .el-checkbox__input.is-focus .el-checkbox__inner,[data-v-0d3f793e] .el-checkbox .el-checkbox__inner:hover{border-color:var(--fill-color)!important}
@@ -1612,7 +1612,7 @@ ${n.name}: {a0|${r.data.coord[1]}} ${n.unit}`;
1612
1612
  ]);
1613
1613
  };
1614
1614
  }
1615
- }, He = /* @__PURE__ */ Re(Ln, [["__scopeId", "data-v-4880a23b"]]), Nn = sn({
1615
+ }, He = /* @__PURE__ */ Re(Ln, [["__scopeId", "data-v-0d3f793e"]]), Nn = sn({
1616
1616
  props: {
1617
1617
  iconClass: {
1618
1618
  type: String,
@@ -53,4 +53,4 @@ ${s.name}: ${s.value} ${s.unit}}`}),i}else{let i="";return(Je.includes(e.name)||
53
53
  ${e.seriesName}: ${A[1]} ${n.unit}`,label:{offset:b||[-120,0]}}],P.value.series[M].markPoint={symbol:"pin",symbolSize:20,label:{show:!0,position:"top",align:"left",fontSize:16,backgroundColor:n.backgroundColor?n.backgroundColor:v[n.name]?v[n.name].color:n.color,borderRadius:6,shadowColor:"#666666",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,fontWeight:"bold",padding:[4,4,4,4],lineHeight:30,color:n.markPointColor?n.markPointColor:"#fff",formatter:i=>{let s="",k=n.tmType?n.tmType:"YYYY-MM-DD HH:mm";i.data&&i.data.coord&&i.data.coord[0]&&(s=O(i.data.coord[0]).format(k));let u="",E="";if(i.name=="Max"||i.name=="Min"){if(i.name=="Max")return u=n.maxText?n.maxText:"最大值",n.unit.includes("m³")?E=i.value?K(i.value):"--":n.unit.includes("mm")?E=i.value?Number(i.value).toFixed(1):"--":n.unit.includes("m")?E=i.value?Number(i.value).toFixed(2):"--":E=i.value,n.tmText?`${u}: {a0|${E}} ${n.unit}
54
54
  ${n.tmText}: {a1|${s}}`:`${n.tmText2?n.tmText2:"相应时间"}: {a1|${s}}
55
55
  ${u}: {a0|${E}} ${n.unit}`}else return`相应时间: {a1|${O(i.data.coord[0]).format(k)}}
56
- ${n.name}: {a0|${i.data.coord[1]}} ${n.unit}`},rich:{a0:{fontSize:25,fontFamily:"Times New Roman"},a1:{fontSize:20,fontFamily:"Times New Roman"}}},data:l},P.value.dataZoom[0]={...(d=I.getOption())==null?void 0:d.dataZoom[0]},I.setOption(P.value,!0),I.getOption().series.map(i=>{i.markPoint&&(fe[i.name]=i.markPoint)})}}}),I.on("mousedown",function(e){I.setOption({tooltip:{show:!1}}),I.dispatchAction({type:"hideTip"});let d=e.seriesIndex,n=a.chartOption.series[d],A=n.stepTM?n.stepTM:60,M="",C="",p="";if(n.openBarDrag){let l={},b={},i=a.chartOption.yAxis[n.yAxisIndex],s=[];e.componentType=="markLine"&&n.data.name=="xAxis"?s=P.value.series.map((S,T)=>S.name=="开始"||S.name=="结束"?JSON.parse(JSON.stringify(S)):{}):s=P.value.series.map((S,T)=>T==d?{data:JSON.parse(JSON.stringify(S.data))}:{});let k,u,E;a.chartOption.fixedTimePeriod&&(M=a.chartOption.series.find(S=>S.name=="开始").data.value,C=a.chartOption.series.find(S=>S.name=="结束").data.value,p=O(C).diff(O(M),"hour")),I.getZr().off("mousemove"),I.getZr().off("mouseup"),I.getZr().on("mousemove",function(S){if(e.componentType=="markLine"&&n.data.name=="xAxis"){let T=I.convertFromPixel({xAxisIndex:n.xAxisIndex},S.offsetX),B=O(T).format("YYYY-MM-DD HH:00");if(B!==k){const Q=O(B),J=O(r[r.length-1]),ce=D?O(D):"";if(Q.isAfter(J)||Q.isBefore(ce))return;if(a.chartOption.fixedTimePeriod){if(n.name=="开始"?E=O(B).add(p,"hours").format("YYYY-MM-DD HH:00"):n.name=="结束"&&(E=O(B).add(-p,"hours").format("YYYY-MM-DD HH:00")),n.name=="开始"&&O(E).isAfter(J))return;if(n.name=="结束"&&O(E).isBefore(ce))return;s.forEach(V=>{n.name=="开始"?V.name=="开始"?(V.markLine.data[0].xAxis=B,V.markArea.data[0][0].xAxis=B,V.markArea.data[0][1].xAxis=E):V.name=="结束"&&(V.markLine.data[0].xAxis=E):n.name=="结束"&&(V.name=="开始"?(V.markLine.data[0].xAxis=E,V.markArea.data[0][0].xAxis=E,V.markArea.data[0][1].xAxis=B):V.name=="结束"&&(V.markLine.data[0].xAxis=B))})}else s.forEach(V=>{n.name=="开始"?V.name=="开始"&&(V.markLine.data[0].xAxis=B,V.markArea.data[0][0].xAxis=B):n.name=="结束"&&(V.name=="开始"?V.markArea.data[0][1].xAxis=B:V.name=="结束"&&(V.markLine.data[0].xAxis=B))});I.setOption({series:s},{notMerge:!1,lazyUpdate:!0}),k=B}}else{let[T,B]=I.convertFromPixel({seriesIndex:d},[S.offsetX,S.offsetY]);if(O(T).format("YYYY-MM-DD HH:00")!==k||!u||Math.abs(B-u)>=.5){const Q=O(T).format("YYYY-MM-DD HH:00");b[Q]=B;let J=Object.keys(b),ce=new Set(J);s[d].data.forEach(U=>{ce.has(U[0])&&(U[1]=b[U[0]])});let V=be(new Date(J[0]),new Date(J[J.length-1]),A),ue=Object.entries(b),on=new Set(J);V.forEach(U=>{on.has(U)||ue.push(an(ue,U))});let ne={};ue.forEach(U=>{ne[U[0]]=U[1]});let rn=Object.keys(ne),sn=new Set(rn);s[d].data.forEach(U=>{if(sn.has(U[0])){let de="";i.name.includes("m³")?de=K(ne[U[0]]):i.name.includes("mm")?de=ne[U[0]].toFixed(1):i.name.includes("m")&&(de=ne[U[0]].toFixed(2)),U[1]=de}}),I.setOption({series:s},{notMerge:!1,lazyUpdate:!0}),k=Q,u=B}}}),I.getZr().on("mouseup",function(){if(I.getZr().off("mousemove"),I.getZr().off("mouseup"),e.componentType=="markLine"&&n.data.name=="xAxis"){if(k)if(E){const S=O(r[r.length-1]),T=D?O(D):"";n.name=="开始"&&O(E).isAfter(S)?E=O(k).add(p,"hours").format("YYYY-MM-DD HH:00"):n.name=="结束"&&O(E).isBefore(T)&&(E=O(k).add(-p,"hours").format("YYYY-MM-DD HH:00")),l={name:"开始/结束",value:n.name=="开始"?`${k}/${E}`:`${E}/${k}`}}else l={name:n.name,value:k}}else l={name:e.seriesName,data:s[d].data};l.name&&Pe("getNewSeriesData",l),I.getZr().on("mousemove",function(S){let T=S.offsetX,B=S.offsetY;I.dispatchAction({type:"showTip",x:T,y:B})})})}}),window.onresize=function(){I.resize()}},ie=f=>{t.nextTick(()=>{I&&I.resize()})},se=(f,h)=>{I.dispatchAction({type:h?"legendSelect":"legendUnSelect",name:f})};function je(f){return f.month()===0&&f.date()===1&&f.hour()===0&&f.minute()===0}function Ke(f){f.preventDefault();let h=document.querySelector("body .chartMenu");h&&h.remove();let c=f.pageX,y=f.pageY,r=document.createElement("ul");r.style.position="absolute",r.style.left=c+"px",r.style.top=y+"px",r.className="chartMenu";let D=document.createElement("li");D.style.cursor="pointer",D.innerHTML=`<div><img src='${Te}'><span>还原缩放</span></div>`,r.appendChild(D);let g=document.createElement("li");g.style.cursor="pointer",g.innerHTML=`<div><img src='${Ne}'><span>复制图片</span></div>`,r.appendChild(g);let L=document.createElement("li");L.style.cursor="pointer",L.innerHTML=`<div><img src='${ze}'><span>导出图片</span></div>`,r.appendChild(L),D.addEventListener("click",()=>{I.dispatchAction({type:"dataZoom",dataZoomIndex:0,start:0,end:100})}),g.addEventListener("click",()=>{xe(x.value,{useCORS:!0,scale:2,width:x.value.offsetWidth,height:x.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(R=>{const w=R.toDataURL("image/png"),Y=Ze(w,"图片");$e(Y),j.ElMessage.success("复制成功")})}),L.addEventListener("click",()=>{en()}),document.body.appendChild(r),document.addEventListener("click",()=>{r.parentNode&&document.body.removeChild(r)})}const Ze=(f,h="file")=>{const c=f.split(","),y=c[0].match(/:(.*?);/)[1],r=y.split("/")[1],D=window.atob(c[1]);let g=D.length;const L=new Uint8Array(g);for(;g--;)L[g]=D.charCodeAt(g);return new File([L],`${h}.${r}`,{type:y})},$e=f=>{const h=new FileReader;h.onload=c=>{const y=c.target.result.toString(),r=new Image;r.src=y,r.onload=()=>{let D=qe(r),g=_e(D.replace("data:image/png;base64,",""),"image/png",512);navigator.clipboard.write([new ClipboardItem({"image/png":g})])}},h.readAsDataURL(f)},qe=f=>{let h=document.createElement("canvas");return h.width=f.width,h.height=f.height,h.getContext("2d").drawImage(f,0,0,f.width,f.height),h.toDataURL("image/png")},_e=(f,h,c)=>{h=h||"",c=c||512;let y=window.atob(f),r=[];for(let g=0;g<y.length;g+=c){let L=y.slice(g,g+c),R=new Array(L.length);for(let Y=0;Y<L.length;Y++)R[Y]=L.charCodeAt(Y);let w=new Uint8Array(R);r.push(w)}return new Blob(r,{type:h})},en=()=>{xe(x.value,{useCORS:!0,scale:1,width:x.value.offsetWidth,height:x.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(f=>{const h=f.toDataURL("image/png"),c=document.createElement("a");c.href=h,c.download=a.chartOption.title,c.click()})},pe=t.ref();function nn(){return pe.value?pe.value.offsetHeight:0}function tn(f,h){return new Promise(c=>{Fe({STCD:a.chartOption.stationCode,rzw:f}).then(y=>{y.statusCode==200&&y.data?c(y.data):c(h*1e3)})})}function an(f,h){if(f.length>0){let c=f.filter(r=>O(r[0]).isBefore(O(h))),y=f.filter(r=>O(r[0]).isAfter(O(h)));if(c.length==0)return[h,y[0][1]];if(y.length==0)return[h,c[c.length-1][1]];{let r=O(h).diff(O(c[c.length-1][0]),"seconds"),D=y[0][1]-c[c.length-1][1],g=O(y[0][0]).diff(O(c[c.length-1][0]),"seconds"),L=r*D/g+c[c.length-1][1];return[h,Number(L)]}}}function ln(f){var g;let h=(g=a.chartOption.series.find(L=>L.name=="开始"))==null?void 0:g.data.value;const c=O(h),y=O(f),r=c.year()===y.year();return r&&c.month()===y.month()?y.format("DD HH:mm"):r?y.format("MM-DD HH:mm"):y.format("YYYY-MM-DD HH:mm")}return m({getLegendBoxHeight:nn,onChange:oe}),(f,h)=>{const c=t.resolveComponent("el-checkbox"),y=t.resolveComponent("svg-icon"),r=t.resolveComponent("el-icon"),D=t.resolveComponent("el-dropdown-item"),g=t.resolveComponent("el-dropdown-menu"),L=t.resolveComponent("el-dropdown"),R=t.resolveDirective("resize");return t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:"box",ref_key:"chartBox",ref:x,onContextmenu:h[1]||(h[1]=w=>Ke(w))},[t.withDirectives((t.openBlock(),t.createElementBlock("div",Be,[t.createTextVNode(t.toDisplayString(o.chartOption.title),1)])),[[t.vShow,o.chartOption.title],[R,ie]]),t.withDirectives((t.openBlock(),t.createElementBlock("div",Le,[t.createTextVNode(t.toDisplayString(o.chartOption.subTitle),1)])),[[t.vShow,o.chartOption.subTitle],[R,ie]]),t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:"legend-box",ref_key:"myLegend",ref:pe},[G.value.length>1?(t.openBlock(),t.createBlock(c,{key:0,modelValue:q.value,"onUpdate:modelValue":h[0]||(h[0]=w=>q.value=w),label:"全选",onChange:Xe,style:{"--fill-color":"#409EFF"}},null,8,["modelValue"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(G.value,(w,Y)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Y},[w.children?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(c,{key:0,modelValue:w.isSelected,"onUpdate:modelValue":z=>w.isSelected=z,onChange:z=>oe(z,w.name),style:t.normalizeStyle({"--fill-color":w.color?w.color:"#409EFF"})},{default:t.withCtx(()=>[w.icon?(t.openBlock(),t.createBlock(y,{key:0,"icon-class":w.icon,style:t.normalizeStyle({width:w.iconWidth?w.iconWidth+"px":"20px",height:w.iconHeight?w.iconHeight+"px":"20px"}),color:w.color},null,8,["icon-class","style","color"])):t.createCommentVNode("",!0),t.createElementVNode("span",{style:t.normalizeStyle({color:w.color,marginLeft:"3px"})},t.toDisplayString(w.key?w.key:w.name),5),w.children&&w.children.length>0?(t.openBlock(),t.createBlock(r,{key:1,class:"el-icon--right"},{default:t.withCtx(()=>[t.createVNode(t.unref(ye.ArrowDown))]),_:1})):t.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])),w.children&&w.children.length>0?(t.openBlock(),t.createBlock(L,{key:1,"hide-on-click":!1},{dropdown:t.withCtx(()=>[t.createVNode(g,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.children,(z,_)=>(t.openBlock(),t.createBlock(D,{key:_},{default:t.withCtx(()=>[t.createVNode(c,{modelValue:z.isSelected,"onUpdate:modelValue":W=>z.isSelected=W,onChange:W=>oe(W,z.name),style:t.normalizeStyle({"--fill-color":z.color?z.color:"#409EFF"})},{default:t.withCtx(()=>[t.createElementVNode("div",Ve,[z.icon?(t.openBlock(),t.createBlock(y,{key:0,"icon-class":z.icon,style:t.normalizeStyle({width:z.iconWidth?z.iconWidth+"px":"20px",height:z.iconHeight?z.iconHeight+"px":"20px"}),color:z.color},null,8,["icon-class","style","color"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",{style:t.normalizeStyle({color:z.color,marginLeft:"3px"})},t.toDisplayString(z.key?z.key:z.name),5)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024))),128))]),_:2},1024)]),default:t.withCtx(()=>[t.createVNode(c,{modelValue:w.isSelected,"onUpdate:modelValue":z=>w.isSelected=z,onChange:z=>oe(z,w.name),style:t.normalizeStyle({"--fill-color":w.color?w.color:"#409EFF"})},{default:t.withCtx(()=>[w.icon?(t.openBlock(),t.createBlock(y,{key:0,"icon-class":w.icon,style:t.normalizeStyle({width:w.iconWidth?w.iconWidth+"px":"20px",height:w.iconHeight?w.iconHeight+"px":"20px"}),color:w.color},null,8,["icon-class","style","color"])):t.createCommentVNode("",!0),t.createElementVNode("span",{style:t.normalizeStyle({color:w.color,marginLeft:"3px"})},t.toDisplayString(w.key?w.key:w.name),5),w.children&&w.children.length>0?(t.openBlock(),t.createBlock(r,{key:1,class:"el-icon--right"},{default:t.withCtx(()=>[t.createVNode(t.unref(ye.ArrowDown))]),_:1})):t.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024)):t.createCommentVNode("",!0)],64))),128))])),[[R,ie]]),t.createElementVNode("div",Ye,[t.createElementVNode("div",{id:o.id,style:t.normalizeStyle({width:o.width,height:o.height})},null,12,He)])],32)),[[R,ie]])}}},[["__scopeId","data-v-4880a23b"]]),Re=t.defineComponent({props:{iconClass:{type:String,required:!0},className:{type:String,default:""},color:{type:String,default:""}},setup(o){return{iconName:t.computed(()=>`#icon-${o.iconClass}`),svgClass:t.computed(()=>o.className?`svg-icon ${o.className}`:"svg-icon")}}}),Ue=["xlink:href","fill"];function Qe(o,m,N,x,a,v){return t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(o.svgClass),"aria-hidden":"true"},[t.createElementVNode("use",{"xlink:href":o.iconName,fill:o.color},null,8,Ue)],2)}const Ge=Ee(Re,[["render",Qe]]);le.install=o=>{o.component("ElCheckbox",j.ElCheckbox),o.component("ElIcon",j.ElIcon),o.component("ElDropdown",j.ElDropdown),o.component("ElDropdownMenu",j.ElDropdownMenu),o.component("ElDropdownItem",j.ElDropdownItem),o.component("SvgIcon",Ge),o.component("HydroGraph",le)},H.HydroGraph=le,H.default=le,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
56
+ ${n.name}: {a0|${i.data.coord[1]}} ${n.unit}`},rich:{a0:{fontSize:25,fontFamily:"Times New Roman"},a1:{fontSize:20,fontFamily:"Times New Roman"}}},data:l},P.value.dataZoom[0]={...(d=I.getOption())==null?void 0:d.dataZoom[0]},I.setOption(P.value,!0),I.getOption().series.map(i=>{i.markPoint&&(fe[i.name]=i.markPoint)})}}}),I.on("mousedown",function(e){I.setOption({tooltip:{show:!1}}),I.dispatchAction({type:"hideTip"});let d=e.seriesIndex,n=a.chartOption.series[d],A=n.stepTM?n.stepTM:60,M="",C="",p="";if(n.openBarDrag){let l={},b={},i=a.chartOption.yAxis[n.yAxisIndex],s=[];e.componentType=="markLine"&&n.data.name=="xAxis"?s=P.value.series.map((S,T)=>S.name=="开始"||S.name=="结束"?JSON.parse(JSON.stringify(S)):{}):s=P.value.series.map((S,T)=>T==d?{data:JSON.parse(JSON.stringify(S.data))}:{});let k,u,E;a.chartOption.fixedTimePeriod&&(M=a.chartOption.series.find(S=>S.name=="开始").data.value,C=a.chartOption.series.find(S=>S.name=="结束").data.value,p=O(C).diff(O(M),"hour")),I.getZr().off("mousemove"),I.getZr().off("mouseup"),I.getZr().on("mousemove",function(S){if(e.componentType=="markLine"&&n.data.name=="xAxis"){let T=I.convertFromPixel({xAxisIndex:n.xAxisIndex},S.offsetX),B=O(T).format("YYYY-MM-DD HH:00");if(B!==k){const Q=O(B),J=O(r[r.length-1]),ce=D?O(D):"";if(Q.isAfter(J)||Q.isBefore(ce))return;if(a.chartOption.fixedTimePeriod){if(n.name=="开始"?E=O(B).add(p,"hours").format("YYYY-MM-DD HH:00"):n.name=="结束"&&(E=O(B).add(-p,"hours").format("YYYY-MM-DD HH:00")),n.name=="开始"&&O(E).isAfter(J))return;if(n.name=="结束"&&O(E).isBefore(ce))return;s.forEach(V=>{n.name=="开始"?V.name=="开始"?(V.markLine.data[0].xAxis=B,V.markArea.data[0][0].xAxis=B,V.markArea.data[0][1].xAxis=E):V.name=="结束"&&(V.markLine.data[0].xAxis=E):n.name=="结束"&&(V.name=="开始"?(V.markLine.data[0].xAxis=E,V.markArea.data[0][0].xAxis=E,V.markArea.data[0][1].xAxis=B):V.name=="结束"&&(V.markLine.data[0].xAxis=B))})}else s.forEach(V=>{n.name=="开始"?V.name=="开始"&&(V.markLine.data[0].xAxis=B,V.markArea.data[0][0].xAxis=B):n.name=="结束"&&(V.name=="开始"?V.markArea.data[0][1].xAxis=B:V.name=="结束"&&(V.markLine.data[0].xAxis=B))});I.setOption({series:s},{notMerge:!1,lazyUpdate:!0}),k=B}}else{let[T,B]=I.convertFromPixel({seriesIndex:d},[S.offsetX,S.offsetY]);if(O(T).format("YYYY-MM-DD HH:00")!==k||!u||Math.abs(B-u)>=.5){const Q=O(T).format("YYYY-MM-DD HH:00");b[Q]=B;let J=Object.keys(b),ce=new Set(J);s[d].data.forEach(U=>{ce.has(U[0])&&(U[1]=b[U[0]])});let V=be(new Date(J[0]),new Date(J[J.length-1]),A),ue=Object.entries(b),on=new Set(J);V.forEach(U=>{on.has(U)||ue.push(an(ue,U))});let ne={};ue.forEach(U=>{ne[U[0]]=U[1]});let rn=Object.keys(ne),sn=new Set(rn);s[d].data.forEach(U=>{if(sn.has(U[0])){let de="";i.name.includes("m³")?de=K(ne[U[0]]):i.name.includes("mm")?de=ne[U[0]].toFixed(1):i.name.includes("m")&&(de=ne[U[0]].toFixed(2)),U[1]=de}}),I.setOption({series:s},{notMerge:!1,lazyUpdate:!0}),k=Q,u=B}}}),I.getZr().on("mouseup",function(){if(I.getZr().off("mousemove"),I.getZr().off("mouseup"),e.componentType=="markLine"&&n.data.name=="xAxis"){if(k)if(E){const S=O(r[r.length-1]),T=D?O(D):"";n.name=="开始"&&O(E).isAfter(S)?E=O(k).add(p,"hours").format("YYYY-MM-DD HH:00"):n.name=="结束"&&O(E).isBefore(T)&&(E=O(k).add(-p,"hours").format("YYYY-MM-DD HH:00")),l={name:"开始/结束",value:n.name=="开始"?`${k}/${E}`:`${E}/${k}`}}else l={name:n.name,value:k}}else l={name:e.seriesName,data:s[d].data};l.name&&Pe("getNewSeriesData",l),I.getZr().on("mousemove",function(S){let T=S.offsetX,B=S.offsetY;I.dispatchAction({type:"showTip",x:T,y:B})})})}}),window.onresize=function(){I.resize()}},ie=f=>{t.nextTick(()=>{I&&I.resize()})},se=(f,h)=>{I.dispatchAction({type:h?"legendSelect":"legendUnSelect",name:f})};function je(f){return f.month()===0&&f.date()===1&&f.hour()===0&&f.minute()===0}function Ke(f){f.preventDefault();let h=document.querySelector("body .chartMenu");h&&h.remove();let c=f.pageX,y=f.pageY,r=document.createElement("ul");r.style.position="absolute",r.style.left=c+"px",r.style.top=y+"px",r.className="chartMenu";let D=document.createElement("li");D.style.cursor="pointer",D.innerHTML=`<div><img src='${Te}'><span>还原缩放</span></div>`,r.appendChild(D);let g=document.createElement("li");g.style.cursor="pointer",g.innerHTML=`<div><img src='${Ne}'><span>复制图片</span></div>`,r.appendChild(g);let L=document.createElement("li");L.style.cursor="pointer",L.innerHTML=`<div><img src='${ze}'><span>导出图片</span></div>`,r.appendChild(L),D.addEventListener("click",()=>{I.dispatchAction({type:"dataZoom",dataZoomIndex:0,start:0,end:100})}),g.addEventListener("click",()=>{xe(x.value,{useCORS:!0,scale:2,width:x.value.offsetWidth,height:x.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(R=>{const w=R.toDataURL("image/png"),Y=Ze(w,"图片");$e(Y),j.ElMessage.success("复制成功")})}),L.addEventListener("click",()=>{en()}),document.body.appendChild(r),document.addEventListener("click",()=>{r.parentNode&&document.body.removeChild(r)})}const Ze=(f,h="file")=>{const c=f.split(","),y=c[0].match(/:(.*?);/)[1],r=y.split("/")[1],D=window.atob(c[1]);let g=D.length;const L=new Uint8Array(g);for(;g--;)L[g]=D.charCodeAt(g);return new File([L],`${h}.${r}`,{type:y})},$e=f=>{const h=new FileReader;h.onload=c=>{const y=c.target.result.toString(),r=new Image;r.src=y,r.onload=()=>{let D=qe(r),g=_e(D.replace("data:image/png;base64,",""),"image/png",512);navigator.clipboard.write([new ClipboardItem({"image/png":g})])}},h.readAsDataURL(f)},qe=f=>{let h=document.createElement("canvas");return h.width=f.width,h.height=f.height,h.getContext("2d").drawImage(f,0,0,f.width,f.height),h.toDataURL("image/png")},_e=(f,h,c)=>{h=h||"",c=c||512;let y=window.atob(f),r=[];for(let g=0;g<y.length;g+=c){let L=y.slice(g,g+c),R=new Array(L.length);for(let Y=0;Y<L.length;Y++)R[Y]=L.charCodeAt(Y);let w=new Uint8Array(R);r.push(w)}return new Blob(r,{type:h})},en=()=>{xe(x.value,{useCORS:!0,scale:1,width:x.value.offsetWidth,height:x.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(f=>{const h=f.toDataURL("image/png"),c=document.createElement("a");c.href=h,c.download=a.chartOption.title,c.click()})},pe=t.ref();function nn(){return pe.value?pe.value.offsetHeight:0}function tn(f,h){return new Promise(c=>{Fe({STCD:a.chartOption.stationCode,rzw:f}).then(y=>{y.statusCode==200&&y.data?c(y.data):c(h*1e3)})})}function an(f,h){if(f.length>0){let c=f.filter(r=>O(r[0]).isBefore(O(h))),y=f.filter(r=>O(r[0]).isAfter(O(h)));if(c.length==0)return[h,y[0][1]];if(y.length==0)return[h,c[c.length-1][1]];{let r=O(h).diff(O(c[c.length-1][0]),"seconds"),D=y[0][1]-c[c.length-1][1],g=O(y[0][0]).diff(O(c[c.length-1][0]),"seconds"),L=r*D/g+c[c.length-1][1];return[h,Number(L)]}}}function ln(f){var g;let h=(g=a.chartOption.series.find(L=>L.name=="开始"))==null?void 0:g.data.value;const c=O(h),y=O(f),r=c.year()===y.year();return r&&c.month()===y.month()?y.format("DD HH:mm"):r?y.format("MM-DD HH:mm"):y.format("YYYY-MM-DD HH:mm")}return m({getLegendBoxHeight:nn,onChange:oe}),(f,h)=>{const c=t.resolveComponent("el-checkbox"),y=t.resolveComponent("svg-icon"),r=t.resolveComponent("el-icon"),D=t.resolveComponent("el-dropdown-item"),g=t.resolveComponent("el-dropdown-menu"),L=t.resolveComponent("el-dropdown"),R=t.resolveDirective("resize");return t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:"box",ref_key:"chartBox",ref:x,onContextmenu:h[1]||(h[1]=w=>Ke(w))},[t.withDirectives((t.openBlock(),t.createElementBlock("div",Be,[t.createTextVNode(t.toDisplayString(o.chartOption.title),1)])),[[t.vShow,o.chartOption.title],[R,ie]]),t.withDirectives((t.openBlock(),t.createElementBlock("div",Le,[t.createTextVNode(t.toDisplayString(o.chartOption.subTitle),1)])),[[t.vShow,o.chartOption.subTitle],[R,ie]]),t.withDirectives((t.openBlock(),t.createElementBlock("div",{class:"legend-box",ref_key:"myLegend",ref:pe},[G.value.length>1?(t.openBlock(),t.createBlock(c,{key:0,modelValue:q.value,"onUpdate:modelValue":h[0]||(h[0]=w=>q.value=w),label:"全选",onChange:Xe,style:{"--fill-color":"#409EFF"}},null,8,["modelValue"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(G.value,(w,Y)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:Y},[w.children?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(c,{key:0,modelValue:w.isSelected,"onUpdate:modelValue":z=>w.isSelected=z,onChange:z=>oe(z,w.name),style:t.normalizeStyle({"--fill-color":w.color?w.color:"#409EFF"})},{default:t.withCtx(()=>[w.icon?(t.openBlock(),t.createBlock(y,{key:0,"icon-class":w.icon,style:t.normalizeStyle({width:w.iconWidth?w.iconWidth+"px":"20px",height:w.iconHeight?w.iconHeight+"px":"20px"}),color:w.color},null,8,["icon-class","style","color"])):t.createCommentVNode("",!0),t.createElementVNode("span",{style:t.normalizeStyle({color:w.color,marginLeft:"3px"})},t.toDisplayString(w.key?w.key:w.name),5),w.children&&w.children.length>0?(t.openBlock(),t.createBlock(r,{key:1,class:"el-icon--right"},{default:t.withCtx(()=>[t.createVNode(t.unref(ye.ArrowDown))]),_:1})):t.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])),w.children&&w.children.length>0?(t.openBlock(),t.createBlock(L,{key:1,"hide-on-click":!1},{dropdown:t.withCtx(()=>[t.createVNode(g,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.children,(z,_)=>(t.openBlock(),t.createBlock(D,{key:_},{default:t.withCtx(()=>[t.createVNode(c,{modelValue:z.isSelected,"onUpdate:modelValue":W=>z.isSelected=W,onChange:W=>oe(W,z.name),style:t.normalizeStyle({"--fill-color":z.color?z.color:"#409EFF"})},{default:t.withCtx(()=>[t.createElementVNode("div",Ve,[z.icon?(t.openBlock(),t.createBlock(y,{key:0,"icon-class":z.icon,style:t.normalizeStyle({width:z.iconWidth?z.iconWidth+"px":"20px",height:z.iconHeight?z.iconHeight+"px":"20px"}),color:z.color},null,8,["icon-class","style","color"])):t.createCommentVNode("",!0)]),t.createElementVNode("span",{style:t.normalizeStyle({color:z.color,marginLeft:"3px"})},t.toDisplayString(z.key?z.key:z.name),5)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024))),128))]),_:2},1024)]),default:t.withCtx(()=>[t.createVNode(c,{modelValue:w.isSelected,"onUpdate:modelValue":z=>w.isSelected=z,onChange:z=>oe(z,w.name),style:t.normalizeStyle({"--fill-color":w.color?w.color:"#409EFF"})},{default:t.withCtx(()=>[w.icon?(t.openBlock(),t.createBlock(y,{key:0,"icon-class":w.icon,style:t.normalizeStyle({width:w.iconWidth?w.iconWidth+"px":"20px",height:w.iconHeight?w.iconHeight+"px":"20px"}),color:w.color},null,8,["icon-class","style","color"])):t.createCommentVNode("",!0),t.createElementVNode("span",{style:t.normalizeStyle({color:w.color,marginLeft:"3px"})},t.toDisplayString(w.key?w.key:w.name),5),w.children&&w.children.length>0?(t.openBlock(),t.createBlock(r,{key:1,class:"el-icon--right"},{default:t.withCtx(()=>[t.createVNode(t.unref(ye.ArrowDown))]),_:1})):t.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024)):t.createCommentVNode("",!0)],64))),128))])),[[R,ie]]),t.createElementVNode("div",Ye,[t.createElementVNode("div",{id:o.id,style:t.normalizeStyle({width:o.width,height:o.height})},null,12,He)])],32)),[[R,ie]])}}},[["__scopeId","data-v-0d3f793e"]]),Re=t.defineComponent({props:{iconClass:{type:String,required:!0},className:{type:String,default:""},color:{type:String,default:""}},setup(o){return{iconName:t.computed(()=>`#icon-${o.iconClass}`),svgClass:t.computed(()=>o.className?`svg-icon ${o.className}`:"svg-icon")}}}),Ue=["xlink:href","fill"];function Qe(o,m,N,x,a,v){return t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(o.svgClass),"aria-hidden":"true"},[t.createElementVNode("use",{"xlink:href":o.iconName,fill:o.color},null,8,Ue)],2)}const Ge=Ee(Re,[["render",Qe]]);le.install=o=>{o.component("ElCheckbox",j.ElCheckbox),o.component("ElIcon",j.ElIcon),o.component("ElDropdown",j.ElDropdown),o.component("ElDropdownMenu",j.ElDropdownMenu),o.component("ElDropdownItem",j.ElDropdownItem),o.component("SvgIcon",Ge),o.component("HydroGraph",le)},H.HydroGraph=le,H.default=le,Object.defineProperties(H,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hydro-graph",
3
- "version": "1.0.38",
3
+ "version": "1.0.42",
4
4
  "description": "A Vue 3 component for hydrograph visualization using ECharts",
5
5
  "main": "dist/hydro-graph.umd.js",
6
6
  "module": "dist/hydro-graph.es.js",