vue-data-ui 2.4.20 → 2.4.22
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/{Arrow-TG2JsMwT.js → Arrow-BW_I0Vmx.js} +1 -1
- package/dist/{Arrow-DjiNIFce.cjs → Arrow-D2zjDsxe.cjs} +1 -1
- package/dist/{BaseIcon-D-YgPcX1.cjs → BaseIcon-BCC16NCl.cjs} +1 -1
- package/dist/{BaseIcon-CgiYTpkb.js → BaseIcon-BbbAnrZI.js} +1 -1
- package/dist/{DataTable-B-_LZJ5T.js → DataTable-Ce4R8v-3.js} +2 -2
- package/dist/{DataTable-T6NSDRqO.cjs → DataTable-DeevzR8O.cjs} +1 -1
- package/dist/{Legend-B3KPtqT8.cjs → Legend-BksImVUi.cjs} +1 -1
- package/dist/{Legend-CJnJQbiR.js → Legend-C6q2bLVV.js} +1 -1
- package/dist/{PackageVersion-BjoP5ypd.cjs → PackageVersion-AftniVVo.cjs} +1 -1
- package/dist/{PackageVersion-DHeUFci0.js → PackageVersion-g2UOsY7H.js} +1 -1
- package/dist/{PenAndPaper-BKIQk9Cq.js → PenAndPaper-DRFeGfqV.js} +3 -3
- package/dist/{PenAndPaper-C0H3KJhQ.cjs → PenAndPaper-j5noaKJZ.cjs} +1 -1
- package/dist/{Shape-nQyHwd5x.js → Shape-CBu7ails.js} +1 -1
- package/dist/{Shape-BmBZkR94.cjs → Shape-Cf2Cj3g6.cjs} +1 -1
- package/dist/{Slicer-Cs0G0M7b.js → Slicer-C0bRksfh.js} +58 -58
- package/dist/Slicer-IneBjcpY.cjs +1 -0
- package/dist/{Title-Dl6c1jg0.js → Title-B2orjUIW.js} +1 -1
- package/dist/{Title-Az2QIayC.cjs → Title-BxrsVY3-.cjs} +1 -1
- package/dist/{Tooltip-wdo3yY_W.cjs → Tooltip-BXc56Oxr.cjs} +1 -1
- package/dist/{Tooltip-8UZ341MF.js → Tooltip-CXjc5vb3.js} +1 -1
- package/dist/{index-DsF7Aej7.cjs → index-3oZdQf6G.cjs} +1 -1
- package/dist/{index-C2sScL5o.js → index-D020Kb3z.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{useNestedProp-CuE-kmwp.js → useNestedProp-CZkNAGQh.js} +1 -1
- package/dist/{useNestedProp-D0YHk8Cd.cjs → useNestedProp-vPTP0Wem.cjs} +1 -1
- package/dist/{usePrinter-CUDeluax.cjs → usePrinter-BKzxQK4e.cjs} +1 -1
- package/dist/{usePrinter-CddPH-Ds.js → usePrinter-CN0J0NFL.js} +1 -1
- package/dist/{vue-data-ui-owDqn8Xa.cjs → vue-data-ui-CWDZLUkp.cjs} +1 -1
- package/dist/{vue-data-ui-DqHj_pWh.js → vue-data-ui-e2cclW_4.js} +58 -58
- package/dist/vue-data-ui.cjs +1 -1
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-DJscSRTK.cjs → vue-ui-3d-bar-DCeFCwb0.cjs} +1 -1
- package/dist/{vue-ui-3d-bar-Bp1Qr_3F.js → vue-ui-3d-bar-DggyGAlC.js} +9 -9
- package/dist/{vue-ui-accordion-BH4FO7io.js → vue-ui-accordion-B0fEWLwn.js} +3 -3
- package/dist/{vue-ui-accordion-Av34wbMx.cjs → vue-ui-accordion-QoJofzqF.cjs} +1 -1
- package/dist/{vue-ui-age-pyramid-DbwlbzZl.cjs → vue-ui-age-pyramid-CXtRGpVa.cjs} +1 -1
- package/dist/{vue-ui-age-pyramid-BOPzYxu_.js → vue-ui-age-pyramid-DGDvfcvP.js} +10 -10
- package/dist/{vue-ui-annotator-CGj1ftbP.js → vue-ui-annotator-BETCQ-pV.js} +1 -1
- package/dist/{vue-ui-annotator-Dd0ZkXyj.cjs → vue-ui-annotator-BEZ0D_12.cjs} +1 -1
- package/dist/{vue-ui-bullet-C6D22-Ah.js → vue-ui-bullet-BK3d_nhc.js} +8 -8
- package/dist/{vue-ui-bullet-B1LUeFVN.cjs → vue-ui-bullet-qAGQkwN4.cjs} +1 -1
- package/dist/{vue-ui-candlestick-6kWB1Iz6.js → vue-ui-candlestick-DQR8cYLr.js} +11 -11
- package/dist/{vue-ui-candlestick-BfBmmv4x.cjs → vue-ui-candlestick-DwfFHSRG.cjs} +1 -1
- package/dist/{vue-ui-carousel-table-BFyyF9Ql.js → vue-ui-carousel-table-B6TSxUwp.js} +4 -4
- package/dist/{vue-ui-carousel-table-BdZ2MO_U.cjs → vue-ui-carousel-table-BrIXFgJp.cjs} +1 -1
- package/dist/{vue-ui-chestnut-DjG-n6FA.cjs → vue-ui-chestnut-CWtw_edx.cjs} +1 -1
- package/dist/{vue-ui-chestnut-RzOkxqA7.js → vue-ui-chestnut-CpINqXRz.js} +8 -8
- package/dist/{vue-ui-cursor-B7aO28Bc.cjs → vue-ui-cursor-DvX6FbhZ.cjs} +1 -1
- package/dist/{vue-ui-cursor-CvZS65zZ.js → vue-ui-cursor-yI58QC1O.js} +2 -2
- package/dist/{vue-ui-dashboard-BMaPi8dt.cjs → vue-ui-dashboard-BCic2CfN.cjs} +1 -1
- package/dist/{vue-ui-dashboard-B5xuKqwS.js → vue-ui-dashboard-Bb7vJ0Nx.js} +2 -2
- package/dist/{vue-ui-digits-BMNNUYnH.cjs → vue-ui-digits-C4dI1v6b.cjs} +1 -1
- package/dist/{vue-ui-digits-C8VAWZ3p.js → vue-ui-digits-D4uy7_hL.js} +2 -2
- package/dist/{vue-ui-donut-NsU-zF5W.js → vue-ui-donut-CRiEc5mP.js} +11 -11
- package/dist/{vue-ui-donut-BMhNabzn.cjs → vue-ui-donut-ClvjMOxC.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-Bi3VA_yA.cjs → vue-ui-donut-evolution-DFkGtmhv.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-BpBAko36.js → vue-ui-donut-evolution-DgrQVEh2.js} +11 -11
- package/dist/{vue-ui-dumbbell-Bcyuwjih.cjs → vue-ui-dumbbell-BdkARfxX.cjs} +1 -1
- package/dist/{vue-ui-dumbbell-DcoUMxUR.js → vue-ui-dumbbell-QCB4jZm4.js} +10 -10
- package/dist/{vue-ui-flow-CHtg7-D-.js → vue-ui-flow-CRnCk5Is.js} +9 -9
- package/dist/{vue-ui-flow-C9usdqKR.cjs → vue-ui-flow-CYfdTIad.cjs} +1 -1
- package/dist/{vue-ui-galaxy-DCl7i83C.cjs → vue-ui-galaxy-Cn9t3BG5.cjs} +1 -1
- package/dist/{vue-ui-galaxy-oU6i5aA-.js → vue-ui-galaxy-WhRsA1Is.js} +11 -11
- package/dist/{vue-ui-gauge-Dy2ZQxvF.js → vue-ui-gauge-DwmCZiTj.js} +7 -7
- package/dist/{vue-ui-gauge-C8pggd2h.cjs → vue-ui-gauge-jYskVFUy.cjs} +1 -1
- package/dist/{vue-ui-gizmo-BQdo0Q3v.cjs → vue-ui-gizmo-C2P2qQYU.cjs} +1 -1
- package/dist/{vue-ui-gizmo-CW4t27JP.js → vue-ui-gizmo-DpEZm4Uk.js} +3 -3
- package/dist/{vue-ui-heatmap-CFT-bLNP.cjs → vue-ui-heatmap-D7TGNxC-.cjs} +1 -1
- package/dist/{vue-ui-heatmap-Cdu2Xhjf.js → vue-ui-heatmap-u3SOjwts.js} +10 -10
- package/dist/{vue-ui-kpi-DfRy61t9.cjs → vue-ui-kpi-CCr0pHjp.cjs} +1 -1
- package/dist/{vue-ui-kpi-Dnh9ZTZH.js → vue-ui-kpi-Cdz5RM6j.js} +3 -3
- package/dist/{vue-ui-mini-loader-CLh4mj5Z.js → vue-ui-mini-loader-B2Xh0j5H.js} +2 -2
- package/dist/{vue-ui-mini-loader-CI0Mwg9T.cjs → vue-ui-mini-loader-BuCeYPNP.cjs} +1 -1
- package/dist/{vue-ui-molecule-Dyfk9UfE.js → vue-ui-molecule-GPDqR2rp.js} +11 -11
- package/dist/{vue-ui-molecule-Cqvn7ZGx.cjs → vue-ui-molecule-z1A47zG1.cjs} +1 -1
- package/dist/{vue-ui-mood-radar-D9XUvCNH.js → vue-ui-mood-radar-DdQC5bH5.js} +11 -11
- package/dist/{vue-ui-mood-radar-UqlWcAkr.cjs → vue-ui-mood-radar-YZfCADah.cjs} +1 -1
- package/dist/{vue-ui-nested-donuts-vUJ2g2dk.cjs → vue-ui-nested-donuts-CDSRcEX0.cjs} +1 -1
- package/dist/{vue-ui-nested-donuts-DP4yfGUH.js → vue-ui-nested-donuts-Cf_KfoeP.js} +11 -11
- package/dist/{vue-ui-onion-fJOV7lwQ.cjs → vue-ui-onion-CmGZo3Sf.cjs} +1 -1
- package/dist/{vue-ui-onion-IxyzzuZC.js → vue-ui-onion-Lw3ohFAX.js} +11 -11
- package/dist/{vue-ui-parallel-coordinate-plot-C6CQj1ih.cjs → vue-ui-parallel-coordinate-plot-AHpf7ejC.cjs} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-6LNS_W9b.js → vue-ui-parallel-coordinate-plot-BsT0r0hr.js} +12 -12
- package/dist/{vue-ui-quadrant-BPJzCH5I.cjs → vue-ui-quadrant-BPUIyB4-.cjs} +1 -1
- package/dist/{vue-ui-quadrant-eQs9Dod-.js → vue-ui-quadrant-BTmoe6UT.js} +12 -12
- package/dist/{vue-ui-quick-chart-CWhEkYew.cjs → vue-ui-quick-chart-BYyXa06h.cjs} +1 -1
- package/dist/{vue-ui-quick-chart-CTMgh6oC.js → vue-ui-quick-chart-CRtE0pcc.js} +9 -9
- package/dist/{vue-ui-radar-Rrbv8dAs.js → vue-ui-radar-BpkjOSOI.js} +12 -12
- package/dist/{vue-ui-radar-CbwxQra8.cjs → vue-ui-radar-krdMX_hl.cjs} +1 -1
- package/dist/{vue-ui-rating-BDy7Vxiz.cjs → vue-ui-rating-9kj9GE7P.cjs} +1 -1
- package/dist/{vue-ui-rating-b_H5cz4V.js → vue-ui-rating-D1RlkwK9.js} +2 -2
- package/dist/{vue-ui-relation-circle-BsaD2Vz5.js → vue-ui-relation-circle-B7WGb08k.js} +7 -7
- package/dist/{vue-ui-relation-circle-CYxPC6gU.cjs → vue-ui-relation-circle-Kv3G0P5k.cjs} +1 -1
- package/dist/{vue-ui-rings-CywU-FZc.js → vue-ui-rings-DjXcLsY1.js} +11 -11
- package/dist/{vue-ui-rings-Dj329t-Y.cjs → vue-ui-rings-DsZPnoqm.cjs} +1 -1
- package/dist/{vue-ui-scatter-BU3bhusK.cjs → vue-ui-scatter-D3ntjnfT.cjs} +1 -1
- package/dist/{vue-ui-scatter-Cf7C-P1q.js → vue-ui-scatter-DEkTyyG8.js} +12 -12
- package/dist/{vue-ui-screenshot-v4TXqkKi.cjs → vue-ui-screenshot-BEbUxjNl.cjs} +1 -1
- package/dist/{vue-ui-screenshot-DBeBfiuI.js → vue-ui-screenshot-kiJVXAGt.js} +1 -1
- package/dist/{vue-ui-skeleton-e8hBgzZq.cjs → vue-ui-skeleton-CI8sxaqr.cjs} +1 -1
- package/dist/{vue-ui-skeleton-BgKRd_jD.js → vue-ui-skeleton-E1-7diF5.js} +3 -3
- package/dist/{vue-ui-smiley-BEPDv0B2.js → vue-ui-smiley-Cjbqlfre.js} +2 -2
- package/dist/{vue-ui-smiley-WLjNbXtv.cjs → vue-ui-smiley-CmkUQtfb.cjs} +1 -1
- package/dist/{vue-ui-spark-trend-BqJ9Du4S.cjs → vue-ui-spark-trend-C60Ypeev.cjs} +1 -1
- package/dist/{vue-ui-spark-trend-CWlczo-T.js → vue-ui-spark-trend-DfpFe1UQ.js} +5 -5
- package/dist/{vue-ui-sparkbar-CpzctkDi.js → vue-ui-sparkbar-B5oV2RUs.js} +4 -4
- package/dist/{vue-ui-sparkbar-CC644wqU.cjs → vue-ui-sparkbar-BAa71eZp.cjs} +1 -1
- package/dist/{vue-ui-sparkgauge-QdcUMSrr.cjs → vue-ui-sparkgauge-UejPQm4b.cjs} +1 -1
- package/dist/{vue-ui-sparkgauge-DhTYuVVk.js → vue-ui-sparkgauge-xlERw-g0.js} +4 -4
- package/dist/{vue-ui-sparkhistogram-B_bkoRo5.cjs → vue-ui-sparkhistogram-DC4jzkI0.cjs} +1 -1
- package/dist/{vue-ui-sparkhistogram-DT8aWhy7.js → vue-ui-sparkhistogram-nzFRlmgx.js} +5 -5
- package/dist/{vue-ui-sparkline-gNuSbC73.cjs → vue-ui-sparkline-BT4hxfBE.cjs} +1 -1
- package/dist/{vue-ui-sparkline-B0y9q_YB.js → vue-ui-sparkline-Duu0VrnG.js} +4 -4
- package/dist/{vue-ui-sparkstackbar-BObzDdzR.cjs → vue-ui-sparkstackbar-K_vPau1u.cjs} +1 -1
- package/dist/{vue-ui-sparkstackbar-D0EW5UMR.js → vue-ui-sparkstackbar-tyoFIhva.js} +5 -5
- package/dist/{vue-ui-stackbar-BRxbXX0l.cjs → vue-ui-stackbar-DRlvF164.cjs} +1 -1
- package/dist/{vue-ui-stackbar-Behinggy.js → vue-ui-stackbar-e8BUjttp.js} +12 -12
- package/dist/{vue-ui-strip-plot-CjhT-LmB.cjs → vue-ui-strip-plot-8MOhIicL.cjs} +1 -1
- package/dist/{vue-ui-strip-plot-DjyK_xfj.js → vue-ui-strip-plot-Ef8oKjNV.js} +11 -11
- package/dist/{vue-ui-table-DYrm2td6.js → vue-ui-table-BOV6jtcL.js} +1 -1
- package/dist/{vue-ui-table-C2YKKkgd.cjs → vue-ui-table-DfevkNnK.cjs} +1 -1
- package/dist/{vue-ui-table-heatmap-_A66YkO3.cjs → vue-ui-table-heatmap-BMyRP1ol.cjs} +1 -1
- package/dist/{vue-ui-table-heatmap-uSw3G5Yp.js → vue-ui-table-heatmap-CL-MybKI.js} +4 -4
- package/dist/{vue-ui-table-sparkline-CimHSr9x.cjs → vue-ui-table-sparkline-CsqcT3ff.cjs} +1 -1
- package/dist/{vue-ui-table-sparkline-DP752Vad.js → vue-ui-table-sparkline-DXvxiDJJ.js} +5 -5
- package/dist/{vue-ui-thermometer-CqmSsg-L.cjs → vue-ui-thermometer-DyYqfAOW.cjs} +1 -1
- package/dist/{vue-ui-thermometer-BAoZL-gV.js → vue-ui-thermometer-WKzTNOOX.js} +7 -7
- package/dist/{vue-ui-timer-CmeHwizl.js → vue-ui-timer-CFDkyaxV.js} +5 -5
- package/dist/{vue-ui-timer-B3kBoPr3.cjs → vue-ui-timer-DQQGe1jt.cjs} +1 -1
- package/dist/{vue-ui-tiremarks-DyAHN8nt.cjs → vue-ui-tiremarks-C8iAWe-u.cjs} +1 -1
- package/dist/{vue-ui-tiremarks-DEcQ-B-G.js → vue-ui-tiremarks-aiUC8-YL.js} +7 -7
- package/dist/{vue-ui-treemap-CNSeLpGe.cjs → vue-ui-treemap-BORZ3g1I.cjs} +1 -1
- package/dist/{vue-ui-treemap-sI6K1nm9.js → vue-ui-treemap-Bw-bWkza.js} +11 -11
- package/dist/{vue-ui-vertical-bar-COsFMFTH.js → vue-ui-vertical-bar--mYbTcpi.js} +11 -11
- package/dist/{vue-ui-vertical-bar-B1TdmM7c.cjs → vue-ui-vertical-bar-B3ypOHUB.cjs} +1 -1
- package/dist/{vue-ui-waffle-DBjvyyH7.js → vue-ui-waffle-Bj-tJs4n.js} +11 -11
- package/dist/{vue-ui-waffle-Cz1aIQK1.cjs → vue-ui-waffle-_84Hvek7.cjs} +1 -1
- package/dist/{vue-ui-wheel-BGT8eh76.js → vue-ui-wheel-BywwqvY2.js} +7 -7
- package/dist/{vue-ui-wheel-D2SqIwip.cjs → vue-ui-wheel-C-v9TgG1.cjs} +1 -1
- package/dist/{vue-ui-word-cloud-BFLqOtlV.cjs → vue-ui-word-cloud-CaQ4jLed.cjs} +1 -1
- package/dist/{vue-ui-word-cloud-vUXYTp4a.js → vue-ui-word-cloud-CwExwCYc.js} +10 -10
- package/dist/{vue-ui-xy-DyDkCQL0.js → vue-ui-xy-CAYxRDzC.js} +14 -14
- package/dist/{vue-ui-xy-CoDtZktc.cjs → vue-ui-xy-CT3-xPpa.cjs} +1 -1
- package/dist/{vue-ui-xy-canvas-DnPYfALY.js → vue-ui-xy-canvas-BOElCo0f.js} +133 -131
- package/dist/vue-ui-xy-canvas-CdrfnVuI.cjs +9 -0
- package/package.json +1 -1
- package/dist/Slicer-BUhJuKdW.cjs +0 -1
- package/dist/vue-ui-xy-canvas-C6db7VrZ.cjs +0 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),n=require("./index-3oZdQf6G.cjs"),d=require("./useResponsive-BJ7DTGpm.cjs"),Je=require("./Tooltip-BXc56Oxr.cjs"),Ke=require("./Legend-BksImVUi.cjs"),Qe=require("./Title-BxrsVY3-.cjs"),et=require("./Slicer-IneBjcpY.cjs"),Pe=require("./usePrinter-BKzxQK4e.cjs"),tt=require("./vue-ui-accordion-QoJofzqF.cjs"),at=require("./DataTable-DeevzR8O.cjs"),lt=require("./vue-ui-skeleton-CI8sxaqr.cjs"),Me=require("./useNestedProp-vPTP0Wem.cjs"),ot=require("./PenAndPaper-j5noaKJZ.cjs"),rt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ut=["id"],nt=["onClick"],st={key:2,class:"vue-data-ui-watermark"},it=["innerHTML"],ct={__name:"vue-ui-xy-canvas",props:{dataset:{type:Array,default(){return[]}},config:{type:Object,default(){return{}}}},emits:["selectLegend"],setup(le,{expose:Re,emit:Oe}){const z=le,{vue_ui_xy_canvas:Ne}=n.useConfig(),U=a.ref(n.createUid()),B=a.ref(null),C=a.ref(null),I=a.ref(null),i=a.ref(null),p=a.ref(1),$=a.ref(1),A=a.ref(!1),f=a.ref(null),_=a.ref(""),oe=a.ref(null),L=a.ref([]),O=a.ref(1),R=a.ref(!0),w=a.ref(!0),X=a.ref(null),re=a.ref(0),ue=a.ref(0),Z=a.ref(!1),ne=a.ref(null),se=a.ref(null),ie=a.ref(null),ce=a.ref(null),G=a.ref(0),j=a.ref(0),J=a.ref(0),K=a.computed(()=>!!z.dataset&&z.dataset.length),t=a.computed({get:()=>ve(),set:e=>e});function ve(){const e=Me.useNestedProp({userConfig:z.config,defaultConfig:Ne});return e.theme?{...Me.useNestedProp({userConfig:n.themes.vue_ui_xy_canvas[e.theme]||z.config,defaultConfig:e}),customPalette:n.themePalettes[e.theme]||n.palette}:e}a.watch(()=>z.config,e=>{t.value=ve(),ee(),G.value+=1,j.value+=1,J.value+=1},{deep:!0}),a.watch(()=>z.dataset,()=>{ee(),G.value+=1,j.value+=1,J.value+=1},{deep:!0});const de=a.ref(t.value.style.chart.aspectRatio),{isPrinting:he,isImaging:fe,generatePdf:ye,generateImage:pe}=Pe.usePrinter({elementId:`xy_canvas_${U.value}`,fileName:t.value.style.chart.title.text||"vue-ui-xy-canvas"}),s=a.ref({showTable:t.value.table.show,showDataLabels:t.value.style.chart.dataLabels.show,stacked:t.value.style.chart.stacked,showTooltip:t.value.style.chart.tooltip.show});function Be(e){Z.value=e,ue.value+=1}const ge=a.computed(()=>n.convertCustomPalette(t.value.customPalette)),T=a.computed(()=>N.value?Math.max(...N.value.filter((e,o)=>!L.value.includes(e.absoluteIndex)).map(e=>e.series.length)):0),l=a.computed(()=>{const e=p.value-p.value*(t.value.style.chart.paddingProportions.left+t.value.style.chart.paddingProportions.right);return{canvasWidth:p.value,canvasHeight:$.value,left:p.value*t.value.style.chart.paddingProportions.left,top:$.value*t.value.style.chart.paddingProportions.top,right:p.value-p.value*t.value.style.chart.paddingProportions.right,bottom:$.value-$.value*t.value.style.chart.paddingProportions.bottom,width:e,height:$.value-$.value*(t.value.style.chart.paddingProportions.top+t.value.style.chart.paddingProportions.bottom),slot:e/(u.value.end-u.value.start)}});function me(e,o){return e/o}function Ie({hasAutoScale:e,series:o,min:r,max:v,scale:h,yOffset:g,individualHeight:c,stackIndex:m=null}){return o.map((k,ae)=>{const S=h.min<0?Math.abs(h.min):0,P=me(k+S,S+h.max);let M,E;e&&(M=Math.abs(h.min),E=me(k+M,h.max+M));let F=0;return m===null?F=l.value.bottom-l.value.height*(e?E:P):F=l.value.bottom-g-c*(e?E:P),{x:l.value.left+l.value.slot*ae+l.value.slot/2,y:F,value:k}})}const b=a.computed(()=>{const e=Math.min(...N.value.filter((c,m)=>!L.value.includes(c.absoluteIndex)).flatMap(c=>c.series.slice(u.value.start,u.value.end))),o=Math.max(...N.value.filter((c,m)=>!L.value.includes(c.absoluteIndex)).flatMap(c=>c.series.slice(u.value.start,u.value.end))),r=n.calculateNiceScale(e<0?e:0,o===e?e+1<0?0:e+1:o<0?0:o,t.value.style.chart.scale.ticks),v=r.min<0?Math.abs(r.min):0,h=l.value.bottom-l.value.height*(v/(r.max+v)),g=r.ticks.map(c=>({y:l.value.bottom-l.value.height*((c+v)/(r.max+v)),x:l.value.left-8,value:c}));return{absoluteMin:v,max:o,min:e,scale:r,yLabels:g,zero:h}}),Ee=a.computed(()=>y.value.map(e=>`
|
|
2
|
+
<div style="display:flex;flex-direction:row;gap:6px;align-items:center;">
|
|
3
|
+
<svg viewBox="0 0 10 10" height="12" width="12">
|
|
4
|
+
<circle cx="5" cy="5" r="5" fill="${e.color}"/>
|
|
5
|
+
</svg>
|
|
6
|
+
<span>${e.name?e.name+": ":""}</span>
|
|
7
|
+
<span>${n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.series[f.value],n.dataLabel({p:e.prefix||"",v:e.series[f.value],s:e.suffix||"",r:e.rounding||0}),{datapoint:e,seriesIndex:f.value})}</span>
|
|
8
|
+
</div>
|
|
9
|
+
`)),N=a.computed(()=>z.dataset.map((e,o)=>({...e,series:n.largestTriangleThreeBucketsArray({data:n.sanitizeArray(e.series),threshold:t.value.downsample.threshold}),absoluteIndex:o,color:n.convertColorToHex(e.color||ge.value[o]||n.palette[o]||n.palette[o%n.palette.length])})));a.watch(T,e=>{e&&be()});const y=a.computed(()=>n.assignStackRatios(N.value.filter((e,o)=>!L.value.includes(e.absoluteIndex))).map((e,o)=>({...e,series:e.series.slice(u.value.start,u.value.end)})).map((e,o)=>{let r=Math.min(...e.series)||0,v=Math.max(...e.series)||1;r===v&&(r=r>=0?v-1:r,v=v>=0?v:r+1);const g={ratios:e.series.filter(D=>![null,void 0].includes(D)).map(D=>(D-r)/(v-r)),valueMin:r,valueMax:v},c=e.scaleSteps||t.value.style.chart.scale.ticks;let m;e.autoScaling?m=n.calculateNiceScale(g.valueMin,g.valueMax,c):m=n.calculateNiceScale(g.valueMin<0?g.valueMin:0,g.valueMax<=0?0:g.valueMax,c);const k=s.value.stacked?l.value.height*(1-e.cumulatedStackRatio):0,ae=s.value.stacked?l.value.height/t.value.style.chart.stackGap:0,S=s.value.stacked?l.value.height*e.stackRatio-ae:l.value.height,P=m.min<0?Math.abs(m.min):0;let M;e.autoScaling&&s.value.stacked&&v<=0?M=l.value.bottom-k-S:M=l.value.bottom-k-S*(P/(m.max+P));const E=m.ticks.map((D,je)=>({y:l.value.bottom-k-S*(je/(m.ticks.length-1)),x:l.value.left-8,value:D})),F=Ie({hasAutoScale:s.value.stacked&&e.autoScaling,series:e.series,min:s.value.stacked?r:b.value.min,max:s.value.stacked?v:b.value.max,scale:s.value.stacked?m:b.value.scale,yOffset:k,individualHeight:S,stackIndex:s.value.stacked?o:null});return{...e,coordinatesLine:F,min:r,max:v,localScale:m,localZero:M,localMin:P,localYLabels:E,yOffset:k,individualHeight:S}})),u=a.ref({start:0,end:T.value});function be(){u.value={start:0,end:T.value},re.value+=1}const Fe=a.computed(()=>y.value.filter(e=>["line","plot",void 0].includes(e.type))),x=a.computed(()=>y.value.filter(e=>e.type==="bar"));function De(){if(!C.value)return;const e=I.value.offsetWidth,o=I.value.offsetHeight;C.value.width=e*O.value*2,C.value.height=o*O.value*2,p.value=e*O.value*2,$.value=o*O.value*2,i.value.scale(O.value,O.value),Q()}function Ae(){if(i.value.clearRect(0,0,1e4,1e4),i.value.fillStyle=t.value.style.chart.backgroundColor,i.value.fillRect(0,0,l.value.canvasWidth,l.value.canvasHeight),s.value.stacked)t.value.style.chart.grid.y.verticalLines.show&&u.value.end-u.value.start<t.value.style.chart.grid.y.verticalLines.hideUnderXLength&&y.value.forEach(e=>{for(let o=0;o<u.value.end-u.value.start+1;o+=1)d.line(i.value,[{x:l.value.left+l.value.slot*o,y:l.value.bottom-e.yOffset-e.individualHeight},{x:l.value.left+l.value.slot*o,y:l.value.bottom-e.yOffset}],{color:t.value.style.chart.grid.y.verticalLines.color})}),t.value.style.chart.grid.x.horizontalLines.show&&(t.value.style.chart.grid.x.horizontalLines.alternate?y.value.forEach(e=>{e.localYLabels.forEach((o,r)=>{r<e.localYLabels.length-1&&d.rect(i.value,[{x:l.value.left,y:o.y},{x:l.value.right,y:o.y},{x:l.value.right,y:e.localYLabels[r+1].y},{x:l.value.left,y:e.localYLabels[r+1].y}],{fillColor:r%2===0?"transparent":n.setOpacity(t.value.style.chart.grid.x.horizontalLines.color,t.value.style.chart.grid.x.horizontalLines.opacity),strokeColor:"transparent"})})}):y.value.forEach(e=>{e.localYLabels.slice(u.value.start,u.value.end).forEach(o=>{d.line(i.value,[{x:l.value.left,y:o.y},{x:l.value.right,y:o.y}],{color:t.value.style.chart.grid.x.horizontalLines.color})})})),t.value.style.chart.grid.zeroLine.show&&y.value.forEach(e=>{d.line(i.value,[{x:l.value.left,y:e.localZero},{x:l.value.right,y:e.localZero}],{color:t.value.style.chart.grid.zeroLine.color,lineDash:t.value.style.chart.grid.zeroLine.dashed?[10,10]:[0,0]})}),t.value.style.chart.grid.y.axisLabels.show&&y.value.forEach(e=>{d.line(i.value,[{x:l.value.left,y:l.value.bottom-e.yOffset},{x:l.value.left,y:l.value.bottom-e.yOffset-e.individualHeight}],{color:e.color}),d.line(i.value,[{x:l.value.right,y:l.value.bottom-e.yOffset},{x:l.value.right,y:l.value.bottom-e.yOffset-e.individualHeight}],{color:e.color}),e.localYLabels.forEach((o,r)=>{d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,o.value,n.dataLabel({p:e.prefix||t.value.style.chart.grid.y.axisLabels.prefix||"",v:o.value,s:e.suffix||t.value.style.chart.grid.y.axisLabels.suffix||"",r:e.rounding||t.value.style.chart.grid.y.axisLabels.rounding||0}),{datapoint:o,seriesIndex:r}),o.x+t.value.style.chart.grid.y.axisLabels.offsetX,o.y,{align:"right",font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:e.color})})}),y.value.forEach(e=>{d.text(i.value,e.name,p.value/35,l.value.bottom-e.yOffset-e.individualHeight/2,{align:"center",rotation:-90,color:e.color,font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`})});else{if(t.value.style.chart.grid.y.verticalLines.show&&u.value.end-u.value.start<t.value.style.chart.grid.y.verticalLines.hideUnderXLength)for(let e=0;e<u.value.end-u.value.start+1;e+=1)d.line(i.value,[{x:l.value.left+l.value.slot*e,y:l.value.top},{x:l.value.left+l.value.slot*e,y:l.value.bottom}],{color:t.value.style.chart.grid.y.verticalLines.color});t.value.style.chart.grid.x.horizontalLines.show&&(t.value.style.chart.grid.x.horizontalLines.alternate?b.value.yLabels.forEach((e,o)=>{o<b.value.yLabels.length-1&&d.rect(i.value,[{x:l.value.left,y:e.y},{x:l.value.right,y:e.y},{x:l.value.right,y:b.value.yLabels[o+1].y},{x:l.value.left,y:b.value.yLabels[o+1].y}],{fillColor:o%2===0?"transparent":n.setOpacity(t.value.style.chart.grid.x.horizontalLines.color,t.value.style.chart.grid.x.horizontalLines.opacity),strokeColor:"transparent"})}):b.value.yLabels.forEach(e=>{d.line(i.value,[{x:l.value.left,y:e.y},{x:l.value.right,y:e.y}],{color:t.value.style.chart.grid.x.horizontalLines.color})})),t.value.style.chart.grid.y.showAxis&&d.line(i.value,[{x:l.value.left,y:l.value.top},{x:l.value.left,y:l.value.bottom}],{color:t.value.style.chart.grid.y.axisColor,lineWidth:t.value.style.chart.grid.y.axisThickness}),t.value.style.chart.grid.x.showAxis&&d.line(i.value,[{x:l.value.left,y:l.value.bottom},{x:l.value.right,y:l.value.bottom}],{color:t.value.style.chart.grid.x.axisColor,lineWidth:t.value.style.chart.grid.x.axisThickness}),t.value.style.chart.grid.zeroLine.show&&d.line(i.value,[{x:l.value.left,y:b.value.zero},{x:l.value.right,y:b.value.zero}],{color:t.value.style.chart.grid.zeroLine.color,lineDash:t.value.style.chart.grid.zeroLine.dashed?[10,10]:[0,0]}),t.value.style.chart.grid.y.axisLabels.show&&b.value.yLabels.forEach((e,o)=>{d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.value,n.dataLabel({p:t.value.style.chart.grid.y.axisLabels.prefix||"",v:e.value,s:t.value.style.chart.grid.y.axisLabels.suffix||"",r:t.value.style.chart.grid.y.axisLabels.rounding||0}),{datapoint:e,seriesIndex:o}),e.x+t.value.style.chart.grid.y.axisLabels.offsetX,e.y,{align:"right",font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.grid.y.axisLabels.color})})}t.value.style.chart.grid.y.axisName&&d.text(i.value,t.value.style.chart.grid.y.axisName,p.value-p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio*1.2,l.value.bottom-l.value.height/2,{font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.color,align:"center",rotation:90}),t.value.style.chart.grid.x.axisName&&d.text(i.value,t.value.style.chart.grid.x.axisName,p.value/2,$.value,{font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.color,align:"center"})}function _e(e){for(let o=0;o<e.coordinatesLine.length;o+=1){const r=(f.value===o?p.value/150:t.value.style.chart.line.plots.show?p.value/200:0)*t.value.style.chart.line.plots.radiusRatio;d.circle(i.value,{x:e.coordinatesLine[o].x,y:e.coordinatesLine[o].y},r,{color:t.value.style.chart.backgroundColor,fillStyle:e.color,strokeColor:"transparent"})}}function He(e){for(let o=0;o<e.coordinatesLine.length;o+=1)d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.coordinatesLine[o].value,n.dataLabel({p:e.prefix||"",v:e.coordinatesLine[o].value,s:e.suffix||"",r:e.rounding||0}),{datapoint:e.coordinatesLine[o],seriesIndex:o}),e.coordinatesLine[o].x,e.coordinatesLine[o].y+t.value.style.chart.dataLabels.offsetY,{align:"center",font:`${Math.round(p.value/40*t.value.style.chart.dataLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.dataLabels.useSerieColor?e.color:t.value.style.chart.dataLabels.color,strokeColor:t.value.style.chart.backgroundColor,lineWidth:.8})}function Ve(){for(let e=u.value.start;e<u.value.end;e+=1)(u.value.end-u.value.start<t.value.style.chart.grid.y.timeLabels.modulo||u.value.end-u.value.start>=t.value.style.chart.grid.y.timeLabels.modulo&&(e%Math.floor((u.value.end-u.value.start)/t.value.style.chart.grid.y.timeLabels.modulo)===0||e===f.value+u.value.start))&&d.text(i.value,t.value.style.chart.grid.y.timeLabels.values[e]||e+1,l.value.left+l.value.slot*(e-u.value.start)+l.value.slot/2,l.value.bottom+p.value/t.value.style.chart.grid.y.timeLabels.offsetY,{align:t.value.style.chart.grid.y.timeLabels.rotation===0?"center":t.value.style.chart.grid.y.timeLabels.rotation>0?"left":"right",font:`${Math.round(p.value/40*t.value.style.chart.grid.y.timeLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:n.setOpacity(t.value.style.chart.grid.y.timeLabels.color,f.value!==null?f.value+u.value.start===e?100:20:100),rotation:t.value.style.chart.grid.y.timeLabels.rotation})}function xe(){d.line(i.value,[{x:l.value.left+l.value.slot*f.value+l.value.slot/2,y:l.value.top},{x:l.value.left+l.value.slot*f.value+l.value.slot/2,y:l.value.bottom}],{color:t.value.style.chart.selector.color,lineDash:t.value.style.chart.selector.dashed?[8,8]:[0,0],lineWidth:2,linceCap:"round"})}function We(){x.value.forEach((e,o)=>{for(let r=0;r<e.coordinatesLine.length;r+=1)d.rect(i.value,[{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o)),y:s.value.stacked?e.localZero:b.value.zero},{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o))+l.value.slot*.8/(s.value.stacked?1:x.value.length),y:s.value.stacked?e.localZero:b.value.zero},{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o))+l.value.slot*.8/(s.value.stacked?1:x.value.length),y:e.coordinatesLine[r].y},{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o)),y:e.coordinatesLine[r].y}],{strokeColor:t.value.style.chart.backgroundColor,gradient:{type:"linear",start:{x:e.coordinatesLine[r].x,y:e.coordinatesLine[r].y},end:{x:e.coordinatesLine[r].x,y:s.value.stacked?e.localZero:b.value.zero},stops:[{offset:0,color:e.color},{offset:1,color:n.lightenHexColor(e.color,.5)}]}}),s.value.showDataLabels&&[!0,void 0].includes(e.dataLabels)&&d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.coordinatesLine[r].value,n.dataLabel({p:e.prefix||"",v:e.coordinatesLine[r].value,s:e.suffix||"",r:e.rounding||0}),{datapoint:e.coordinatesLine[r],seriesIndex:r}),l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o))+l.value.slot*.4/(s.value.stacked?1:x.value.length),(e.coordinatesLine[r].value<0?s.value.stacked?e.localZero:b.value.zero:e.coordinatesLine[r].y)+t.value.style.chart.dataLabels.offsetY,{align:"center",font:`${Math.round(p.value/40*t.value.style.chart.dataLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.dataLabels.useSerieColor?e.color:t.value.style.chart.dataLabels.color,strokeColor:t.value.style.chart.backgroundColor,lineWidth:.8})})}function qe(e){e.useArea?s.value.stacked?d.polygon(i.value,[{x:e.coordinatesLine[0].x,y:e.localZero},...e.coordinatesLine,{x:e.coordinatesLine.at(-1).x,y:e.localZero}],{fillColor:n.setOpacity(e.color,t.value.style.chart.area.opacity),strokeColor:"transparent"}):d.polygon(i.value,[{x:e.coordinatesLine[0].x,y:b.value.zero},...e.coordinatesLine,{x:e.coordinatesLine.at(-1).x,y:b.value.zero}],{fillColor:n.setOpacity(e.color,t.value.style.chart.area.opacity),strokeColor:"transparent"}):d.line(i.value,e.coordinatesLine,{color:e.color,lineWidth:3})}function Ye(){y.value.forEach((e,o)=>{d.line(i.value,[{x:l.value.left,y:l.value.bottom-e.yOffset},{x:l.value.right,y:l.value.bottom-e.yOffset}],{color:t.value.style.chart.grid.x.horizontalLines.color,lineWidth:1})})}function Q(){Ae(),R.value?(w.value&&f.value!==null&&t.value.style.chart.selector.show&&xe(),We(),s.value.stacked&&t.value.style.chart.grid.x.showAxis&&Ye(),Fe.value.forEach(e=>{(e.type==="line"||!e.type)&&qe(e),w.value&&(_e(e),s.value.showDataLabels&&[!0,void 0].includes(e.dataLabels)&&He(e))}),X.value=d.cloneCanvas(C.value)):(X.value&&(i.value.clearRect(0,0,1e4,1e4),i.value.drawImage(X.value,0,0)),w.value&&f.value!==null&&t.value.style.chart.selector.show&&xe(),w.value&&f.value!==null&&y.value.forEach(e=>{if(e.type==="line"||!e.type||e.type==="plot"){if(!e.coordinatesLine[f.value])return;e.coordinatesLine[f.value].x!==void 0&&e.coordinatesLine[f.value].y!==void 0&&d.circle(i.value,{x:e.coordinatesLine[f.value].x,y:e.coordinatesLine[f.value].y},p.value/150*t.value.style.chart.line.plots.radiusRatio,{color:t.value.style.chart.backgroundColor,fillStyle:e.color,strokeColor:"transparent"})}})),t.value.style.chart.grid.y.timeLabels.show&&Ve(),R.value=!1}const H=d.debounce(()=>{w.value=!0,De()},T.value>200?10:1,!w.value);function Ue(e){const{left:o}=C.value.getBoundingClientRect(),r=e.clientX-o;if(r*2<l.value.left||r*2>l.value.right){A.value=!1,f.value=null;return}const v=r*2-l.value.left;if(f.value=Math.floor(v/l.value.slot),A.value=!0,!w.value)return;let h="";const g=t.value.style.chart.tooltip.customFormat;n.isFunction(g)&&n.functionReturnsString(()=>g({seriesIndex:f.value,datapoint:y.value.map(c=>({shape:c.shape||null,name:c.name,color:c.color,type:c.type||"line",value:c.series.find((m,k)=>k===f.value)})),series:y.value,config:t.value}))?_.value=g({seriesIndex:f.value,datapoint:y.value.map(c=>({shape:c.shape||null,name:c.name,color:c.color,type:c.type||"line",value:c.series.find((m,k)=>k===f.value)})),series:y.value,config:t.value}):(t.value.style.chart.grid.y.timeLabels.values.slice(u.value.start,u.value.end)[f.value]&&(h+=`<div style="padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid ${t.value.style.chart.tooltip.borderColor}; width:100%">${t.value.style.chart.grid.y.timeLabels.values.slice(u.value.start,u.value.end)[f.value]}</div>`),h+=Ee.value.join(""),_.value=h),w.value=!1}a.watch(()=>f.value,e=>{H()}),a.watch(()=>u.value,e=>{R.value=!0,Q()},{deep:!0}),a.watch(()=>s.value.showDataLabels,e=>{R.value=!0,Q()}),a.watch(()=>s.value.stacked,e=>{R.value=!0,w.value=!0,H()});function Xe(){A.value=!1,f.value=null,_.value=""}const V=a.ref(null),W=a.ref(null);a.onMounted(()=>{ee()});function ee(){if(n.objectIsEmpty(z.dataset)?n.error({componentName:"VueUiXyCanvas",type:"dataset"}):C.value&&(i.value=C.value.getContext("2d",{willReadFrequently:!0})),t.value.responsive){const e=d.throttle(()=>{const{width:o,height:r}=d.useResponsive({chart:B.value,title:t.value.style.chart.title.text?ne.value:null,legend:t.value.style.chart.legend.show?se.value:null,slicer:t.value.style.chart.zoom.show&&T.value>1?ie.value:null,source:ce.value});de.value=`${o} / ${r}`});V.value=new ResizeObserver(e),V.value.observe(B.value.parentNode)}W.value=new ResizeObserver(e=>{for(const o of e)o.contentBoxSize&&I.value&&(R.value=!0,H())}),W.value.observe(I.value)}a.onBeforeUnmount(()=>{W.value&&W.value.disconnect(),V.value&&V.value.disconnect()});function ke(e){Oe("selectLegend",y.value.find(o=>o.absoluteIndex===e)),L.value.includes(e)?L.value=L.value.filter(o=>o!==e):L.value.push(e),R.value=!0,H()}const Le=a.computed(()=>N.value.map((e,o)=>({...e,name:e.name,color:n.convertColorToHex(e.color)||ge.value[o]||n.palette[o]||n.palette[o%n.palette.length],shape:e.shape||"circle",prefix:e.prefix||"",suffix:e.suffix||"",rounding:e.rounding||0})).map(e=>({...e,opacity:L.value.includes(e.absoluteIndex)?.5:1,segregate:()=>ke(e.absoluteIndex),isSegregated:L.value.includes(e.absoluteIndex)}))),Ze=a.computed(()=>({cy:"donut-div-legend",backgroundColor:t.value.style.chart.legend.backgroundColor,color:t.value.style.chart.legend.color,fontSize:t.value.style.chart.legend.fontSize,paddingBottom:12,fontWeight:t.value.style.chart.legend.bold?"bold":""})),q=a.computed(()=>{const e=[""].concat(y.value.map(h=>h.name)).concat(' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>');let o=[];for(let h=0;h<T.value;h+=1){const g=y.value.map(c=>c.series[h]??0).reduce((c,m)=>c+m,0);o.push([t.value.style.chart.grid.y.timeLabels.values.slice(u.value.start,u.value.end)[h]??h+1].concat(y.value.map(c=>(c.series[h]??0).toFixed(t.value.table.rounding))).concat((g??0).toFixed(t.value.table.rounding)))}const r={th:{backgroundColor:t.value.table.th.backgroundColor,color:t.value.table.th.color,outline:t.value.table.th.outline},td:{backgroundColor:t.value.table.td.backgroundColor,color:t.value.table.td.color,outline:t.value.table.td.outline},breakpoint:t.value.table.responsiveBreakpoint},v=[t.value.table.columnNames.period].concat(y.value.map(h=>h.name)).concat(t.value.table.columnNames.total);return{head:e,body:o.slice(0,u.value.end-u.value.start),config:r,colNames:v}}),Ce=a.computed(()=>{if(y.value.length===0)return{head:[],body:[],config:{},columnNames:[]};const e=y.value.map(r=>({label:r.name,color:r.color,type:r.type})),o=[];for(let r=u.value.start;r<u.value.end;r+=1){const v=[t.value.style.chart.grid.y.timeLabels.values[r]||r+1];y.value.forEach(h=>{v.push(Number((h.series[r]||0).toFixed(t.value.table.rounding)))}),o.push(v)}return{head:e,body:o}});function we(){const e=[[t.value.style.chart.title.text],[t.value.style.chart.title.subtitle.text],[""]],o=["",...Ce.value.head.map(g=>g.label)],r=Ce.value.body,v=e.concat([o]).concat(r),h=n.createCsvContent(v);n.downloadCsv({csvContent:h,title:t.value.style.chart.title.text||"vue-ui-xy-canvas"})}function Ge(){return y.value}function Se(){s.value.showTable=!s.value.showTable}function ze(){s.value.showDataLabels=!s.value.showDataLabels}function $e(){s.value.stacked=!s.value.stacked}function Te(){s.value.showTooltip=!s.value.showTooltip}const Y=a.ref(!1);function te(){Y.value=!Y.value}return Re({getData:Ge,generateCsv:we,generatePdf:ye,generateImage:pe,toggleTable:Se,toggleLabels:ze,toggleStack:$e,toggleTooltip:Te,toggleAnnotator:te}),(e,o)=>(a.openBlock(),a.createElementBlock("div",{style:a.normalizeStyle(`width:100%; position:relative; ${t.value.responsive?"height: 100%":""}`),ref_key:"xy",ref:B,id:`xy_canvas_${U.value}`,class:a.normalizeClass(`vue-ui-donut ${Z.value?"vue-data-ui-wrapper-fullscreen":""}`)},[t.value.style.chart.title.text?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:ne,style:a.normalizeStyle(`width:100%;background:${t.value.style.chart.backgroundColor};`)},[(a.openBlock(),a.createBlock(Qe._sfc_main,{key:`title_${G.value}`,config:{title:{cy:"xy-canvas-title",...t.value.style.chart.title},subtitle:{cy:"xy-canvas-subtitle",...t.value.style.chart.title.subtitle}}},null,8,["config"]))],4)):a.createCommentVNode("",!0),t.value.userOptions.show&&K.value?(a.openBlock(),a.createBlock(Pe.UserOptions,{ref:"details",key:`user_option_${ue.value}`,backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color,isPrinting:a.unref(he),isImaging:a.unref(fe),uid:U.value,hasTooltip:t.value.userOptions.buttons.tooltip&&t.value.style.chart.tooltip.show,hasPdf:t.value.userOptions.buttons.pdf,hasImg:t.value.userOptions.buttons.img,hasXls:t.value.userOptions.buttons.csv,hasLabel:t.value.userOptions.buttons.labels,hasStack:le.dataset.length>1&&t.value.userOptions.buttons.stack,hasFullscreen:t.value.userOptions.buttons.fullscreen,hasTable:u.value.end-u.value.start<200&&t.value.userOptions.buttons.table,isFullscreen:Z.value,isTooltip:s.value.showTooltip,isStacked:s.value.stacked,titles:{...t.value.userOptions.buttonTitles},chartElement:B.value,position:t.value.userOptions.position,hasAnnotator:t.value.userOptions.buttons.annotator,isAnnotation:Y.value,onToggleFullscreen:Be,onGeneratePdf:a.unref(ye),onGenerateCsv:we,onGenerateImage:a.unref(pe),onToggleTable:Se,onToggleLabels:ze,onToggleStack:$e,onToggleTooltip:Te,onToggleAnnotator:te},a.createSlots({_:2},[e.$slots.optionTooltip?{name:"optionTooltip",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionTooltip",{},void 0,!0)]),key:"0"}:void 0,e.$slots.optionPdf?{name:"optionPdf",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionPdf",{},void 0,!0)]),key:"1"}:void 0,e.$slots.optionCsv?{name:"optionCsv",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionCsv",{},void 0,!0)]),key:"2"}:void 0,e.$slots.optionImg?{name:"optionImg",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionImg",{},void 0,!0)]),key:"3"}:void 0,e.$slots.optionTable?{name:"optionTable",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionTable",{},void 0,!0)]),key:"4"}:void 0,e.$slots.optionLabels?{name:"optionLabels",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionLabels",{},void 0,!0)]),key:"5"}:void 0,e.$slots.optionStack?{name:"optionStack",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionStack",{},void 0,!0)]),key:"6"}:void 0,e.$slots.optionFullscreen?{name:"optionFullscreen",fn:a.withCtx(({toggleFullscreen:r,isFullscreen:v})=>[a.renderSlot(e.$slots,"optionFullscreen",a.normalizeProps(a.guardReactiveProps({toggleFullscreen:r,isFullscreen:v})),void 0,!0)]),key:"7"}:void 0,e.$slots.optionAnnotator?{name:"optionAnnotator",fn:a.withCtx(({toggleAnnotator:r,isAnnotator:v})=>[a.renderSlot(e.$slots,"optionAnnotator",a.normalizeProps(a.guardReactiveProps({toggleAnnotator:r,isAnnotator:v})),void 0,!0)]),key:"8"}:void 0]),1032,["backgroundColor","color","isPrinting","isImaging","uid","hasTooltip","hasPdf","hasImg","hasXls","hasLabel","hasStack","hasFullscreen","hasTable","isFullscreen","isTooltip","isStacked","titles","chartElement","position","hasAnnotator","isAnnotation","onGeneratePdf","onGenerateImage"])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"vue-ui-xy-canvas",style:a.normalizeStyle(`position: relative; aspect-ratio: ${de.value}`),ref_key:"container",ref:I},[K.value?(a.openBlock(),a.createElementBlock("canvas",{key:0,ref_key:"canvas",ref:C,style:{width:"100%",height:"100%"},onMousemove:o[0]||(o[0]=r=>Ue(r)),onMouseleave:Xe},null,544)):(a.openBlock(),a.createBlock(lt.default,{key:1,config:{type:"line",style:{backgroundColor:t.value.style.chart.backgroundColor,line:{axis:{color:"#CCCCCC"},path:{color:"#CCCCCC",strokeWidth:.5}}}}},null,8,["config"])),a.createVNode(Je._sfc_main,{show:s.value.showTooltip&&A.value,backgroundColor:t.value.style.chart.tooltip.backgroundColor,color:t.value.style.chart.tooltip.color,fontSize:t.value.style.chart.tooltip.fontSize,borderRadius:t.value.style.chart.tooltip.borderRadius,borderColor:t.value.style.chart.tooltip.borderColor,borderWidth:t.value.style.chart.tooltip.borderWidth,position:t.value.style.chart.tooltip.position,offsetY:t.value.style.chart.tooltip.offsetY,parent:C.value,content:_.value,backgroundOpacity:t.value.style.chart.tooltip.backgroundOpacity,isCustom:a.unref(n.isFunction)(t.value.style.chart.tooltip.customFormat)},{"tooltip-before":a.withCtx(()=>[a.renderSlot(e.$slots,"tooltip-before",a.normalizeProps(a.guardReactiveProps({...oe.value})),void 0,!0)]),"tooltip-after":a.withCtx(()=>[a.renderSlot(e.$slots,"tooltip-after",a.normalizeProps(a.guardReactiveProps({...oe.value})),void 0,!0)]),_:3},8,["show","backgroundColor","color","fontSize","borderRadius","borderColor","borderWidth","position","offsetY","parent","content","backgroundOpacity","isCustom"])],4),a.createElementVNode("div",{ref_key:"chartSlicer",ref:ie,style:a.normalizeStyle(`width:100%;background:${t.value.style.chart.backgroundColor}`),"data-html2canvas-ignore":""},[t.value.style.chart.zoom.show&&T.value>1?(a.openBlock(),a.createBlock(et.Slicer,{key:`slicer_${re.value}`,background:t.value.style.chart.zoom.color,borderColor:t.value.style.chart.backgroundColor,fontSize:t.value.style.chart.zoom.fontSize,useResetSlot:t.value.style.chart.zoom.useResetSlot,labelLeft:t.value.style.chart.grid.y.timeLabels.values[u.value.start]?t.value.style.chart.grid.y.timeLabels.values[u.value.start]:"",labelRight:t.value.style.chart.grid.y.timeLabels.values[u.value.end-1]?t.value.style.chart.grid.y.timeLabels.values[u.value.end-1]:"",textColor:t.value.style.chart.color,inputColor:t.value.style.chart.zoom.color,selectColor:t.value.style.chart.zoom.highlightColor,max:T.value,min:0,valueStart:u.value.start,valueEnd:u.value.end,start:u.value.start,"onUpdate:start":o[1]||(o[1]=r=>u.value.start=r),end:u.value.end,"onUpdate:end":o[2]||(o[2]=r=>u.value.end=r),onReset:be},{"reset-action":a.withCtx(({reset:r})=>[a.renderSlot(e.$slots,"reset-action",a.normalizeProps(a.guardReactiveProps({reset:r})),void 0,!0)]),_:3},8,["background","borderColor","fontSize","useResetSlot","labelLeft","labelRight","textColor","inputColor","selectColor","max","valueStart","valueEnd","start","end"])):a.createCommentVNode("",!0)],4),a.createElementVNode("div",{ref_key:"chartLegend",ref:se},[t.value.style.chart.legend.show&&K.value?(a.openBlock(),a.createBlock(Ke.Legend,{legendSet:Le.value,config:Ze.value,key:`legend_${J.value}`,onClickMarker:o[3]||(o[3]=({i:r})=>ke(r))},{item:a.withCtx(({legend:r,index:v})=>[a.createElementVNode("div",{onClick:h=>r.segregate(),style:a.normalizeStyle(`opacity:${L.value.includes(v)?.5:1}`)},a.toDisplayString(r.name),13,nt)]),_:1},8,["legendSet","config"])):a.renderSlot(e.$slots,"legend",{key:1,legend:Le.value},void 0,!0)],512),e.$slots.watermark?(a.openBlock(),a.createElementBlock("div",st,[a.renderSlot(e.$slots,"watermark",a.normalizeProps(a.guardReactiveProps({isPrinting:a.unref(he)||a.unref(fe)})),void 0,!0)])):a.createCommentVNode("",!0),e.$slots.source?(a.openBlock(),a.createElementBlock("div",{key:3,ref_key:"source",ref:ce,dir:"auto"},[a.renderSlot(e.$slots,"source",{},void 0,!0)],512)):a.createCommentVNode("",!0),u.value.end-u.value.start<200?(a.openBlock(),a.createBlock(tt.default,{key:4,hideDetails:"",config:{open:s.value.showTable,maxHeight:1e4,body:{backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color},head:{backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color}}},{content:a.withCtx(()=>[(a.openBlock(),a.createBlock(at.DataTable,{key:`table_${j.value}`,colNames:q.value.colNames,head:q.value.head,body:q.value.body,config:q.value.config,title:`${t.value.style.chart.title.text}${t.value.style.chart.title.subtitle.text?` : ${t.value.style.chart.title.subtitle.text}`:""}`,onClose:o[4]||(o[4]=r=>s.value.showTable=!1)},{th:a.withCtx(({th:r})=>[a.createElementVNode("div",{innerHTML:r},null,8,it)]),td:a.withCtx(({td:r})=>[a.createTextVNode(a.toDisplayString(r),1)]),_:1},8,["colNames","head","body","config","title"]))]),_:1},8,["config"])):a.createCommentVNode("",!0),t.value.userOptions.buttons.annotator&&y.value.length?(a.openBlock(),a.createBlock(ot.PenAndPaper,{key:5,parent:B.value,backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color,active:Y.value,onClose:te},null,8,["parent","backgroundColor","color","active"])):a.createCommentVNode("",!0)],14,ut))}},vt=rt._export_sfc(ct,[["__scopeId","data-v-0c8b7e3c"]]);exports.default=vt;
|
package/package.json
CHANGED
package/dist/Slicer-BUhJuKdW.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),O=require("./BaseIcon-D-YgPcX1.cjs"),C=require("./useResponsive-BJ7DTGpm.cjs"),v=require("./index-DsF7Aej7.cjs"),T=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),w=l=>(e.pushScopeId("data-v-2f9a6945"),l=l(),e.popScopeId(),l),U={"data-html2canvas-ignore":"",style:{padding:"0 24px"},class:"vue-data-ui-zoom"},W={class:"vue-data-ui-slicer-labels",style:{position:"relative","z-index":"1","pointer-events":"none"}},j={key:0,style:{width:"100%",position:"relative"}},X={key:0,class:"minimap",style:{width:"100%"}},Z=["xmlns","viewBox"],_=["id"],G=["stop-color"],H=w(()=>e.createElementVNode("stop",{offset:"100%","stop-color":"transparent"},null,-1)),J=["d","stroke"],K=["x","width","height","fill","rx"],Q=["d","fill"],Y=["x","width","height","rx","fill"],ee=["x","width","height","fill","rx"],te=["d","fill"],le=["d","stroke"],ae=["cx","cy","stroke","fill"],ne=["cx","cy","stroke","fill"],oe=["x1","x2","y2","stroke"],ie=["x","height","width","onMouseenter"],re=w(()=>e.createElementVNode("div",{class:"slider-track"},null,-1)),ue=["min","max"],se=["min","max"],ce={__name:"Slicer",props:{background:{type:String,default:"#FFFFFF"},borderColor:{type:String,default:"#FFFFFF"},fontSize:{type:Number,default:14},labelLeft:{type:String,default:""},labelRight:{type:String,default:""},textColor:{type:String,default:"#1A1A1A"},inputColor:{type:String,default:"#1A1A1A"},max:{type:Number,default:0},min:{type:Number,default:0},selectColor:{type:String,default:"#4A4A4A"},useResetSlot:{type:Boolean,default:!1},valueStart:{type:[Number,String],default:0},valueEnd:{type:[Number,String],default:0},minimap:{type:Array,default:[]},smoothMinimap:{type:Boolean,default:!1},minimapSelectedColor:{type:String,default:"#1f77b4"},minimapSelectionRadius:{type:Number,default:12},minimapLineColor:{type:String,default:"#2D353C"},minimapSelectedColorOpacity:{type:Number,default:.2},minimapSelectedIndex:{type:Number,default:null},minimapIndicatorColor:{type:String,default:"#2D353C"}},emits:["update:start","update:end","reset","trapMouse"],setup(l,{emit:h}){const t=l;e.useCssVars(a=>({b99dc1a6:$.value,"3b26a7a1":f.value,"4deb3852":z.value,"1b5be8d1":l.selectColor,"8444fa42":B.value}));const r=e.ref(t.min),u=e.ref(t.max),p=e.computed(()=>!!t.minimap.length),x=e.ref(v.createUid()),V=e.computed(()=>{const a=t.max-t.min,o=(r.value-t.min)/a*100,i=(u.value-t.min)/a*100;return{left:`${o}%`,width:`${i-o}%`,background:t.selectColor}}),$=e.computed(()=>t.inputColor),B=e.computed(()=>t.background),z=e.computed(()=>`${t.selectColor}33`),f=e.computed(()=>t.borderColor),N=e.computed(()=>{let a=[];for(let o=0;o<t.minimap.length;o+=1)a.push(o);return a});function E(){h("reset")}function L(){Number(r.value)>Number(u.value)-1&&(r.value=Number(u.value)-1),h("update:start",Number(r.value))}function M(){Number(u.value)<Number(r.value)+1&&(u.value=Number(r.value)+1),h("update:end",Number(u.value))}e.watch(()=>t.min,a=>{Number(r.value)<Number(a)&&(r.value=Number(a)),Number(u.value)<Number(a)&&(u.value=Number(a))}),e.watch(()=>t.max,a=>{Number(r.value)>Number(a)&&(r.value=Number(a)),Number(u.value)>Number(a)&&(u.value=Number(a))});const b=e.ref(null),n=e.ref({width:1,height:1}),g=e.ref(null);e.onMounted(()=>{if(p.value){const a=C.throttle(()=>{const{width:o,height:i}=C.useResponsive({chart:b.value});n.value.width=o,n.value.height=i-47});g.value=new ResizeObserver(a),g.value.observe(b.value)}}),e.onBeforeUnmount(()=>{g.value&&g.value.disconnect()});const s=e.computed(()=>t.minimap.length?n.value.width/t.minimap.length:0),c=e.computed(()=>{if(!t.minimap.length)return[];const a=Math.max(...t.minimap),o=Math.min(...t.minimap)-10,i=a-(o>0?0:o),d=t.minimap.map((A,q)=>{const D=A-o;return{x:n.value.width/t.minimap.length*q+s.value/2,y:n.value.height-D/i*(n.value.height*.9)}}),S=t.smoothMinimap?v.createSmoothPath(d):v.createStraightPath(d),k=[...d].slice(t.valueStart,t.valueEnd),R=t.smoothMinimap?v.createSmoothPath(k):v.createStraightPath(k);return{fullSet:S,selectionSet:R,sliced:k,firstPlot:d[t.valueStart],lastPlot:d[t.valueEnd-1]}}),m=e.computed(()=>({x:s.value*r.value+s.value/2,width:n.value.width*((u.value-r.value)/t.max)-s.value})),F=e.computed(()=>({left:0,color:t.textColor,fontSize:`${t.fontSize}px`,top:p.value?"28px":"-28px",pointerEvents:"none"})),I=e.computed(()=>({right:0,color:t.textColor,fontSize:`${t.fontSize}px`,top:p.value?"28px":"-28px",direction:"rtl",pointerEvents:"none"})),y=e.ref(t.minimapSelectedIndex);e.watch(()=>t.minimapSelectedIndex,a=>{y.value=a+t.valueStart},{immediate:!0});function P(a){y.value=a,a>=t.valueStart&&a<t.valueEnd&&h("trapMouse",a-t.valueStart)}return(a,o)=>(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",W,[l.valueStart>0||l.valueEnd<l.max?(e.openBlock(),e.createElementBlock("div",j,[l.useResetSlot?e.renderSlot(a.$slots,"reset-action",{key:1,reset:E},void 0,!0):(e.openBlock(),e.createElementBlock("button",{key:0,"data-cy-reset":"",tabindex:"0",role:"button",class:"vue-data-ui-refresh-button",style:e.normalizeStyle({top:p.value?"36px":"-16px",pointerEvents:"all !important"}),onClick:E},[e.createVNode(O.default,{name:"refresh",stroke:l.textColor},null,8,["stroke"])],4))])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"double-range-slider",ref_key:"minimapWrapper",ref:b,style:{"z-index":"0"}},[p.value?(e.openBlock(),e.createElementBlock("div",X,[(e.openBlock(),e.createElementBlock("svg",{xmlns:e.unref(v.XMLNS),viewBox:`0 0 ${n.value.width<0?0:n.value.width} ${n.value.height<0?0:n.value.height}`},[e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{id:x.value,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},[e.createElementVNode("stop",{offset:"0%","stop-color":`${l.minimapLineColor}50`},null,8,G),H],8,_)]),e.createElementVNode("path",{d:`M${c.value.fullSet}`,stroke:`${l.minimapLineColor}`,fill:"none","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",style:{opacity:"1"}},null,8,J),e.createElementVNode("rect",{x:m.value.x,width:m.value.width<0?0:m.value.width,height:n.value.height,y:0,fill:f.value,rx:l.minimapSelectionRadius,stroke:"none"},null,8,K),e.createElementVNode("path",{d:`M${s.value/2},${n.value.height} ${c.value.fullSet} L${n.value.width-s.value/2},${n.value.height}Z`,fill:`url(#${x.value})`,stroke:"none",style:{opacity:"1"}},null,8,Q),e.createElementVNode("rect",{x:m.value.x,width:m.value.width<0?0:m.value.width,height:n.value.height,y:0,rx:l.minimapSelectionRadius,fill:f.value},null,8,Y),e.createElementVNode("rect",{x:m.value.x,width:m.value.width<0?0:m.value.width,height:n.value.height,y:0,fill:l.minimapSelectedColor,rx:l.minimapSelectionRadius,style:e.normalizeStyle({opacity:l.minimapSelectedColorOpacity})},null,12,ee),e.createElementVNode("path",{d:`M${c.value.sliced[0].x},${n.value.height} ${c.value.selectionSet} L${c.value.sliced.at(-1).x},${n.value.height}Z`,fill:`url(#${x.value})`,stroke:"none",style:{opacity:"1"}},null,8,te),e.createElementVNode("path",{d:`M ${c.value.selectionSet}`,stroke:`${l.minimapLineColor}`,fill:"transparent","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,le),e.createElementVNode("circle",{cx:c.value.firstPlot.x,cy:c.value.firstPlot.y,"stroke-width":"0.5",stroke:f.value,r:"3",fill:l.minimapLineColor},null,8,ae),e.createElementVNode("circle",{cx:c.value.lastPlot.x,cy:c.value.lastPlot.y,"stroke-width":"0.5",stroke:f.value,r:"3",fill:l.minimapLineColor},null,8,ne),y.value!==null?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(N.value,(i,d)=>(e.openBlock(),e.createElementBlock("g",null,[y.value===i&&i>=l.valueStart&&i<l.valueEnd?(e.openBlock(),e.createElementBlock("line",{key:0,x1:s.value*d+s.value/2,x2:s.value*d+s.value/2,y1:0,y2:n.value.height,stroke:l.minimapIndicatorColor,"stroke-linecap":"round","stroke-dasharray":"2","stroke-width":"1"},null,8,oe)):e.createCommentVNode("",!0)]))),256)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(i,d)=>(e.openBlock(),e.createElementBlock("rect",{x:s.value*d,y:0,height:n.value.height,width:s.value<0?0:s.value,fill:"transparent",style:{"pointer-events":"all !important"},onMouseenter:S=>P(i),onMouseleave:o[0]||(o[0]=S=>{y.value=null,h("trapMouse",null)})},null,40,ie))),256))],8,Z))])):e.createCommentVNode("",!0),re,e.createElementVNode("div",{class:"range-highlight",style:e.normalizeStyle(V.value)},null,4),e.withDirectives(e.createElementVNode("input",{type:"range",class:"range-left",min:l.min,max:l.max,"onUpdate:modelValue":o[1]||(o[1]=i=>r.value=i),onInput:L},null,40,ue),[[e.vModelText,r.value]]),e.createElementVNode("div",{class:"thumb-label thumb-label-left",style:e.normalizeStyle(F.value)},e.toDisplayString(l.labelLeft),5),e.withDirectives(e.createElementVNode("input",{type:"range",class:"range-right",min:l.min,max:l.max,"onUpdate:modelValue":o[2]||(o[2]=i=>u.value=i),onInput:M},null,40,se),[[e.vModelText,u.value]]),e.createElementVNode("div",{class:"thumb-label thumb-label-right",style:e.normalizeStyle(I.value)},e.toDisplayString(l.labelRight),5)],512)]))}},de=T._export_sfc(ce,[["__scopeId","data-v-2f9a6945"]]);exports.Slicer=de;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),n=require("./index-DsF7Aej7.cjs"),d=require("./useResponsive-BJ7DTGpm.cjs"),Je=require("./Tooltip-wdo3yY_W.cjs"),Ke=require("./Legend-B3KPtqT8.cjs"),Qe=require("./Title-Az2QIayC.cjs"),et=require("./Slicer-BUhJuKdW.cjs"),Pe=require("./usePrinter-CUDeluax.cjs"),tt=require("./vue-ui-accordion-Av34wbMx.cjs"),at=require("./DataTable-T6NSDRqO.cjs"),lt=require("./vue-ui-skeleton-e8hBgzZq.cjs"),Me=require("./useNestedProp-D0YHk8Cd.cjs"),ot=require("./PenAndPaper-C0H3KJhQ.cjs"),rt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),ut=["id"],nt=["onClick"],st={key:2,class:"vue-data-ui-watermark"},it=["innerHTML"],ct={__name:"vue-ui-xy-canvas",props:{dataset:{type:Array,default(){return[]}},config:{type:Object,default(){return{}}}},emits:["selectLegend"],setup(Q,{expose:Re,emit:Oe}){const M=Q,{vue_ui_xy_canvas:Ne}=n.useConfig(),U=a.ref(n.createUid()),B=a.ref(null),C=a.ref(null),I=a.ref(null),i=a.ref(null),p=a.ref(1),z=a.ref(1),A=a.ref(!1),f=a.ref(null),_=a.ref(""),ee=a.ref(null),L=a.ref([]),O=a.ref(1),R=a.ref(!0),w=a.ref(!0),X=a.ref(null),te=a.ref(0),ae=a.ref(0),Z=a.ref(!1),le=a.ref(null),oe=a.ref(null),re=a.ref(null),ue=a.ref(null),ne=a.ref(0),se=a.ref(0),ie=a.ref(0),G=a.computed(()=>!!M.dataset&&M.dataset.length),t=a.computed({get:()=>ce(),set:e=>e});function ce(){const e=Me.useNestedProp({userConfig:M.config,defaultConfig:Ne});return e.theme?{...Me.useNestedProp({userConfig:n.themes.vue_ui_xy_canvas[e.theme]||M.config,defaultConfig:e}),customPalette:n.themePalettes[e.theme]||n.palette}:e}a.watch(()=>M.config,e=>{t.value=ce(),xe(),ne.value+=1,se.value+=1,ie.value+=1},{deep:!0});const ve=a.ref(t.value.style.chart.aspectRatio),{isPrinting:de,isImaging:he,generatePdf:fe,generateImage:ye}=Pe.usePrinter({elementId:`xy_canvas_${U.value}`,fileName:t.value.style.chart.title.text||"vue-ui-xy-canvas"}),s=a.ref({showTable:t.value.table.show,showDataLabels:t.value.style.chart.dataLabels.show,stacked:t.value.style.chart.stacked,showTooltip:t.value.style.chart.tooltip.show});function Be(e){Z.value=e,ae.value+=1}const pe=a.computed(()=>n.convertCustomPalette(t.value.customPalette)),$=a.computed(()=>N.value?Math.max(...N.value.filter((e,o)=>!L.value.includes(e.absoluteIndex)).map(e=>e.series.length)):0),l=a.computed(()=>{const e=p.value-p.value*(t.value.style.chart.paddingProportions.left+t.value.style.chart.paddingProportions.right);return{canvasWidth:p.value,canvasHeight:z.value,left:p.value*t.value.style.chart.paddingProportions.left,top:z.value*t.value.style.chart.paddingProportions.top,right:p.value-p.value*t.value.style.chart.paddingProportions.right,bottom:z.value-z.value*t.value.style.chart.paddingProportions.bottom,width:e,height:z.value-z.value*(t.value.style.chart.paddingProportions.top+t.value.style.chart.paddingProportions.bottom),slot:e/(u.value.end-u.value.start)}});function ge(e,o){return e/o}function Ie({hasAutoScale:e,series:o,min:r,max:v,scale:h,yOffset:g,individualHeight:c,stackIndex:m=null}){return o.map((k,K)=>{const S=h.min<0?Math.abs(h.min):0,T=ge(k+S,S+h.max);let P,E;e&&(P=Math.abs(h.min),E=ge(k+P,h.max+P));let F=0;return m===null?F=l.value.bottom-l.value.height*(e?E:T):F=l.value.bottom-g-c*(e?E:T),{x:l.value.left+l.value.slot*K+l.value.slot/2,y:F,value:k}})}const b=a.computed(()=>{const e=Math.min(...N.value.filter((c,m)=>!L.value.includes(c.absoluteIndex)).flatMap(c=>c.series.slice(u.value.start,u.value.end))),o=Math.max(...N.value.filter((c,m)=>!L.value.includes(c.absoluteIndex)).flatMap(c=>c.series.slice(u.value.start,u.value.end))),r=n.calculateNiceScale(e<0?e:0,o===e?e+1<0?0:e+1:o<0?0:o,t.value.style.chart.scale.ticks),v=r.min<0?Math.abs(r.min):0,h=l.value.bottom-l.value.height*(v/(r.max+v)),g=r.ticks.map(c=>({y:l.value.bottom-l.value.height*((c+v)/(r.max+v)),x:l.value.left-8,value:c}));return{absoluteMin:v,max:o,min:e,scale:r,yLabels:g,zero:h}}),Ee=a.computed(()=>y.value.map(e=>`
|
|
2
|
-
<div style="display:flex;flex-direction:row;gap:6px;align-items:center;">
|
|
3
|
-
<svg viewBox="0 0 10 10" height="12" width="12">
|
|
4
|
-
<circle cx="5" cy="5" r="5" fill="${e.color}"/>
|
|
5
|
-
</svg>
|
|
6
|
-
<span>${e.name?e.name+": ":""}</span>
|
|
7
|
-
<span>${n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.series[f.value],n.dataLabel({p:e.prefix||"",v:e.series[f.value],s:e.suffix||"",r:e.rounding||0}),{datapoint:e,seriesIndex:f.value})}</span>
|
|
8
|
-
</div>
|
|
9
|
-
`)),N=a.computed(()=>M.dataset.map((e,o)=>({...e,series:n.largestTriangleThreeBucketsArray({data:n.sanitizeArray(e.series),threshold:t.value.downsample.threshold}),absoluteIndex:o,color:n.convertColorToHex(e.color||pe.value[o]||n.palette[o]||n.palette[o%n.palette.length])})));a.watch($,e=>{e&&me()});const y=a.computed(()=>n.assignStackRatios(N.value.filter((e,o)=>!L.value.includes(e.absoluteIndex))).map((e,o)=>({...e,series:e.series.slice(u.value.start,u.value.end)})).map((e,o)=>{let r=Math.min(...e.series)||0,v=Math.max(...e.series)||1;r===v&&(r=r>=0?v-1:r,v=v>=0?v:r+1);const g={ratios:e.series.filter(D=>![null,void 0].includes(D)).map(D=>(D-r)/(v-r)),valueMin:r,valueMax:v},c=e.scaleSteps||t.value.style.chart.scale.ticks;let m;e.autoScaling?m=n.calculateNiceScale(g.valueMin,g.valueMax,c):m=n.calculateNiceScale(g.valueMin<0?g.valueMin:0,g.valueMax<=0?0:g.valueMax,c);const k=s.value.stacked?l.value.height*(1-e.cumulatedStackRatio):0,K=s.value.stacked?l.value.height/t.value.style.chart.stackGap:0,S=s.value.stacked?l.value.height*e.stackRatio-K:l.value.height,T=m.min<0?Math.abs(m.min):0;let P;e.autoScaling&&s.value.stacked&&v<=0?P=l.value.bottom-k-S:P=l.value.bottom-k-S*(T/(m.max+T));const E=m.ticks.map((D,je)=>({y:l.value.bottom-k-S*(je/(m.ticks.length-1)),x:l.value.left-8,value:D})),F=Ie({hasAutoScale:s.value.stacked&&e.autoScaling,series:e.series,min:s.value.stacked?r:b.value.min,max:s.value.stacked?v:b.value.max,scale:s.value.stacked?m:b.value.scale,yOffset:k,individualHeight:S,stackIndex:s.value.stacked?o:null});return{...e,coordinatesLine:F,min:r,max:v,localScale:m,localZero:P,localMin:T,localYLabels:E,yOffset:k,individualHeight:S}})),u=a.ref({start:0,end:$.value});function me(){u.value={start:0,end:$.value},te.value+=1}const Fe=a.computed(()=>y.value.filter(e=>["line","plot",void 0].includes(e.type))),x=a.computed(()=>y.value.filter(e=>e.type==="bar"));function De(){if(!C.value)return;const e=I.value.offsetWidth,o=I.value.offsetHeight;C.value.width=e*O.value*2,C.value.height=o*O.value*2,p.value=e*O.value*2,z.value=o*O.value*2,i.value.scale(O.value,O.value),j()}function Ae(){if(i.value.clearRect(0,0,1e4,1e4),i.value.fillStyle=t.value.style.chart.backgroundColor,i.value.fillRect(0,0,l.value.canvasWidth,l.value.canvasHeight),s.value.stacked)t.value.style.chart.grid.y.verticalLines.show&&u.value.end-u.value.start<t.value.style.chart.grid.y.verticalLines.hideUnderXLength&&y.value.forEach(e=>{for(let o=0;o<u.value.end-u.value.start+1;o+=1)d.line(i.value,[{x:l.value.left+l.value.slot*o,y:l.value.bottom-e.yOffset-e.individualHeight},{x:l.value.left+l.value.slot*o,y:l.value.bottom-e.yOffset}],{color:t.value.style.chart.grid.y.verticalLines.color})}),t.value.style.chart.grid.x.horizontalLines.show&&(t.value.style.chart.grid.x.horizontalLines.alternate?y.value.forEach(e=>{e.localYLabels.forEach((o,r)=>{r<e.localYLabels.length-1&&d.rect(i.value,[{x:l.value.left,y:o.y},{x:l.value.right,y:o.y},{x:l.value.right,y:e.localYLabels[r+1].y},{x:l.value.left,y:e.localYLabels[r+1].y}],{fillColor:r%2===0?"transparent":n.setOpacity(t.value.style.chart.grid.x.horizontalLines.color,t.value.style.chart.grid.x.horizontalLines.opacity),strokeColor:"transparent"})})}):y.value.forEach(e=>{e.localYLabels.slice(u.value.start,u.value.end).forEach(o=>{d.line(i.value,[{x:l.value.left,y:o.y},{x:l.value.right,y:o.y}],{color:t.value.style.chart.grid.x.horizontalLines.color})})})),t.value.style.chart.grid.zeroLine.show&&y.value.forEach(e=>{d.line(i.value,[{x:l.value.left,y:e.localZero},{x:l.value.right,y:e.localZero}],{color:t.value.style.chart.grid.zeroLine.color,lineDash:t.value.style.chart.grid.zeroLine.dashed?[10,10]:[0,0]})}),t.value.style.chart.grid.y.axisLabels.show&&y.value.forEach(e=>{d.line(i.value,[{x:l.value.left,y:l.value.bottom-e.yOffset},{x:l.value.left,y:l.value.bottom-e.yOffset-e.individualHeight}],{color:e.color}),d.line(i.value,[{x:l.value.right,y:l.value.bottom-e.yOffset},{x:l.value.right,y:l.value.bottom-e.yOffset-e.individualHeight}],{color:e.color}),e.localYLabels.forEach((o,r)=>{d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,o.value,n.dataLabel({p:e.prefix||t.value.style.chart.grid.y.axisLabels.prefix||"",v:o.value,s:e.suffix||t.value.style.chart.grid.y.axisLabels.suffix||"",r:e.rounding||t.value.style.chart.grid.y.axisLabels.rounding||0}),{datapoint:o,seriesIndex:r}),o.x+t.value.style.chart.grid.y.axisLabels.offsetX,o.y,{align:"right",font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:e.color})})}),y.value.forEach(e=>{d.text(i.value,e.name,p.value/35,l.value.bottom-e.yOffset-e.individualHeight/2,{align:"center",rotation:-90,color:e.color,font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`})});else{if(t.value.style.chart.grid.y.verticalLines.show&&u.value.end-u.value.start<t.value.style.chart.grid.y.verticalLines.hideUnderXLength)for(let e=0;e<u.value.end-u.value.start+1;e+=1)d.line(i.value,[{x:l.value.left+l.value.slot*e,y:l.value.top},{x:l.value.left+l.value.slot*e,y:l.value.bottom}],{color:t.value.style.chart.grid.y.verticalLines.color});t.value.style.chart.grid.x.horizontalLines.show&&(t.value.style.chart.grid.x.horizontalLines.alternate?b.value.yLabels.forEach((e,o)=>{o<b.value.yLabels.length-1&&d.rect(i.value,[{x:l.value.left,y:e.y},{x:l.value.right,y:e.y},{x:l.value.right,y:b.value.yLabels[o+1].y},{x:l.value.left,y:b.value.yLabels[o+1].y}],{fillColor:o%2===0?"transparent":n.setOpacity(t.value.style.chart.grid.x.horizontalLines.color,t.value.style.chart.grid.x.horizontalLines.opacity),strokeColor:"transparent"})}):b.value.yLabels.forEach(e=>{d.line(i.value,[{x:l.value.left,y:e.y},{x:l.value.right,y:e.y}],{color:t.value.style.chart.grid.x.horizontalLines.color})})),t.value.style.chart.grid.y.showAxis&&d.line(i.value,[{x:l.value.left,y:l.value.top},{x:l.value.left,y:l.value.bottom}],{color:t.value.style.chart.grid.y.axisColor,lineWidth:t.value.style.chart.grid.y.axisThickness}),t.value.style.chart.grid.x.showAxis&&d.line(i.value,[{x:l.value.left,y:l.value.bottom},{x:l.value.right,y:l.value.bottom}],{color:t.value.style.chart.grid.x.axisColor,lineWidth:t.value.style.chart.grid.x.axisThickness}),t.value.style.chart.grid.zeroLine.show&&d.line(i.value,[{x:l.value.left,y:b.value.zero},{x:l.value.right,y:b.value.zero}],{color:t.value.style.chart.grid.zeroLine.color,lineDash:t.value.style.chart.grid.zeroLine.dashed?[10,10]:[0,0]}),t.value.style.chart.grid.y.axisLabels.show&&b.value.yLabels.forEach((e,o)=>{d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.value,n.dataLabel({p:t.value.style.chart.grid.y.axisLabels.prefix||"",v:e.value,s:t.value.style.chart.grid.y.axisLabels.suffix||"",r:t.value.style.chart.grid.y.axisLabels.rounding||0}),{datapoint:e,seriesIndex:o}),e.x+t.value.style.chart.grid.y.axisLabels.offsetX,e.y,{align:"right",font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.grid.y.axisLabels.color})})}t.value.style.chart.grid.y.axisName&&d.text(i.value,t.value.style.chart.grid.y.axisName,p.value-p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio*1.2,l.value.bottom-l.value.height/2,{font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.color,align:"center",rotation:90}),t.value.style.chart.grid.x.axisName&&d.text(i.value,t.value.style.chart.grid.x.axisName,p.value/2,z.value,{font:`${Math.round(p.value/40*t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.color,align:"center"})}function _e(e){for(let o=0;o<e.coordinatesLine.length;o+=1){const r=(f.value===o?p.value/150:t.value.style.chart.line.plots.show?p.value/200:0)*t.value.style.chart.line.plots.radiusRatio;d.circle(i.value,{x:e.coordinatesLine[o].x,y:e.coordinatesLine[o].y},r,{color:t.value.style.chart.backgroundColor,fillStyle:e.color,strokeColor:"transparent"})}}function He(e){for(let o=0;o<e.coordinatesLine.length;o+=1)d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.coordinatesLine[o].value,n.dataLabel({p:e.prefix||"",v:e.coordinatesLine[o].value,s:e.suffix||"",r:e.rounding||0}),{datapoint:e.coordinatesLine[o],seriesIndex:o}),e.coordinatesLine[o].x,e.coordinatesLine[o].y+t.value.style.chart.dataLabels.offsetY,{align:"center",font:`${Math.round(p.value/40*t.value.style.chart.dataLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.dataLabels.useSerieColor?e.color:t.value.style.chart.dataLabels.color,strokeColor:t.value.style.chart.backgroundColor,lineWidth:.8})}function Ve(){for(let e=u.value.start;e<u.value.end;e+=1)(u.value.end-u.value.start<t.value.style.chart.grid.y.timeLabels.modulo||u.value.end-u.value.start>=t.value.style.chart.grid.y.timeLabels.modulo&&(e%Math.floor((u.value.end-u.value.start)/t.value.style.chart.grid.y.timeLabels.modulo)===0||e===f.value+u.value.start))&&d.text(i.value,t.value.style.chart.grid.y.timeLabels.values[e]||e+1,l.value.left+l.value.slot*(e-u.value.start)+l.value.slot/2,l.value.bottom+p.value/t.value.style.chart.grid.y.timeLabels.offsetY,{align:t.value.style.chart.grid.y.timeLabels.rotation===0?"center":t.value.style.chart.grid.y.timeLabels.rotation>0?"left":"right",font:`${Math.round(p.value/40*t.value.style.chart.grid.y.timeLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:n.setOpacity(t.value.style.chart.grid.y.timeLabels.color,f.value!==null?f.value+u.value.start===e?100:20:100),rotation:t.value.style.chart.grid.y.timeLabels.rotation})}function be(){d.line(i.value,[{x:l.value.left+l.value.slot*f.value+l.value.slot/2,y:l.value.top},{x:l.value.left+l.value.slot*f.value+l.value.slot/2,y:l.value.bottom}],{color:t.value.style.chart.selector.color,lineDash:t.value.style.chart.selector.dashed?[8,8]:[0,0],lineWidth:2,linceCap:"round"})}function We(){x.value.forEach((e,o)=>{for(let r=0;r<e.coordinatesLine.length;r+=1)d.rect(i.value,[{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o)),y:s.value.stacked?e.localZero:b.value.zero},{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o))+l.value.slot*.8/(s.value.stacked?1:x.value.length),y:s.value.stacked?e.localZero:b.value.zero},{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o))+l.value.slot*.8/(s.value.stacked?1:x.value.length),y:e.coordinatesLine[r].y},{x:l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o)),y:e.coordinatesLine[r].y}],{strokeColor:t.value.style.chart.backgroundColor,gradient:{type:"linear",start:{x:e.coordinatesLine[r].x,y:e.coordinatesLine[r].y},end:{x:e.coordinatesLine[r].x,y:s.value.stacked?e.localZero:b.value.zero},stops:[{offset:0,color:e.color},{offset:1,color:n.lightenHexColor(e.color,.5)}]}}),s.value.showDataLabels&&[!0,void 0].includes(e.dataLabels)&&d.text(i.value,n.applyDataLabel(t.value.style.chart.dataLabels.formatter,e.coordinatesLine[r].value,n.dataLabel({p:e.prefix||"",v:e.coordinatesLine[r].value,s:e.suffix||"",r:e.rounding||0}),{datapoint:e.coordinatesLine[r],seriesIndex:r}),l.value.left+l.value.slot*r+l.value.slot/10+(s.value.stacked?0:l.value.slot/x.value.length*o-(o===0?0:l.value.slot/(5*x.value.length)*o))+l.value.slot*.4/(s.value.stacked?1:x.value.length),(e.coordinatesLine[r].value<0?s.value.stacked?e.localZero:b.value.zero:e.coordinatesLine[r].y)+t.value.style.chart.dataLabels.offsetY,{align:"center",font:`${Math.round(p.value/40*t.value.style.chart.dataLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,color:t.value.style.chart.dataLabels.useSerieColor?e.color:t.value.style.chart.dataLabels.color,strokeColor:t.value.style.chart.backgroundColor,lineWidth:.8})})}function qe(e){e.useArea?s.value.stacked?d.polygon(i.value,[{x:e.coordinatesLine[0].x,y:e.localZero},...e.coordinatesLine,{x:e.coordinatesLine.at(-1).x,y:e.localZero}],{fillColor:n.setOpacity(e.color,t.value.style.chart.area.opacity),strokeColor:"transparent"}):d.polygon(i.value,[{x:e.coordinatesLine[0].x,y:b.value.zero},...e.coordinatesLine,{x:e.coordinatesLine.at(-1).x,y:b.value.zero}],{fillColor:n.setOpacity(e.color,t.value.style.chart.area.opacity),strokeColor:"transparent"}):d.line(i.value,e.coordinatesLine,{color:e.color,lineWidth:3})}function Ye(){y.value.forEach((e,o)=>{d.line(i.value,[{x:l.value.left,y:l.value.bottom-e.yOffset},{x:l.value.right,y:l.value.bottom-e.yOffset}],{color:t.value.style.chart.grid.x.horizontalLines.color,lineWidth:1})})}function j(){Ae(),R.value?(w.value&&f.value!==null&&t.value.style.chart.selector.show&&be(),We(),s.value.stacked&&t.value.style.chart.grid.x.showAxis&&Ye(),Fe.value.forEach(e=>{(e.type==="line"||!e.type)&&qe(e),w.value&&(_e(e),s.value.showDataLabels&&[!0,void 0].includes(e.dataLabels)&&He(e))}),X.value=d.cloneCanvas(C.value)):(X.value&&(i.value.clearRect(0,0,1e4,1e4),i.value.drawImage(X.value,0,0)),w.value&&f.value!==null&&t.value.style.chart.selector.show&&be(),w.value&&f.value!==null&&y.value.forEach(e=>{if(e.type==="line"||!e.type||e.type==="plot"){if(!e.coordinatesLine[f.value])return;e.coordinatesLine[f.value].x!==void 0&&e.coordinatesLine[f.value].y!==void 0&&d.circle(i.value,{x:e.coordinatesLine[f.value].x,y:e.coordinatesLine[f.value].y},p.value/150*t.value.style.chart.line.plots.radiusRatio,{color:t.value.style.chart.backgroundColor,fillStyle:e.color,strokeColor:"transparent"})}})),t.value.style.chart.grid.y.timeLabels.show&&Ve(),R.value=!1}const H=d.debounce(()=>{w.value=!0,De()},$.value>200?10:1,!w.value);function Ue(e){const{left:o}=C.value.getBoundingClientRect(),r=e.clientX-o;if(r*2<l.value.left||r*2>l.value.right){A.value=!1,f.value=null;return}const v=r*2-l.value.left;if(f.value=Math.floor(v/l.value.slot),A.value=!0,!w.value)return;let h="";const g=t.value.style.chart.tooltip.customFormat;n.isFunction(g)&&n.functionReturnsString(()=>g({seriesIndex:f.value,datapoint:y.value.map(c=>({shape:c.shape||null,name:c.name,color:c.color,type:c.type||"line",value:c.series.find((m,k)=>k===f.value)})),series:y.value,config:t.value}))?_.value=g({seriesIndex:f.value,datapoint:y.value.map(c=>({shape:c.shape||null,name:c.name,color:c.color,type:c.type||"line",value:c.series.find((m,k)=>k===f.value)})),series:y.value,config:t.value}):(t.value.style.chart.grid.y.timeLabels.values.slice(u.value.start,u.value.end)[f.value]&&(h+=`<div style="padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid ${t.value.style.chart.tooltip.borderColor}; width:100%">${t.value.style.chart.grid.y.timeLabels.values.slice(u.value.start,u.value.end)[f.value]}</div>`),h+=Ee.value.join(""),_.value=h),w.value=!1}a.watch(()=>f.value,e=>{H()}),a.watch(()=>u.value,e=>{R.value=!0,j()},{deep:!0}),a.watch(()=>s.value.showDataLabels,e=>{R.value=!0,j()}),a.watch(()=>s.value.stacked,e=>{R.value=!0,w.value=!0,H()});function Xe(){A.value=!1,f.value=null,_.value=""}const V=a.ref(null),W=a.ref(null);a.onMounted(()=>{xe()});function xe(){if(n.objectIsEmpty(M.dataset)?n.error({componentName:"VueUiXyCanvas",type:"dataset"}):C.value&&(i.value=C.value.getContext("2d",{willReadFrequently:!0})),t.value.responsive){const e=d.throttle(()=>{const{width:o,height:r}=d.useResponsive({chart:B.value,title:t.value.style.chart.title.text?le.value:null,legend:t.value.style.chart.legend.show?oe.value:null,slicer:t.value.style.chart.zoom.show&&$.value>1?re.value:null,source:ue.value});ve.value=`${o} / ${r}`});V.value=new ResizeObserver(e),V.value.observe(B.value.parentNode)}W.value=new ResizeObserver(e=>{for(const o of e)o.contentBoxSize&&I.value&&(R.value=!0,H())}),W.value.observe(I.value)}a.onBeforeUnmount(()=>{W.value&&W.value.disconnect(),V.value&&V.value.disconnect()});function ke(e){Oe("selectLegend",y.value.find(o=>o.absoluteIndex===e)),L.value.includes(e)?L.value=L.value.filter(o=>o!==e):L.value.push(e),R.value=!0,H()}const Le=a.computed(()=>N.value.map((e,o)=>({...e,name:e.name,color:n.convertColorToHex(e.color)||pe.value[o]||n.palette[o]||n.palette[o%n.palette.length],shape:e.shape||"circle",prefix:e.prefix||"",suffix:e.suffix||"",rounding:e.rounding||0})).map(e=>({...e,opacity:L.value.includes(e.absoluteIndex)?.5:1,segregate:()=>ke(e.absoluteIndex),isSegregated:L.value.includes(e.absoluteIndex)}))),Ze=a.computed(()=>({cy:"donut-div-legend",backgroundColor:t.value.style.chart.legend.backgroundColor,color:t.value.style.chart.legend.color,fontSize:t.value.style.chart.legend.fontSize,paddingBottom:12,fontWeight:t.value.style.chart.legend.bold?"bold":""})),q=a.computed(()=>{const e=[""].concat(y.value.map(h=>h.name)).concat(' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>');let o=[];for(let h=0;h<$.value;h+=1){const g=y.value.map(c=>c.series[h]??0).reduce((c,m)=>c+m,0);o.push([t.value.style.chart.grid.y.timeLabels.values.slice(u.value.start,u.value.end)[h]??h+1].concat(y.value.map(c=>(c.series[h]??0).toFixed(t.value.table.rounding))).concat((g??0).toFixed(t.value.table.rounding)))}const r={th:{backgroundColor:t.value.table.th.backgroundColor,color:t.value.table.th.color,outline:t.value.table.th.outline},td:{backgroundColor:t.value.table.td.backgroundColor,color:t.value.table.td.color,outline:t.value.table.td.outline},breakpoint:t.value.table.responsiveBreakpoint},v=[t.value.table.columnNames.period].concat(y.value.map(h=>h.name)).concat(t.value.table.columnNames.total);return{head:e,body:o.slice(0,u.value.end-u.value.start),config:r,colNames:v}}),Ce=a.computed(()=>{if(y.value.length===0)return{head:[],body:[],config:{},columnNames:[]};const e=y.value.map(r=>({label:r.name,color:r.color,type:r.type})),o=[];for(let r=u.value.start;r<u.value.end;r+=1){const v=[t.value.style.chart.grid.y.timeLabels.values[r]||r+1];y.value.forEach(h=>{v.push(Number((h.series[r]||0).toFixed(t.value.table.rounding)))}),o.push(v)}return{head:e,body:o}});function we(){const e=[[t.value.style.chart.title.text],[t.value.style.chart.title.subtitle.text],[""]],o=["",...Ce.value.head.map(g=>g.label)],r=Ce.value.body,v=e.concat([o]).concat(r),h=n.createCsvContent(v);n.downloadCsv({csvContent:h,title:t.value.style.chart.title.text||"vue-ui-xy-canvas"})}function Ge(){return y.value}function Se(){s.value.showTable=!s.value.showTable}function ze(){s.value.showDataLabels=!s.value.showDataLabels}function $e(){s.value.stacked=!s.value.stacked}function Te(){s.value.showTooltip=!s.value.showTooltip}const Y=a.ref(!1);function J(){Y.value=!Y.value}return Re({getData:Ge,generateCsv:we,generatePdf:fe,generateImage:ye,toggleTable:Se,toggleLabels:ze,toggleStack:$e,toggleTooltip:Te,toggleAnnotator:J}),(e,o)=>(a.openBlock(),a.createElementBlock("div",{style:a.normalizeStyle(`width:100%; position:relative; ${t.value.responsive?"height: 100%":""}`),ref_key:"xy",ref:B,id:`xy_canvas_${U.value}`,class:a.normalizeClass(`vue-ui-donut ${Z.value?"vue-data-ui-wrapper-fullscreen":""}`)},[t.value.style.chart.title.text?(a.openBlock(),a.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:le,style:a.normalizeStyle(`width:100%;background:${t.value.style.chart.backgroundColor};`)},[(a.openBlock(),a.createBlock(Qe._sfc_main,{key:`title_${ne.value}`,config:{title:{cy:"xy-canvas-title",...t.value.style.chart.title},subtitle:{cy:"xy-canvas-subtitle",...t.value.style.chart.title.subtitle}}},null,8,["config"]))],4)):a.createCommentVNode("",!0),t.value.userOptions.show&&G.value?(a.openBlock(),a.createBlock(Pe.UserOptions,{ref:"details",key:`user_option_${ae.value}`,backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color,isPrinting:a.unref(de),isImaging:a.unref(he),uid:U.value,hasTooltip:t.value.userOptions.buttons.tooltip&&t.value.style.chart.tooltip.show,hasPdf:t.value.userOptions.buttons.pdf,hasImg:t.value.userOptions.buttons.img,hasXls:t.value.userOptions.buttons.csv,hasLabel:t.value.userOptions.buttons.labels,hasStack:Q.dataset.length>1&&t.value.userOptions.buttons.stack,hasFullscreen:t.value.userOptions.buttons.fullscreen,hasTable:u.value.end-u.value.start<200&&t.value.userOptions.buttons.table,isFullscreen:Z.value,isTooltip:s.value.showTooltip,isStacked:s.value.stacked,titles:{...t.value.userOptions.buttonTitles},chartElement:B.value,position:t.value.userOptions.position,hasAnnotator:t.value.userOptions.buttons.annotator,isAnnotation:Y.value,onToggleFullscreen:Be,onGeneratePdf:a.unref(fe),onGenerateCsv:we,onGenerateImage:a.unref(ye),onToggleTable:Se,onToggleLabels:ze,onToggleStack:$e,onToggleTooltip:Te,onToggleAnnotator:J},a.createSlots({_:2},[e.$slots.optionTooltip?{name:"optionTooltip",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionTooltip",{},void 0,!0)]),key:"0"}:void 0,e.$slots.optionPdf?{name:"optionPdf",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionPdf",{},void 0,!0)]),key:"1"}:void 0,e.$slots.optionCsv?{name:"optionCsv",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionCsv",{},void 0,!0)]),key:"2"}:void 0,e.$slots.optionImg?{name:"optionImg",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionImg",{},void 0,!0)]),key:"3"}:void 0,e.$slots.optionTable?{name:"optionTable",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionTable",{},void 0,!0)]),key:"4"}:void 0,e.$slots.optionLabels?{name:"optionLabels",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionLabels",{},void 0,!0)]),key:"5"}:void 0,e.$slots.optionStack?{name:"optionStack",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"optionStack",{},void 0,!0)]),key:"6"}:void 0,e.$slots.optionFullscreen?{name:"optionFullscreen",fn:a.withCtx(({toggleFullscreen:r,isFullscreen:v})=>[a.renderSlot(e.$slots,"optionFullscreen",a.normalizeProps(a.guardReactiveProps({toggleFullscreen:r,isFullscreen:v})),void 0,!0)]),key:"7"}:void 0,e.$slots.optionAnnotator?{name:"optionAnnotator",fn:a.withCtx(({toggleAnnotator:r,isAnnotator:v})=>[a.renderSlot(e.$slots,"optionAnnotator",a.normalizeProps(a.guardReactiveProps({toggleAnnotator:r,isAnnotator:v})),void 0,!0)]),key:"8"}:void 0]),1032,["backgroundColor","color","isPrinting","isImaging","uid","hasTooltip","hasPdf","hasImg","hasXls","hasLabel","hasStack","hasFullscreen","hasTable","isFullscreen","isTooltip","isStacked","titles","chartElement","position","hasAnnotator","isAnnotation","onGeneratePdf","onGenerateImage"])):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"vue-ui-xy-canvas",style:a.normalizeStyle(`position: relative; aspect-ratio: ${ve.value}`),ref_key:"container",ref:I},[G.value?(a.openBlock(),a.createElementBlock("canvas",{key:0,ref_key:"canvas",ref:C,style:{width:"100%",height:"100%"},onMousemove:o[0]||(o[0]=r=>Ue(r)),onMouseleave:Xe},null,544)):(a.openBlock(),a.createBlock(lt.default,{key:1,config:{type:"line",style:{backgroundColor:t.value.style.chart.backgroundColor,line:{axis:{color:"#CCCCCC"},path:{color:"#CCCCCC",strokeWidth:.5}}}}},null,8,["config"])),a.createVNode(Je._sfc_main,{show:s.value.showTooltip&&A.value,backgroundColor:t.value.style.chart.tooltip.backgroundColor,color:t.value.style.chart.tooltip.color,fontSize:t.value.style.chart.tooltip.fontSize,borderRadius:t.value.style.chart.tooltip.borderRadius,borderColor:t.value.style.chart.tooltip.borderColor,borderWidth:t.value.style.chart.tooltip.borderWidth,position:t.value.style.chart.tooltip.position,offsetY:t.value.style.chart.tooltip.offsetY,parent:C.value,content:_.value,backgroundOpacity:t.value.style.chart.tooltip.backgroundOpacity,isCustom:a.unref(n.isFunction)(t.value.style.chart.tooltip.customFormat)},{"tooltip-before":a.withCtx(()=>[a.renderSlot(e.$slots,"tooltip-before",a.normalizeProps(a.guardReactiveProps({...ee.value})),void 0,!0)]),"tooltip-after":a.withCtx(()=>[a.renderSlot(e.$slots,"tooltip-after",a.normalizeProps(a.guardReactiveProps({...ee.value})),void 0,!0)]),_:3},8,["show","backgroundColor","color","fontSize","borderRadius","borderColor","borderWidth","position","offsetY","parent","content","backgroundOpacity","isCustom"])],4),a.createElementVNode("div",{ref_key:"chartSlicer",ref:re,style:a.normalizeStyle(`width:100%;background:${t.value.style.chart.backgroundColor}`),"data-html2canvas-ignore":""},[t.value.style.chart.zoom.show&&$.value>1?(a.openBlock(),a.createBlock(et.Slicer,{key:`slicer_${te.value}`,background:t.value.style.chart.zoom.color,borderColor:t.value.style.chart.backgroundColor,fontSize:t.value.style.chart.zoom.fontSize,useResetSlot:t.value.style.chart.zoom.useResetSlot,labelLeft:t.value.style.chart.grid.y.timeLabels.values[u.value.start]?t.value.style.chart.grid.y.timeLabels.values[u.value.start]:"",labelRight:t.value.style.chart.grid.y.timeLabels.values[u.value.end-1]?t.value.style.chart.grid.y.timeLabels.values[u.value.end-1]:"",textColor:t.value.style.chart.color,inputColor:t.value.style.chart.zoom.color,selectColor:t.value.style.chart.zoom.highlightColor,max:$.value,min:0,valueStart:u.value.start,valueEnd:u.value.end,start:u.value.start,"onUpdate:start":o[1]||(o[1]=r=>u.value.start=r),end:u.value.end,"onUpdate:end":o[2]||(o[2]=r=>u.value.end=r),onReset:me},{"reset-action":a.withCtx(({reset:r})=>[a.renderSlot(e.$slots,"reset-action",a.normalizeProps(a.guardReactiveProps({reset:r})),void 0,!0)]),_:3},8,["background","borderColor","fontSize","useResetSlot","labelLeft","labelRight","textColor","inputColor","selectColor","max","valueStart","valueEnd","start","end"])):a.createCommentVNode("",!0)],4),a.createElementVNode("div",{ref_key:"chartLegend",ref:oe},[t.value.style.chart.legend.show&&G.value?(a.openBlock(),a.createBlock(Ke.Legend,{legendSet:Le.value,config:Ze.value,key:`legend_${ie.value}`,onClickMarker:o[3]||(o[3]=({i:r})=>ke(r))},{item:a.withCtx(({legend:r,index:v})=>[a.createElementVNode("div",{onClick:h=>r.segregate(),style:a.normalizeStyle(`opacity:${L.value.includes(v)?.5:1}`)},a.toDisplayString(r.name),13,nt)]),_:1},8,["legendSet","config"])):a.renderSlot(e.$slots,"legend",{key:1,legend:Le.value},void 0,!0)],512),e.$slots.watermark?(a.openBlock(),a.createElementBlock("div",st,[a.renderSlot(e.$slots,"watermark",a.normalizeProps(a.guardReactiveProps({isPrinting:a.unref(de)||a.unref(he)})),void 0,!0)])):a.createCommentVNode("",!0),e.$slots.source?(a.openBlock(),a.createElementBlock("div",{key:3,ref_key:"source",ref:ue,dir:"auto"},[a.renderSlot(e.$slots,"source",{},void 0,!0)],512)):a.createCommentVNode("",!0),u.value.end-u.value.start<200?(a.openBlock(),a.createBlock(tt.default,{key:4,hideDetails:"",config:{open:s.value.showTable,maxHeight:1e4,body:{backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color},head:{backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color}}},{content:a.withCtx(()=>[(a.openBlock(),a.createBlock(at.DataTable,{key:`table_${se.value}`,colNames:q.value.colNames,head:q.value.head,body:q.value.body,config:q.value.config,title:`${t.value.style.chart.title.text}${t.value.style.chart.title.subtitle.text?` : ${t.value.style.chart.title.subtitle.text}`:""}`,onClose:o[4]||(o[4]=r=>s.value.showTable=!1)},{th:a.withCtx(({th:r})=>[a.createElementVNode("div",{innerHTML:r},null,8,it)]),td:a.withCtx(({td:r})=>[a.createTextVNode(a.toDisplayString(r),1)]),_:1},8,["colNames","head","body","config","title"]))]),_:1},8,["config"])):a.createCommentVNode("",!0),t.value.userOptions.buttons.annotator&&y.value.length?(a.openBlock(),a.createBlock(ot.PenAndPaper,{key:5,parent:B.value,backgroundColor:t.value.style.chart.backgroundColor,color:t.value.style.chart.color,active:Y.value,onClose:J},null,8,["parent","backgroundColor","color","active"])):a.createCommentVNode("",!0)],14,ut))}},vt=rt._export_sfc(ct,[["__scopeId","data-v-433caf88"]]);exports.default=vt;
|