hydro-graph 1.0.4 → 1.0.6
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.
- package/dist/hydro-graph.es.js +1 -1
- package/dist/hydro-graph.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
package/dist/hydro-graph.es.js
CHANGED
|
@@ -29418,7 +29418,7 @@ ${L.name}: {a0|${G.data.coord[1]}} ${L.unit}`;
|
|
|
29418
29418
|
]);
|
|
29419
29419
|
};
|
|
29420
29420
|
}
|
|
29421
|
-
}, Py = /* @__PURE__ */ ky(Ck, [["__scopeId", "data-v-
|
|
29421
|
+
}, Py = /* @__PURE__ */ ky(Ck, [["__scopeId", "data-v-f5865c11"]]);
|
|
29422
29422
|
if (typeof window < "u") {
|
|
29423
29423
|
let t = function() {
|
|
29424
29424
|
var e = document.body, A = document.getElementById("__svg__icons__dom__");
|
package/dist/hydro-graph.umd.js
CHANGED
|
@@ -118,4 +118,4 @@ ${W.name}: ${W.value} ${W.unit}}`}),z}else{let z="";return(f.includes(w.name)||w
|
|
|
118
118
|
${w.seriesName}: ${te[1]} ${M.unit}`,label:{offset:oe||[-120,0]}}],C.value.series[ce].markPoint={symbol:"pin",symbolSize:20,label:{show:!0,position:"top",align:"left",fontSize:16,backgroundColor:M.backgroundColor?M.backgroundColor:i[M.name]?i[M.name].color:M.color,borderRadius:6,shadowColor:"#666666",shadowBlur:5,shadowOffsetX:3,shadowOffsetY:3,fontWeight:"bold",padding:[4,4,4,4],lineHeight:30,color:M.markPointColor?M.markPointColor:"#fff",formatter:z=>{let W="",me=M.tmType?M.tmType:"YYYY-MM-DD HH:mm";z.data&&z.data.coord&&z.data.coord[0]&&(W=we(z.data.coord[0]).format(me));let Ae="",ue="";if(z.name=="Max"||z.name=="Min"){if(z.name=="Max")return Ae=M.maxText?M.maxText:"最大值",M.unit.includes("m³")?ue=z.value?Ii(z.value):"--":M.unit.includes("mm")?ue=z.value?Number(z.value).toFixed(1):"--":M.unit.includes("m")?ue=z.value?Number(z.value).toFixed(2):"--":ue=z.value,M.tmText?`${Ae}: {a0|${ue}} ${M.unit}
|
|
119
119
|
${M.tmText}: {a1|${W}}`:`${M.tmText2?M.tmText2:"相应时间"}: {a1|${W}}
|
|
120
120
|
${Ae}: {a0|${ue}} ${M.unit}`}else return`相应时间: {a1|${we(z.data.coord[0]).format(me)}}
|
|
121
|
-
${M.name}: {a0|${z.data.coord[1]}} ${M.unit}`},rich:{a0:{fontSize:25,fontFamily:"Times New Roman"},a1:{fontSize:20,fontFamily:"Times New Roman"}}},data:k},C.value.dataZoom[0]={...(J=m.getOption())==null?void 0:J.dataZoom[0]},m.setOption(C.value,!0),m.getOption().series.map(z=>{z.markPoint&&(p[z.name]=z.markPoint)})}}}),m.on("mousedown",function(w){m.setOption({tooltip:{show:!1}}),m.dispatchAction({type:"hideTip"});let J=w.seriesIndex,M=n.chartOption.series[J],te=M.stepTM?M.stepTM:60,ce="",_e="",ee="";if(M.openBarDrag){let k={},oe={},z=n.chartOption.yAxis[M.yAxisIndex],W=[];w.componentType=="markLine"&&M.data.name=="xAxis"?W=C.value.series.map((ge,Ne)=>ge.name=="开始"||ge.name=="结束"?JSON.parse(JSON.stringify(ge)):{}):W=C.value.series.map((ge,Ne)=>Ne==J?{data:JSON.parse(JSON.stringify(ge.data))}:{});let me,Ae,ue;n.chartOption.fixedTimePeriod&&(ce=n.chartOption.series.find(ge=>ge.name=="开始").data.value,_e=n.chartOption.series.find(ge=>ge.name=="结束").data.value,ee=we(_e).diff(we(ce),"hour")),m.getZr().off("mousemove"),m.getZr().off("mouseup"),m.getZr().on("mousemove",function(ge){if(w.componentType=="markLine"&&M.data.name=="xAxis"){let Ne=m.convertFromPixel({xAxisIndex:M.xAxisIndex},ge.offsetX),We=we(Ne).format("YYYY-MM-DD HH:00");if(We!==me){const vt=we(We),kt=we(P[P.length-1]),Mu=se?we(se):"";if(vt.isAfter(kt)||vt.isBefore(Mu))return;if(n.chartOption.fixedTimePeriod){if(M.name=="开始"?ue=we(We).add(ee,"hours").format("YYYY-MM-DD HH:00"):M.name=="结束"&&(ue=we(We).add(-ee,"hours").format("YYYY-MM-DD HH:00")),M.name=="开始"&&we(ue).isAfter(kt))return;if(M.name=="结束"&&we(ue).isBefore(Mu))return;W.forEach(Je=>{M.name=="开始"?Je.name=="开始"?(Je.markLine.data[0].xAxis=We,Je.markArea.data[0][0].xAxis=We,Je.markArea.data[0][1].xAxis=ue):Je.name=="结束"&&(Je.markLine.data[0].xAxis=ue):M.name=="结束"&&(Je.name=="开始"?(Je.markLine.data[0].xAxis=ue,Je.markArea.data[0][0].xAxis=ue,Je.markArea.data[0][1].xAxis=We):Je.name=="结束"&&(Je.markLine.data[0].xAxis=We))})}else W.forEach(Je=>{M.name=="开始"?Je.name=="开始"&&(Je.markLine.data[0].xAxis=We,Je.markArea.data[0][0].xAxis=We):M.name=="结束"&&(Je.name=="开始"?Je.markArea.data[0][1].xAxis=We:Je.name=="结束"&&(Je.markLine.data[0].xAxis=We))});m.setOption({series:W},{notMerge:!1,lazyUpdate:!0}),me=We}}else{let[Ne,We]=m.convertFromPixel({seriesIndex:J},[ge.offsetX,ge.offsetY]);if(we(Ne).format("YYYY-MM-DD HH:00")!==me||!Ae||Math.abs(We-Ae)>=.5){const vt=we(Ne).format("YYYY-MM-DD HH:00");oe[vt]=We;let kt=Object.keys(oe),Mu=new Set(kt);W[J].data.forEach(TA=>{Mu.has(TA[0])&&(TA[1]=oe[TA[0]])});let Je=OC(new Date(kt[0]),new Date(kt[kt.length-1]),te),wd=Object.entries(oe),$N=new Set(kt);Je.forEach(TA=>{$N.has(TA)||wd.push(ie(wd,TA))});let Qo={};wd.forEach(TA=>{Qo[TA[0]]=TA[1]});let qN=Object.keys(Qo),jN=new Set(qN);W[J].data.forEach(TA=>{if(jN.has(TA[0])){let Hu="";z.name.includes("m³")?Hu=Ii(Qo[TA[0]]):z.name.includes("mm")?Hu=Qo[TA[0]].toFixed(1):z.name.includes("m")&&(Hu=Qo[TA[0]].toFixed(2)),TA[1]=Hu}}),m.setOption({series:W},{notMerge:!1,lazyUpdate:!0}),me=vt,Ae=We}}}),m.getZr().on("mouseup",function(){if(m.getZr().off("mousemove"),m.getZr().off("mouseup"),w.componentType=="markLine"&&M.data.name=="xAxis"){if(me)if(ue){const ge=we(P[P.length-1]),Ne=se?we(se):"";M.name=="开始"&&we(ue).isAfter(ge)?ue=we(me).add(ee,"hours").format("YYYY-MM-DD HH:00"):M.name=="结束"&&we(ue).isBefore(Ne)&&(ue=we(me).add(-ee,"hours").format("YYYY-MM-DD HH:00")),k={name:"开始/结束",value:M.name=="开始"?`${me}/${ue}`:`${ue}/${me}`}}else k={name:M.name,value:me}}else k={name:w.seriesName,data:W[J].data};k.name&&a("getNewSeriesData",k),m.getZr().on("mousemove",function(ge){let Ne=ge.offsetX,We=ge.offsetY;m.dispatchAction({type:"showTip",x:Ne,y:We})})})}}),window.onresize=function(){m.resize()}},F=O=>{L.nextTick(()=>{m&&m.resize()})},E=(O,N)=>{m.dispatchAction({type:N?"legendSelect":"legendUnSelect",name:O})};function U(O){return O.month()===0&&O.date()===1&&O.hour()===0&&O.minute()===0}function x(O){O.preventDefault();let N=document.querySelector("body .chartMenu");N&&N.remove();let H=O.pageX,K=O.pageY,P=document.createElement("ul");P.style.position="absolute",P.style.left=H+"px",P.style.top=K+"px",P.className="chartMenu";let se=document.createElement("li");se.style.cursor="pointer",se.innerHTML=`<div><img src='${VN}'><span>还原缩放</span></div>`,P.appendChild(se);let ne=document.createElement("li");ne.style.cursor="pointer",ne.innerHTML=`<div><img src='${GN}'><span>复制图片</span></div>`,P.appendChild(ne);let xe=document.createElement("li");xe.style.cursor="pointer",xe.innerHTML=`<div><img src='${zN}'><span>导出图片</span></div>`,P.appendChild(xe),se.addEventListener("click",()=>{m.dispatchAction({type:"dataZoom",dataZoomIndex:0,start:0,end:100})}),ne.addEventListener("click",()=>{N1(r.value,{useCORS:!0,scale:2,width:r.value.offsetWidth,height:r.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(Ie=>{const V=Ie.toDataURL("image/png"),le=b(V,"图片");I(le),K1.ElMessage.success("复制成功")})}),xe.addEventListener("click",()=>{R()}),document.body.appendChild(P),document.addEventListener("click",()=>{P.parentNode&&document.body.removeChild(P)})}const b=(O,N="file")=>{const H=O.split(","),K=H[0].match(/:(.*?);/)[1],P=K.split("/")[1],se=window.atob(H[1]);let ne=se.length;const xe=new Uint8Array(ne);for(;ne--;)xe[ne]=se.charCodeAt(ne);return new File([xe],`${N}.${P}`,{type:K})},I=O=>{const N=new FileReader;N.onload=H=>{const K=H.target.result.toString(),P=new Image;P.src=K,P.onload=()=>{let se=T(P),ne=D(se.replace("data:image/png;base64,",""),"image/png",512);navigator.clipboard.write([new ClipboardItem({"image/png":ne})])}},N.readAsDataURL(O)},T=O=>{let N=document.createElement("canvas");return N.width=O.width,N.height=O.height,N.getContext("2d").drawImage(O,0,0,O.width,O.height),N.toDataURL("image/png")},D=(O,N,H)=>{N=N||"",H=H||512;let K=window.atob(O),P=[];for(let ne=0;ne<K.length;ne+=H){let xe=K.slice(ne,ne+H),Ie=new Array(xe.length);for(let le=0;le<xe.length;le++)Ie[le]=xe.charCodeAt(le);let V=new Uint8Array(Ie);P.push(V)}return new Blob(P,{type:N})},R=()=>{N1(r.value,{useCORS:!0,scale:1,width:r.value.offsetWidth,height:r.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(O=>{const N=O.toDataURL("image/png"),H=document.createElement("a");H.href=N,H.download=n.chartOption.title,H.click()})},$=L.ref();function G(){return $.value?$.value.offsetHeight:0}function X(O,N){return new Promise(H=>{p2({STCD:n.chartOption.stationCode,rzw:O,rzwType:"rz"}).then(K=>{K.statusCode==200&&K.data?H(K.data):H(N*1e3)})})}function ie(O,N){if(O.length>0){let H=O.filter(P=>we(P[0]).isBefore(we(N))),K=O.filter(P=>we(P[0]).isAfter(we(N)));if(H.length==0)return[N,K[0][1]];if(K.length==0)return[N,H[H.length-1][1]];{let P=we(N).diff(we(H[H.length-1][0]),"seconds"),se=K[0][1]-H[H.length-1][1],ne=we(K[0][0]).diff(we(H[H.length-1][0]),"seconds"),xe=P*se/ne+H[H.length-1][1];return[N,Number(xe)]}}}function ve(O){var ne;let N=(ne=n.chartOption.series.find(xe=>xe.name=="开始"))==null?void 0:ne.data.value;const H=we(N),K=we(O),P=H.year()===K.year();return P&&H.month()===K.month()?K.format("DD HH:mm"):P?K.format("MM-DD HH:mm"):K.format("YYYY-MM-DD HH:mm")}return e({getLegendBoxHeight:G,onChange:g}),(O,N)=>{const H=L.resolveComponent("el-checkbox"),K=_d,P=L.resolveComponent("el-icon"),se=L.resolveComponent("el-dropdown-item"),ne=L.resolveComponent("el-dropdown-menu"),xe=L.resolveComponent("el-dropdown"),Ie=L.resolveDirective("resize");return L.withDirectives((L.openBlock(),L.createElementBlock("div",{class:"box",ref_key:"chartBox",ref:r,onContextmenu:N[1]||(N[1]=V=>x(V))},[L.withDirectives((L.openBlock(),L.createElementBlock("div",WN,[L.createTextVNode(L.toDisplayString(t.chartOption.title),1)])),[[L.vShow,t.chartOption.title],[Ie,F]]),L.withDirectives((L.openBlock(),L.createElementBlock("div",YN,[L.createTextVNode(L.toDisplayString(t.chartOption.subTitle),1)])),[[L.vShow,t.chartOption.subTitle],[Ie,F]]),L.withDirectives((L.openBlock(),L.createElementBlock("div",{class:"legend-box",ref_key:"myLegend",ref:$},[c.value.length>1?(L.openBlock(),L.createBlock(H,{key:0,modelValue:h.value,"onUpdate:modelValue":N[0]||(N[0]=V=>h.value=V),label:"全选",onChange:d,style:{"--fill-color":"#409EFF"}},null,8,["modelValue"])):L.createCommentVNode("",!0),(L.openBlock(!0),L.createElementBlock(L.Fragment,null,L.renderList(c.value,(V,le)=>(L.openBlock(),L.createElementBlock(L.Fragment,{key:le},[V.children?L.createCommentVNode("",!0):(L.openBlock(),L.createBlock(H,{key:0,modelValue:V.isSelected,"onUpdate:modelValue":Se=>V.isSelected=Se,onChange:Se=>g(Se,V.name),style:L.normalizeStyle({"--fill-color":V.color?V.color:"#409EFF"})},{default:L.withCtx(()=>[V.icon?(L.openBlock(),L.createBlock(K,{key:0,"icon-class":V.icon,style:L.normalizeStyle({width:V.iconWidth?V.iconWidth+"px":"20px",height:V.iconHeight?V.iconHeight+"px":"20px"}),color:V.color},null,8,["icon-class","style","color"])):L.createCommentVNode("",!0),L.createElementVNode("span",{style:L.normalizeStyle({color:V.color,marginLeft:"3px"})},L.toDisplayString(V.key?V.key:V.name),5),V.children&&V.children.length>0?(L.openBlock(),L.createBlock(P,{key:1,class:"el-icon--right"},{default:L.withCtx(()=>[L.createVNode(L.unref(k1))]),_:1})):L.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])),V.children&&V.children.length>0?(L.openBlock(),L.createBlock(xe,{key:1,"hide-on-click":!1},{dropdown:L.withCtx(()=>[L.createVNode(ne,null,{default:L.withCtx(()=>[(L.openBlock(!0),L.createElementBlock(L.Fragment,null,L.renderList(V.children,(Se,AA)=>(L.openBlock(),L.createBlock(se,{key:AA},{default:L.withCtx(()=>[L.createVNode(H,{modelValue:Se.isSelected,"onUpdate:modelValue":Nt=>Se.isSelected=Nt,onChange:Nt=>g(Nt,Se.name),style:L.normalizeStyle({"--fill-color":Se.color?Se.color:"#409EFF"})},{default:L.withCtx(()=>[L.createElementVNode("div",XN,[Se.icon?(L.openBlock(),L.createBlock(K,{key:0,"icon-class":Se.icon,style:L.normalizeStyle({width:Se.iconWidth?Se.iconWidth+"px":"20px",height:Se.iconHeight?Se.iconHeight+"px":"20px"}),color:Se.color},null,8,["icon-class","style","color"])):L.createCommentVNode("",!0)]),L.createElementVNode("span",{style:L.normalizeStyle({color:Se.color,marginLeft:"3px"})},L.toDisplayString(Se.key?Se.key:Se.name),5)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024))),128))]),_:2},1024)]),default:L.withCtx(()=>[L.createVNode(H,{modelValue:V.isSelected,"onUpdate:modelValue":Se=>V.isSelected=Se,onChange:Se=>g(Se,V.name),style:L.normalizeStyle({"--fill-color":V.color?V.color:"#409EFF"})},{default:L.withCtx(()=>[V.icon?(L.openBlock(),L.createBlock(K,{key:0,"icon-class":V.icon,style:L.normalizeStyle({width:V.iconWidth?V.iconWidth+"px":"20px",height:V.iconHeight?V.iconHeight+"px":"20px"}),color:V.color},null,8,["icon-class","style","color"])):L.createCommentVNode("",!0),L.createElementVNode("span",{style:L.normalizeStyle({color:V.color,marginLeft:"3px"})},L.toDisplayString(V.key?V.key:V.name),5),V.children&&V.children.length>0?(L.openBlock(),L.createBlock(P,{key:1,class:"el-icon--right"},{default:L.withCtx(()=>[L.createVNode(L.unref(k1))]),_:1})):L.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024)):L.createCommentVNode("",!0)],64))),128))])),[[Ie,F]]),L.createElementVNode("div",ZN,[L.createElementVNode("div",{id:t.id,style:L.normalizeStyle({width:t.width,height:t.height})},null,12,JN)])],32)),[[Ie,F]])}}},[["__scopeId","data-v-bae20fc6"]]),rk="";if(typeof window<"u"){let t=function(){var e=document.body,A=document.getElementById("__svg__icons__dom__");A||(A=document.createElementNS("http://www.w3.org/2000/svg","svg"),A.style.position="absolute",A.style.width="0",A.style.height="0",A.id="__svg__icons__dom__",A.setAttribute("xmlns","http://www.w3.org/2000/svg"),A.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),A.innerHTML='<symbol class="icon" viewBox="0 0 1024 1024" id="icon-dotted"><path d="M223.962 607.898c-52.98 0-95.984-43.004-95.984-95.984s43.004-95.984 95.984-95.984 95.984 43.004 95.984 95.984-43.003 95.984-95.984 95.984zM511.914 607.898c-52.98 0-95.984-43.004-95.984-95.984s43.004-95.984 95.984-95.984 95.984 43.004 95.984 95.984-43.004 95.984-95.984 95.984zM800.038 607.898c-52.98 0-95.984-43.004-95.984-95.984s43.003-95.984 95.984-95.984 95.984 43.004 95.984 95.984-43.176 95.984-95.984 95.984z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-dottedLine"><path d="M801.171 547.589H222.83c-17.673 0-32-14.327-32-32s14.327-32 32-32h578.341c17.673 0 32 14.327 32 32s-14.327 32-32 32z" /><path d="M380.928 512a131.072 131.072 0 1 0 262.144 0 131.072 131.072 0 1 0-262.144 0Z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-histogram"><path d="M426.667 170.667v682.666h170.666V170.667H426.667zM170.667 384v469.333h170.666V384H170.667zm512 170.667v298.666h170.666V554.667H682.667z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-straightLine"><path d="M801.171 547.589H222.83c-17.673 0-32-14.327-32-32s14.327-32 32-32h578.341c17.673 0 32 14.327 32 32s-14.327 32-32 32z" /></symbol>',e.insertBefore(A,e.lastChild)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}Lu.install=t=>{t.component("SvgIcon",_d),t.component("HydroGraph",Lu)},Ft.HydroGraph=Lu,Ft.default=Lu,Object.defineProperties(Ft,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
121
|
+
${M.name}: {a0|${z.data.coord[1]}} ${M.unit}`},rich:{a0:{fontSize:25,fontFamily:"Times New Roman"},a1:{fontSize:20,fontFamily:"Times New Roman"}}},data:k},C.value.dataZoom[0]={...(J=m.getOption())==null?void 0:J.dataZoom[0]},m.setOption(C.value,!0),m.getOption().series.map(z=>{z.markPoint&&(p[z.name]=z.markPoint)})}}}),m.on("mousedown",function(w){m.setOption({tooltip:{show:!1}}),m.dispatchAction({type:"hideTip"});let J=w.seriesIndex,M=n.chartOption.series[J],te=M.stepTM?M.stepTM:60,ce="",_e="",ee="";if(M.openBarDrag){let k={},oe={},z=n.chartOption.yAxis[M.yAxisIndex],W=[];w.componentType=="markLine"&&M.data.name=="xAxis"?W=C.value.series.map((ge,Ne)=>ge.name=="开始"||ge.name=="结束"?JSON.parse(JSON.stringify(ge)):{}):W=C.value.series.map((ge,Ne)=>Ne==J?{data:JSON.parse(JSON.stringify(ge.data))}:{});let me,Ae,ue;n.chartOption.fixedTimePeriod&&(ce=n.chartOption.series.find(ge=>ge.name=="开始").data.value,_e=n.chartOption.series.find(ge=>ge.name=="结束").data.value,ee=we(_e).diff(we(ce),"hour")),m.getZr().off("mousemove"),m.getZr().off("mouseup"),m.getZr().on("mousemove",function(ge){if(w.componentType=="markLine"&&M.data.name=="xAxis"){let Ne=m.convertFromPixel({xAxisIndex:M.xAxisIndex},ge.offsetX),We=we(Ne).format("YYYY-MM-DD HH:00");if(We!==me){const vt=we(We),kt=we(P[P.length-1]),Mu=se?we(se):"";if(vt.isAfter(kt)||vt.isBefore(Mu))return;if(n.chartOption.fixedTimePeriod){if(M.name=="开始"?ue=we(We).add(ee,"hours").format("YYYY-MM-DD HH:00"):M.name=="结束"&&(ue=we(We).add(-ee,"hours").format("YYYY-MM-DD HH:00")),M.name=="开始"&&we(ue).isAfter(kt))return;if(M.name=="结束"&&we(ue).isBefore(Mu))return;W.forEach(Je=>{M.name=="开始"?Je.name=="开始"?(Je.markLine.data[0].xAxis=We,Je.markArea.data[0][0].xAxis=We,Je.markArea.data[0][1].xAxis=ue):Je.name=="结束"&&(Je.markLine.data[0].xAxis=ue):M.name=="结束"&&(Je.name=="开始"?(Je.markLine.data[0].xAxis=ue,Je.markArea.data[0][0].xAxis=ue,Je.markArea.data[0][1].xAxis=We):Je.name=="结束"&&(Je.markLine.data[0].xAxis=We))})}else W.forEach(Je=>{M.name=="开始"?Je.name=="开始"&&(Je.markLine.data[0].xAxis=We,Je.markArea.data[0][0].xAxis=We):M.name=="结束"&&(Je.name=="开始"?Je.markArea.data[0][1].xAxis=We:Je.name=="结束"&&(Je.markLine.data[0].xAxis=We))});m.setOption({series:W},{notMerge:!1,lazyUpdate:!0}),me=We}}else{let[Ne,We]=m.convertFromPixel({seriesIndex:J},[ge.offsetX,ge.offsetY]);if(we(Ne).format("YYYY-MM-DD HH:00")!==me||!Ae||Math.abs(We-Ae)>=.5){const vt=we(Ne).format("YYYY-MM-DD HH:00");oe[vt]=We;let kt=Object.keys(oe),Mu=new Set(kt);W[J].data.forEach(TA=>{Mu.has(TA[0])&&(TA[1]=oe[TA[0]])});let Je=OC(new Date(kt[0]),new Date(kt[kt.length-1]),te),wd=Object.entries(oe),$N=new Set(kt);Je.forEach(TA=>{$N.has(TA)||wd.push(ie(wd,TA))});let Qo={};wd.forEach(TA=>{Qo[TA[0]]=TA[1]});let qN=Object.keys(Qo),jN=new Set(qN);W[J].data.forEach(TA=>{if(jN.has(TA[0])){let Hu="";z.name.includes("m³")?Hu=Ii(Qo[TA[0]]):z.name.includes("mm")?Hu=Qo[TA[0]].toFixed(1):z.name.includes("m")&&(Hu=Qo[TA[0]].toFixed(2)),TA[1]=Hu}}),m.setOption({series:W},{notMerge:!1,lazyUpdate:!0}),me=vt,Ae=We}}}),m.getZr().on("mouseup",function(){if(m.getZr().off("mousemove"),m.getZr().off("mouseup"),w.componentType=="markLine"&&M.data.name=="xAxis"){if(me)if(ue){const ge=we(P[P.length-1]),Ne=se?we(se):"";M.name=="开始"&&we(ue).isAfter(ge)?ue=we(me).add(ee,"hours").format("YYYY-MM-DD HH:00"):M.name=="结束"&&we(ue).isBefore(Ne)&&(ue=we(me).add(-ee,"hours").format("YYYY-MM-DD HH:00")),k={name:"开始/结束",value:M.name=="开始"?`${me}/${ue}`:`${ue}/${me}`}}else k={name:M.name,value:me}}else k={name:w.seriesName,data:W[J].data};k.name&&a("getNewSeriesData",k),m.getZr().on("mousemove",function(ge){let Ne=ge.offsetX,We=ge.offsetY;m.dispatchAction({type:"showTip",x:Ne,y:We})})})}}),window.onresize=function(){m.resize()}},F=O=>{L.nextTick(()=>{m&&m.resize()})},E=(O,N)=>{m.dispatchAction({type:N?"legendSelect":"legendUnSelect",name:O})};function U(O){return O.month()===0&&O.date()===1&&O.hour()===0&&O.minute()===0}function x(O){O.preventDefault();let N=document.querySelector("body .chartMenu");N&&N.remove();let H=O.pageX,K=O.pageY,P=document.createElement("ul");P.style.position="absolute",P.style.left=H+"px",P.style.top=K+"px",P.className="chartMenu";let se=document.createElement("li");se.style.cursor="pointer",se.innerHTML=`<div><img src='${VN}'><span>还原缩放</span></div>`,P.appendChild(se);let ne=document.createElement("li");ne.style.cursor="pointer",ne.innerHTML=`<div><img src='${GN}'><span>复制图片</span></div>`,P.appendChild(ne);let xe=document.createElement("li");xe.style.cursor="pointer",xe.innerHTML=`<div><img src='${zN}'><span>导出图片</span></div>`,P.appendChild(xe),se.addEventListener("click",()=>{m.dispatchAction({type:"dataZoom",dataZoomIndex:0,start:0,end:100})}),ne.addEventListener("click",()=>{N1(r.value,{useCORS:!0,scale:2,width:r.value.offsetWidth,height:r.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(Ie=>{const V=Ie.toDataURL("image/png"),le=b(V,"图片");I(le),K1.ElMessage.success("复制成功")})}),xe.addEventListener("click",()=>{R()}),document.body.appendChild(P),document.addEventListener("click",()=>{P.parentNode&&document.body.removeChild(P)})}const b=(O,N="file")=>{const H=O.split(","),K=H[0].match(/:(.*?);/)[1],P=K.split("/")[1],se=window.atob(H[1]);let ne=se.length;const xe=new Uint8Array(ne);for(;ne--;)xe[ne]=se.charCodeAt(ne);return new File([xe],`${N}.${P}`,{type:K})},I=O=>{const N=new FileReader;N.onload=H=>{const K=H.target.result.toString(),P=new Image;P.src=K,P.onload=()=>{let se=T(P),ne=D(se.replace("data:image/png;base64,",""),"image/png",512);navigator.clipboard.write([new ClipboardItem({"image/png":ne})])}},N.readAsDataURL(O)},T=O=>{let N=document.createElement("canvas");return N.width=O.width,N.height=O.height,N.getContext("2d").drawImage(O,0,0,O.width,O.height),N.toDataURL("image/png")},D=(O,N,H)=>{N=N||"",H=H||512;let K=window.atob(O),P=[];for(let ne=0;ne<K.length;ne+=H){let xe=K.slice(ne,ne+H),Ie=new Array(xe.length);for(let le=0;le<xe.length;le++)Ie[le]=xe.charCodeAt(le);let V=new Uint8Array(Ie);P.push(V)}return new Blob(P,{type:N})},R=()=>{N1(r.value,{useCORS:!0,scale:1,width:r.value.offsetWidth,height:r.value.offsetHeight+50,backgroundColor:"#fff",allowTaint:!0,removeContainer:!0}).then(O=>{const N=O.toDataURL("image/png"),H=document.createElement("a");H.href=N,H.download=n.chartOption.title,H.click()})},$=L.ref();function G(){return $.value?$.value.offsetHeight:0}function X(O,N){return new Promise(H=>{p2({STCD:n.chartOption.stationCode,rzw:O,rzwType:"rz"}).then(K=>{K.statusCode==200&&K.data?H(K.data):H(N*1e3)})})}function ie(O,N){if(O.length>0){let H=O.filter(P=>we(P[0]).isBefore(we(N))),K=O.filter(P=>we(P[0]).isAfter(we(N)));if(H.length==0)return[N,K[0][1]];if(K.length==0)return[N,H[H.length-1][1]];{let P=we(N).diff(we(H[H.length-1][0]),"seconds"),se=K[0][1]-H[H.length-1][1],ne=we(K[0][0]).diff(we(H[H.length-1][0]),"seconds"),xe=P*se/ne+H[H.length-1][1];return[N,Number(xe)]}}}function ve(O){var ne;let N=(ne=n.chartOption.series.find(xe=>xe.name=="开始"))==null?void 0:ne.data.value;const H=we(N),K=we(O),P=H.year()===K.year();return P&&H.month()===K.month()?K.format("DD HH:mm"):P?K.format("MM-DD HH:mm"):K.format("YYYY-MM-DD HH:mm")}return e({getLegendBoxHeight:G,onChange:g}),(O,N)=>{const H=L.resolveComponent("el-checkbox"),K=_d,P=L.resolveComponent("el-icon"),se=L.resolveComponent("el-dropdown-item"),ne=L.resolveComponent("el-dropdown-menu"),xe=L.resolveComponent("el-dropdown"),Ie=L.resolveDirective("resize");return L.withDirectives((L.openBlock(),L.createElementBlock("div",{class:"box",ref_key:"chartBox",ref:r,onContextmenu:N[1]||(N[1]=V=>x(V))},[L.withDirectives((L.openBlock(),L.createElementBlock("div",WN,[L.createTextVNode(L.toDisplayString(t.chartOption.title),1)])),[[L.vShow,t.chartOption.title],[Ie,F]]),L.withDirectives((L.openBlock(),L.createElementBlock("div",YN,[L.createTextVNode(L.toDisplayString(t.chartOption.subTitle),1)])),[[L.vShow,t.chartOption.subTitle],[Ie,F]]),L.withDirectives((L.openBlock(),L.createElementBlock("div",{class:"legend-box",ref_key:"myLegend",ref:$},[c.value.length>1?(L.openBlock(),L.createBlock(H,{key:0,modelValue:h.value,"onUpdate:modelValue":N[0]||(N[0]=V=>h.value=V),label:"全选",onChange:d,style:{"--fill-color":"#409EFF"}},null,8,["modelValue"])):L.createCommentVNode("",!0),(L.openBlock(!0),L.createElementBlock(L.Fragment,null,L.renderList(c.value,(V,le)=>(L.openBlock(),L.createElementBlock(L.Fragment,{key:le},[V.children?L.createCommentVNode("",!0):(L.openBlock(),L.createBlock(H,{key:0,modelValue:V.isSelected,"onUpdate:modelValue":Se=>V.isSelected=Se,onChange:Se=>g(Se,V.name),style:L.normalizeStyle({"--fill-color":V.color?V.color:"#409EFF"})},{default:L.withCtx(()=>[V.icon?(L.openBlock(),L.createBlock(K,{key:0,"icon-class":V.icon,style:L.normalizeStyle({width:V.iconWidth?V.iconWidth+"px":"20px",height:V.iconHeight?V.iconHeight+"px":"20px"}),color:V.color},null,8,["icon-class","style","color"])):L.createCommentVNode("",!0),L.createElementVNode("span",{style:L.normalizeStyle({color:V.color,marginLeft:"3px"})},L.toDisplayString(V.key?V.key:V.name),5),V.children&&V.children.length>0?(L.openBlock(),L.createBlock(P,{key:1,class:"el-icon--right"},{default:L.withCtx(()=>[L.createVNode(L.unref(k1))]),_:1})):L.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])),V.children&&V.children.length>0?(L.openBlock(),L.createBlock(xe,{key:1,"hide-on-click":!1},{dropdown:L.withCtx(()=>[L.createVNode(ne,null,{default:L.withCtx(()=>[(L.openBlock(!0),L.createElementBlock(L.Fragment,null,L.renderList(V.children,(Se,AA)=>(L.openBlock(),L.createBlock(se,{key:AA},{default:L.withCtx(()=>[L.createVNode(H,{modelValue:Se.isSelected,"onUpdate:modelValue":Nt=>Se.isSelected=Nt,onChange:Nt=>g(Nt,Se.name),style:L.normalizeStyle({"--fill-color":Se.color?Se.color:"#409EFF"})},{default:L.withCtx(()=>[L.createElementVNode("div",XN,[Se.icon?(L.openBlock(),L.createBlock(K,{key:0,"icon-class":Se.icon,style:L.normalizeStyle({width:Se.iconWidth?Se.iconWidth+"px":"20px",height:Se.iconHeight?Se.iconHeight+"px":"20px"}),color:Se.color},null,8,["icon-class","style","color"])):L.createCommentVNode("",!0)]),L.createElementVNode("span",{style:L.normalizeStyle({color:Se.color,marginLeft:"3px"})},L.toDisplayString(Se.key?Se.key:Se.name),5)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024))),128))]),_:2},1024)]),default:L.withCtx(()=>[L.createVNode(H,{modelValue:V.isSelected,"onUpdate:modelValue":Se=>V.isSelected=Se,onChange:Se=>g(Se,V.name),style:L.normalizeStyle({"--fill-color":V.color?V.color:"#409EFF"})},{default:L.withCtx(()=>[V.icon?(L.openBlock(),L.createBlock(K,{key:0,"icon-class":V.icon,style:L.normalizeStyle({width:V.iconWidth?V.iconWidth+"px":"20px",height:V.iconHeight?V.iconHeight+"px":"20px"}),color:V.color},null,8,["icon-class","style","color"])):L.createCommentVNode("",!0),L.createElementVNode("span",{style:L.normalizeStyle({color:V.color,marginLeft:"3px"})},L.toDisplayString(V.key?V.key:V.name),5),V.children&&V.children.length>0?(L.openBlock(),L.createBlock(P,{key:1,class:"el-icon--right"},{default:L.withCtx(()=>[L.createVNode(L.unref(k1))]),_:1})):L.createCommentVNode("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange","style"])]),_:2},1024)):L.createCommentVNode("",!0)],64))),128))])),[[Ie,F]]),L.createElementVNode("div",ZN,[L.createElementVNode("div",{id:t.id,style:L.normalizeStyle({width:t.width,height:t.height})},null,12,JN)])],32)),[[Ie,F]])}}},[["__scopeId","data-v-f5865c11"]]),rk="";if(typeof window<"u"){let t=function(){var e=document.body,A=document.getElementById("__svg__icons__dom__");A||(A=document.createElementNS("http://www.w3.org/2000/svg","svg"),A.style.position="absolute",A.style.width="0",A.style.height="0",A.id="__svg__icons__dom__",A.setAttribute("xmlns","http://www.w3.org/2000/svg"),A.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),A.innerHTML='<symbol class="icon" viewBox="0 0 1024 1024" id="icon-dotted"><path d="M223.962 607.898c-52.98 0-95.984-43.004-95.984-95.984s43.004-95.984 95.984-95.984 95.984 43.004 95.984 95.984-43.003 95.984-95.984 95.984zM511.914 607.898c-52.98 0-95.984-43.004-95.984-95.984s43.004-95.984 95.984-95.984 95.984 43.004 95.984 95.984-43.004 95.984-95.984 95.984zM800.038 607.898c-52.98 0-95.984-43.004-95.984-95.984s43.003-95.984 95.984-95.984 95.984 43.004 95.984 95.984-43.176 95.984-95.984 95.984z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-dottedLine"><path d="M801.171 547.589H222.83c-17.673 0-32-14.327-32-32s14.327-32 32-32h578.341c17.673 0 32 14.327 32 32s-14.327 32-32 32z" /><path d="M380.928 512a131.072 131.072 0 1 0 262.144 0 131.072 131.072 0 1 0-262.144 0Z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-histogram"><path d="M426.667 170.667v682.666h170.666V170.667H426.667zM170.667 384v469.333h170.666V384H170.667zm512 170.667v298.666h170.666V554.667H682.667z" /></symbol><symbol class="icon" viewBox="0 0 1024 1024" id="icon-straightLine"><path d="M801.171 547.589H222.83c-17.673 0-32-14.327-32-32s14.327-32 32-32h578.341c17.673 0 32 14.327 32 32s-14.327 32-32 32z" /></symbol>',e.insertBefore(A,e.lastChild)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}Lu.install=t=>{t.component("SvgIcon",_d),t.component("HydroGraph",Lu)},Ft.HydroGraph=Lu,Ft.default=Lu,Object.defineProperties(Ft,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.sub-el-icon,.nav-icon{display:inline-block;font-size:15px;margin-right:12px;position:relative}.svg-icon{width:1em;height:1em;position:relative;fill:currentColor;vertical-align:-2px}.box[data-v-
|
|
1
|
+
.sub-el-icon,.nav-icon{display:inline-block;font-size:15px;margin-right:12px;position:relative}.svg-icon{width:1em;height:1em;position:relative;fill:currentColor;vertical-align:-2px}[data-v-f5865c11]{margin:0;padding:0;list-style-type:none;box-sizing:border-box!important}.box[data-v-f5865c11]{position:relative;width:100%;height:100%;display:flex;flex-direction:column}.box .title[data-v-f5865c11]{color:red;font-size:25px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .subTitle[data-v-f5865c11]{color:#3a4ce1;font-size:14px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .legend-box[data-v-f5865c11]{margin-left:33px;z-index:10;display:flex;align-items:center;flex-wrap:wrap}.box .legend-box>.el-checkbox[data-v-f5865c11]{margin-right:8px}.box .legend-box[data-v-f5865c11] .el-dropdown{margin-right:8px}.box .legend-box[data-v-f5865c11] .el-dropdown .el-tooltip__trigger{display:flex;align-items:center}.box .mychart[data-v-f5865c11]{flex:1;position:relative}.box .mychart[data-v-f5865c11] .line-name-tooltip-style{position:absolute;padding:8px;background:rgba(255,255,255,.95);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-f5865c11] .el-checkbox .el-checkbox__label{color:var(--fill-color);display:flex;align-items:center;padding-left:3px}[data-v-f5865c11] .el-checkbox .el-checkbox__input.is-checked .el-checkbox__inner,[data-v-f5865c11] .el-checkbox .el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--fill-color);border-color:var(--fill-color)!important}[data-v-f5865c11] .el-checkbox .el-checkbox__input.is-focus .el-checkbox__inner,[data-v-f5865c11] .el-checkbox .el-checkbox__inner:hover{border-color:var(--fill-color)!important}*{margin:0;padding:0;list-style-type:none;box-sizing:border-box!important}.box{position:relative;width:100%;height:100%;display:flex;flex-direction:column}.box .title{color:red;font-size:25px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .subTitle{color:#3a4ce1;font-size:14px;font-weight:700;text-align:center;height:25px;line-height:25px}.box .legend-box{margin-left:33px;z-index:10;display:flex;align-items:center;flex-wrap:wrap}.box .legend-box>.el-checkbox{margin-right:8px}.box .legend-box :deep(.el-dropdown){margin-right:8px}.box .legend-box :deep(.el-dropdown) .el-tooltip__trigger{display:flex;align-items:center}.box .mychart{flex:1;position:relative}.box .mychart :deep(.line-name-tooltip-style){position:absolute;padding:8px;background:rgba(255,255,255,.95);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}:deep(.el-checkbox) .el-checkbox__label{color:var(--fill-color);display:flex;align-items:center;padding-left:3px}:deep(.el-checkbox) .el-checkbox__input.is-checked .el-checkbox__inner,:deep(.el-checkbox) .el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--fill-color);border-color:var(--fill-color)!important}:deep(.el-checkbox) .el-checkbox__input.is-focus .el-checkbox__inner,:deep(.el-checkbox) .el-checkbox__inner:hover{border-color:var(--fill-color)!important}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hydro-graph",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
24
|
+
"sass": "^1.98.0",
|
|
24
25
|
"typescript": "^5.0.2",
|
|
25
26
|
"vite": "^4.3.9",
|
|
26
27
|
"vite-plugin-svg-icons": "^2.0.1"
|