@primeui/vue-chart 0.0.1-alpha.1 → 1.0.0-rc.1

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.
Files changed (180) hide show
  1. package/LICENSE.md +35 -0
  2. package/README.md +64 -0
  3. package/dist/CartesianRenderer.rich.spec.d.ts +1 -0
  4. package/dist/Chart.features.spec.d.ts +1 -0
  5. package/dist/Chart.interactions.spec.d.ts +1 -0
  6. package/dist/Chart.pointEvents.spec.d.ts +1 -0
  7. package/dist/Chart.vue.d.ts +5 -1
  8. package/dist/ChartCanvas.mjs +15 -14
  9. package/dist/ChartCanvas.pipeline.spec.d.ts +1 -0
  10. package/dist/ChartCanvas.vue.d.ts +8 -4
  11. package/dist/ChartGroup.sync.spec.d.ts +1 -0
  12. package/dist/ChartLegend.spec.d.ts +1 -0
  13. package/dist/ChartSvg.containers.spec.d.ts +1 -0
  14. package/dist/ChartSvg.declarative.spec.d.ts +1 -0
  15. package/dist/ChartSvg.export-menu.spec.d.ts +1 -0
  16. package/dist/ChartSvg.hover.spec.d.ts +1 -0
  17. package/dist/ChartSvg.mjs +15 -14
  18. package/dist/ChartSvg.renderers.spec.d.ts +1 -0
  19. package/dist/ChartSvg.vue.d.ts +8 -4
  20. package/dist/ColorLegendRenderer.branches.spec.d.ts +1 -0
  21. package/dist/ColorLegendRenderer.spec.d.ts +1 -0
  22. package/dist/LegendRenderer.spec.d.ts +1 -0
  23. package/dist/NavigatorRenderer.spec.d.ts +1 -0
  24. package/dist/RadialHeatmap.rich.spec.d.ts +1 -0
  25. package/dist/TooltipRenderer.spec.d.ts +1 -0
  26. package/dist/{chunk-6S4JMPKC.mjs → chunks/chunk-2NZ3PUWW.mjs} +2 -2
  27. package/dist/{chunk-RRHYGSK6.mjs → chunks/chunk-2TOEQNJ6.mjs} +2 -2
  28. package/dist/{chunk-GX2MK6VT.mjs → chunks/chunk-36DHPBYP.mjs} +25 -23
  29. package/dist/{chunk-RSTIA3KM.mjs → chunks/chunk-3DINEX6C.mjs} +2 -1
  30. package/dist/{chunk-PJVOZSPF.mjs → chunks/chunk-3JA5JAHF.mjs} +2 -2
  31. package/dist/{chunk-KOWFD2AE.mjs → chunks/chunk-3PJULFR5.mjs} +22 -21
  32. package/dist/chunks/chunk-3X27K5XC.mjs +236 -0
  33. package/dist/chunks/chunk-3XOLEGDL.mjs +182 -0
  34. package/dist/{chunk-372K2BMN.mjs → chunks/chunk-4EU72IBK.mjs} +71 -23
  35. package/dist/{chunk-PSSXPTLQ.mjs → chunks/chunk-4SLSYRNY.mjs} +6 -6
  36. package/dist/{chunk-4NJ2PSHV.mjs → chunks/chunk-5ZLVNQ2L.mjs} +7 -4
  37. package/dist/{chunk-O6L3PNFC.mjs → chunks/chunk-6Z4MZIJI.mjs} +2 -2
  38. package/dist/chunks/chunk-7EZEZMGG.mjs +22 -0
  39. package/dist/chunks/chunk-ADAGGXFG.mjs +166 -0
  40. package/dist/{chunk-YRKAI2R2.mjs → chunks/chunk-AKMQHU5T.mjs} +15 -14
  41. package/dist/{chunk-ZRCOVQQM.mjs → chunks/chunk-BSROML7P.mjs} +2 -2
  42. package/dist/{chunk-WYV2MHP6.mjs → chunks/chunk-CGFPDWB4.mjs} +1 -1
  43. package/dist/{chunk-4CRHCZV3.mjs → chunks/chunk-CMJXLIEY.mjs} +125 -9
  44. package/dist/{chunk-42J32DPD.mjs → chunks/chunk-CRIB3I3L.mjs} +1 -1
  45. package/dist/{chunk-WKSQR6L5.mjs → chunks/chunk-CW2KYVYO.mjs} +31 -8
  46. package/dist/{chunk-644ROAHU.mjs → chunks/chunk-DDRSIMLE.mjs} +33 -12
  47. package/dist/{chunk-32XIRBZ7.mjs → chunks/chunk-DXKAPWMO.mjs} +2 -2
  48. package/dist/{chunk-44BAFHPK.mjs → chunks/chunk-EWDMF46D.mjs} +10 -5
  49. package/dist/{chunk-E2U4W5FW.mjs → chunks/chunk-F7EK5D6J.mjs} +11 -11
  50. package/dist/{chunk-ZHFL3RYO.mjs → chunks/chunk-GE2Y2FHS.mjs} +6 -6
  51. package/dist/{chunk-AAX7FOW3.mjs → chunks/chunk-GIDIMIWE.mjs} +11 -11
  52. package/dist/{chunk-NLXOJSKK.mjs → chunks/chunk-GLFXRR7N.mjs} +29 -5
  53. package/dist/{chunk-W5M3BR6N.mjs → chunks/chunk-GV3CY6CQ.mjs} +1 -1
  54. package/dist/{chunk-CDXF6ZTL.mjs → chunks/chunk-HH5FUUXX.mjs} +1 -1
  55. package/dist/{chunk-RQURY2H3.mjs → chunks/chunk-HHZFGQN2.mjs} +2 -2
  56. package/dist/{chunk-2D3PWFR2.mjs → chunks/chunk-HVLFOABV.mjs} +4 -4
  57. package/dist/chunks/chunk-I2BWSDNR.mjs +832 -0
  58. package/dist/{chunk-MDA22SIZ.mjs → chunks/chunk-IFZSHQDZ.mjs} +2 -2
  59. package/dist/chunks/chunk-IRGQNA5W.mjs +289 -0
  60. package/dist/chunks/chunk-JBWL3G7O.mjs +86 -0
  61. package/dist/{chunk-56NMBNNX.mjs → chunks/chunk-JPKNWLLP.mjs} +3 -3
  62. package/dist/{chunk-XBDNMPF7.mjs → chunks/chunk-JVH4MDKX.mjs} +2 -2
  63. package/dist/chunks/chunk-KNNYJD4D.mjs +14 -0
  64. package/dist/{chunk-AUI5R4DA.mjs → chunks/chunk-L73MEG22.mjs} +2 -2
  65. package/dist/{chunk-K326BBF7.mjs → chunks/chunk-L74BEYTD.mjs} +38 -17
  66. package/dist/{chunk-DYVFVVTO.mjs → chunks/chunk-LJZCE7LQ.mjs} +102 -6
  67. package/dist/{chunk-YGHWUR7K.mjs → chunks/chunk-LP2YESP6.mjs} +1 -1
  68. package/dist/{chunk-WA735Y26.mjs → chunks/chunk-MGUGO3RV.mjs} +1 -1
  69. package/dist/{chunk-DOOXGOOB.mjs → chunks/chunk-OJHEN5FG.mjs} +96 -5
  70. package/dist/{chunk-ZNINPVG7.mjs → chunks/chunk-ON2FAZTD.mjs} +1 -1
  71. package/dist/{chunk-DLUFOM5K.mjs → chunks/chunk-PCBF6FSQ.mjs} +11 -11
  72. package/dist/{chunk-72KINEJ6.mjs → chunks/chunk-PR6MTWPJ.mjs} +10 -5
  73. package/dist/{chunk-FQTWLAVA.mjs → chunks/chunk-QJCMFAHB.mjs} +1 -1
  74. package/dist/{chunk-62NGBLQ7.mjs → chunks/chunk-QONZ3SCZ.mjs} +1 -1
  75. package/dist/{chunk-HANSF33Z.mjs → chunks/chunk-QOWKMWNO.mjs} +1 -1
  76. package/dist/{chunk-GA4VV5V4.mjs → chunks/chunk-R4AZOPXC.mjs} +1 -1
  77. package/dist/{chunk-5DWO3G33.mjs → chunks/chunk-SGLTVJUA.mjs} +35 -21
  78. package/dist/{chunk-5FTUGKPC.mjs → chunks/chunk-TRGN3ZMM.mjs} +5 -5
  79. package/dist/{chunk-RSAZ7V5Z.mjs → chunks/chunk-TZ23VBFU.mjs} +2 -2
  80. package/dist/{chunk-4UVPCLJ7.mjs → chunks/chunk-U6X3GVJ3.mjs} +1 -1
  81. package/dist/{chunk-J2P5JBHC.mjs → chunks/chunk-UOMQNZMT.mjs} +1 -1
  82. package/dist/{chunk-4THCGGER.mjs → chunks/chunk-UOZFNTVQ.mjs} +2 -2
  83. package/dist/{chunk-TIV2FI4S.mjs → chunks/chunk-WVNDZNMV.mjs} +2 -2
  84. package/dist/{chunk-GFC24374.mjs → chunks/chunk-X4NWFK7L.mjs} +5 -5
  85. package/dist/{chunk-FFBK7Q3W.mjs → chunks/chunk-YI3GLQYF.mjs} +67 -4
  86. package/dist/{chunk-HTZVV6VV.mjs → chunks/chunk-YZQS2YBK.mjs} +8 -6
  87. package/dist/{chunk-PQV55JYI.mjs → chunks/chunk-ZLD5VNMP.mjs} +2 -2
  88. package/dist/components/charts/ChartBar.mjs +13 -13
  89. package/dist/components/charts/ChartCandlestick.mjs +11 -11
  90. package/dist/components/charts/ChartHeatmap.mjs +11 -11
  91. package/dist/components/charts/ChartLine.mjs +12 -11
  92. package/dist/components/charts/ChartPie.mjs +12 -11
  93. package/dist/components/charts/ChartPolar.mjs +13 -11
  94. package/dist/components/charts/ChartRadar.mjs +13 -11
  95. package/dist/components/charts/ChartScatter.mjs +12 -11
  96. package/dist/components/charts/ChartTreemap.mjs +10 -10
  97. package/dist/components/containers/ChartDecimation.mjs +6 -6
  98. package/dist/components/containers/ChartGroup.mjs +4 -4
  99. package/dist/components/containers/ChartOverlap.mjs +5 -5
  100. package/dist/components/containers/ChartRange.mjs +6 -6
  101. package/dist/components/containers/ChartStacked.mjs +6 -6
  102. package/dist/components/containers/ChartWaterfall.mjs +5 -5
  103. package/dist/components/customizations/ChartAccessibility.mjs +9 -9
  104. package/dist/components/customizations/ChartAnnotation.mjs +5 -5
  105. package/dist/components/customizations/ChartAxisCategory.mjs +3 -3
  106. package/dist/components/customizations/ChartAxisGroup.mjs +3 -3
  107. package/dist/components/customizations/ChartBreadcrumb.mjs +6 -6
  108. package/dist/components/customizations/ChartCaption.mjs +9 -9
  109. package/dist/components/customizations/ChartColorLegend.mjs +9 -9
  110. package/dist/components/customizations/ChartDataLabels.mjs +9 -9
  111. package/dist/components/customizations/ChartExportMenu.mjs +9 -9
  112. package/dist/components/customizations/ChartHover.mjs +9 -9
  113. package/dist/components/customizations/ChartLegend.mjs +9 -9
  114. package/dist/components/customizations/ChartNavigator.mjs +10 -10
  115. package/dist/components/customizations/ChartReferenceBand.mjs +5 -5
  116. package/dist/components/customizations/ChartReferenceLine.mjs +5 -5
  117. package/dist/components/customizations/ChartResponsive.mjs +9 -9
  118. package/dist/components/customizations/ChartTitle.mjs +9 -9
  119. package/dist/components/customizations/ChartTooltip.mjs +9 -9
  120. package/dist/components/customizations/ChartXAxis.mjs +10 -10
  121. package/dist/components/customizations/ChartYAxis.mjs +10 -10
  122. package/dist/components/customizations/ChartZoom.mjs +9 -9
  123. package/dist/components/items/ChartItem.mjs +3 -3
  124. package/dist/components/items/ChartTreemapGroup.mjs +5 -5
  125. package/dist/components/renderers/CartesianRenderer.mjs +9 -9
  126. package/dist/components/renderers/CartesianRenderer.vue.d.ts +2 -0
  127. package/dist/components/renderers/ColorLegendRenderer.mjs +2 -2
  128. package/dist/components/renderers/LegendRenderer.mjs +3 -3
  129. package/dist/components/renderers/NavigatorRenderer.mjs +5 -5
  130. package/dist/components/renderers/RadialRenderer.mjs +9 -9
  131. package/dist/components/renderers/RadialRenderer.vue.d.ts +1 -1
  132. package/dist/components/renderers/RectRenderer.mjs +9 -9
  133. package/dist/components/renderers/RectRenderer.vue.d.ts +1 -1
  134. package/dist/components/renderers/TooltipRenderer.mjs +4 -4
  135. package/dist/components/renderers/layers/BarLayerCanvas.mjs +10 -10
  136. package/dist/components/renderers/layers/BarLayerSvg.mjs +10 -10
  137. package/dist/components/renderers/layers/CandlestickLayer.mjs +9 -9
  138. package/dist/components/renderers/layers/HeatmapLayer.mjs +9 -9
  139. package/dist/components/renderers/layers/LineLayer.mjs +10 -9
  140. package/dist/components/renderers/layers/PieLayer.mjs +7 -9
  141. package/dist/components/renderers/layers/PolarLayer.mjs +8 -9
  142. package/dist/components/renderers/layers/RadarLayer.mjs +8 -9
  143. package/dist/components/renderers/layers/ScatterLayer.mjs +10 -9
  144. package/dist/composables/index.d.ts +0 -8
  145. package/dist/composables/useAnimationProps.d.ts +2 -5
  146. package/dist/composables/useChartSync.spec.d.ts +1 -0
  147. package/dist/composables/useChartSyncCoordinator.spec.d.ts +1 -0
  148. package/dist/composables/useHeatmapRenderer.spec.d.ts +1 -0
  149. package/dist/composables/usePolarRenderer.spec.d.ts +1 -0
  150. package/dist/composables/useResponsiveConfig.d.ts +1 -1
  151. package/dist/composables/useResponsiveDimensions.spec.d.ts +1 -0
  152. package/dist/composables/useTreemapRenderer.spec.d.ts +1 -0
  153. package/dist/context/ChartContext.d.ts +1 -1
  154. package/dist/index.d.ts +2 -1
  155. package/dist/index.mjs +69 -66
  156. package/dist/namespace.mjs +69 -112
  157. package/dist/release-date.d.ts +1 -1
  158. package/dist/types/animation.types.d.ts +2 -0
  159. package/dist/types/bar.types.d.ts +2 -1
  160. package/dist/types/candlestick.types.d.ts +0 -1
  161. package/dist/types/heatmap.types.d.ts +0 -1
  162. package/dist/types/index.d.ts +1 -1
  163. package/dist/types/item.types.d.ts +0 -1
  164. package/dist/types/line.types.d.ts +4 -1
  165. package/dist/types/scatter.types.d.ts +3 -2
  166. package/dist/useChartContext.spec.d.ts +1 -0
  167. package/package.json +9 -14
  168. package/LICENSE +0 -23
  169. package/dist/chunk-54DLUFIA.mjs +0 -96
  170. package/dist/chunk-CQHNYT2V.mjs +0 -1692
  171. package/dist/chunk-JKK3D33U.mjs +0 -64
  172. package/dist/chunk-UO27BCRL.mjs +0 -86
  173. package/dist/chunk-VWABO23U.mjs +0 -143
  174. /package/dist/{chunk-FZ3PZ66C.mjs → chunks/chunk-4Q3QUNX6.mjs} +0 -0
  175. /package/dist/{chunk-5SRBQVU5.mjs → chunks/chunk-EHSDNH7K.mjs} +0 -0
  176. /package/dist/{chunk-LD57I4SY.mjs → chunks/chunk-H4HLHGUW.mjs} +0 -0
  177. /package/dist/{chunk-TEOO4OLV.mjs → chunks/chunk-L6N5IYAJ.mjs} +0 -0
  178. /package/dist/{chunk-E4ROAOPT.mjs → chunks/chunk-S4YR4YK7.mjs} +0 -0
  179. /package/dist/{chunk-7P6ASYW6.mjs → chunks/chunk-VIHIR2BE.mjs} +0 -0
  180. /package/dist/{chunk-J43KLCZF.mjs → chunks/chunk-ZH4A4L6W.mjs} +0 -0
@@ -0,0 +1,166 @@
1
+ import { useControllerLifecycle } from './chunk-KNNYJD4D.mjs';
2
+ import { normalizeDataLabelConfig } from './chunk-ZH4A4L6W.mjs';
3
+ import { useRadialFrameRegistration } from './chunk-7EZEZMGG.mjs';
4
+ import { useChartMethods, useChartState, useChartHover } from './chunk-QOWKMWNO.mjs';
5
+ import { defineComponent, computed, toRef, unref, openBlock, createElementBlock, createCommentVNode, ref, watch } from 'vue';
6
+ import { createPolarRendererCanvas } from '@primeui/chart-core/series/polar/controller-canvas';
7
+ import { createPolarRendererSvg } from '@primeui/chart-core/series/polar/controller-svg';
8
+
9
+ function usePolarRenderer(options) {
10
+ const { chartArea, renderer, datasets, features, hover, datasetVisibility, globalFont, adaptiveDataLabelFontSize, chartId, width, height, sharedContext, requestRedraw, dir, xAxes, yAxes, theme } = options;
11
+ const groupRef = ref(null);
12
+ const layoutRef = ref(null);
13
+ const controller = renderer === "canvas" ? createPolarRendererCanvas() : createPolarRendererSvg();
14
+ controller.onFrame = () => {
15
+ layoutRef.value = controller.layout;
16
+ };
17
+ const active = computed(() => controller.hasData);
18
+ function getLabelConfig() {
19
+ const dlProps = features.value.get("dataLabels")?.props;
20
+ return normalizeDataLabelConfig(dlProps, adaptiveDataLabelFontSize?.value, void 0, globalFont);
21
+ }
22
+ watch(
23
+ [datasets, chartArea, datasetVisibility, features, groupRef, xAxes, yAxes, dir, theme],
24
+ () => {
25
+ const area = chartArea.value;
26
+ if (!area) {
27
+ layoutRef.value = null;
28
+ return;
29
+ }
30
+ const hc = features.value.get("hover")?.props;
31
+ controller.update({
32
+ datasets: datasets.value,
33
+ datasetVisibility: datasetVisibility.value,
34
+ chartArea: area,
35
+ width: width.value,
36
+ height: height.value,
37
+ chartId,
38
+ renderer,
39
+ features: features.value,
40
+ hover: hover.value,
41
+ hoverConfig: hc,
42
+ globalFont,
43
+ adaptiveDataLabelFontSize: adaptiveDataLabelFontSize?.value,
44
+ sharedContext: sharedContext?.value,
45
+ svgGroup: groupRef.value,
46
+ requestRedraw,
47
+ labelConfig: getLabelConfig(),
48
+ dir: dir.value,
49
+ xAxes: xAxes?.value,
50
+ yAxes: yAxes?.value,
51
+ theme: theme.value
52
+ });
53
+ layoutRef.value = controller.layout;
54
+ },
55
+ { immediate: true, flush: "post" }
56
+ );
57
+ watch([hover, () => features.value.get("hover")?.props], () => {
58
+ controller.applyHover(hover.value);
59
+ });
60
+ const { applyPropertyAnimations, renderFrameCycle } = useControllerLifecycle(controller);
61
+ function hitTest(x, y) {
62
+ const hit = controller.hitTest(x, y);
63
+ if (!hit) return null;
64
+ return { datasetId: hit.datasetId, index: hit.index, label: hit.label, value: hit.value, color: hit.color };
65
+ }
66
+ function getPointPosition(datasetId, index) {
67
+ const layout = layoutRef.value;
68
+ const bar = layout?.bars.find((b) => b.datasetId === datasetId && b.dataIndex === index);
69
+ if (!layout || !bar) return null;
70
+ const midAngle = (bar.startAngle + bar.endAngle) / 2;
71
+ const midRadius = (bar.innerRadius + bar.outerRadius) / 2;
72
+ const rad = midAngle * Math.PI / 180;
73
+ const cx = layout.center.x + Math.cos(rad) * midRadius;
74
+ const cy = layout.center.y + Math.sin(rad) * midRadius;
75
+ const r = 6;
76
+ return { x: cx - r, y: cy - r, width: r * 2, height: r * 2, shape: "circle" };
77
+ }
78
+ function findAllNearest(x, y) {
79
+ const result = controller.findAllNearest(x, y);
80
+ if (!result) return null;
81
+ const { primary, allSeries } = result;
82
+ return {
83
+ primary: { datasetId: primary.datasetId, index: primary.index, label: primary.label, value: primary.value, color: primary.color },
84
+ allSeries
85
+ };
86
+ }
87
+ function renderCanvasContent(ctx, _canvas) {
88
+ controller.renderCanvasContent(ctx);
89
+ }
90
+ return {
91
+ groupRef,
92
+ hitTest,
93
+ getPointPosition,
94
+ findAllNearest,
95
+ active,
96
+ get center() {
97
+ return layoutRef.value?.center ?? controller.center;
98
+ },
99
+ layout: layoutRef,
100
+ renderCanvasContent,
101
+ applyPropertyAnimations,
102
+ renderFrameCycle
103
+ };
104
+ }
105
+
106
+ // src/components/renderers/layers/PolarLayer.vue
107
+ var _sfc_main = /* @__PURE__ */ defineComponent({
108
+ __name: "PolarLayer",
109
+ props: {
110
+ chartArea: {},
111
+ width: {},
112
+ height: {},
113
+ canvasEl: {},
114
+ adaptiveDataLabelFontSize: {},
115
+ sharedContext: {},
116
+ requestRedraw: { type: Function }
117
+ },
118
+ setup(__props) {
119
+ const props = __props;
120
+ const methods = useChartMethods();
121
+ const state = useChartState();
122
+ const hoverCtx = useChartHover();
123
+ const polar = usePolarRenderer({
124
+ chartArea: computed(() => props.chartArea),
125
+ renderer: methods.renderer,
126
+ canvasEl: toRef(props, "canvasEl"),
127
+ datasets: computed(() => state.value.datasets),
128
+ features: computed(() => state.value.features),
129
+ hover: computed(() => hoverCtx.value.hover),
130
+ datasetVisibility: computed(() => state.value.datasetVisibility),
131
+ globalFont: methods.font,
132
+ adaptiveDataLabelFontSize: computed(() => props.adaptiveDataLabelFontSize),
133
+ chartId: methods.chartId,
134
+ width: computed(() => props.width),
135
+ height: computed(() => props.height),
136
+ sharedContext: computed(() => props.sharedContext),
137
+ requestRedraw: () => props.requestRedraw(),
138
+ dir: computed(() => methods.dir),
139
+ xAxes: computed(() => state.value.axes.x),
140
+ yAxes: computed(() => state.value.axes.y),
141
+ theme: computed(() => methods.theme)
142
+ });
143
+ useRadialFrameRegistration({
144
+ type: "polar",
145
+ layout: polar.layout,
146
+ renderCanvasContent: polar.renderCanvasContent,
147
+ hitTest: (x, y) => polar.hitTest(x, y),
148
+ findAllNearest: (x, y) => polar.findAllNearest(x, y),
149
+ getCenter: () => polar.center ?? null,
150
+ getPointPosition: (datasetId, index) => polar.getPointPosition(datasetId, index),
151
+ applyPropertyAnimations: (store) => polar.applyPropertyAnimations(store),
152
+ renderFrameCycle: () => polar.renderFrameCycle()
153
+ });
154
+ return (_ctx, _cache) => {
155
+ return unref(methods).renderer === "svg" ? (openBlock(), createElementBlock("g", {
156
+ key: 0,
157
+ ref: (el) => {
158
+ unref(polar).groupRef.value = el;
159
+ }
160
+ }, null, 512)) : createCommentVNode("", true);
161
+ };
162
+ }
163
+ });
164
+ var PolarLayer_default = _sfc_main;
165
+
166
+ export { PolarLayer_default };
@@ -1,7 +1,7 @@
1
- import { useCartesianFrame, useCartesianFrameRegistration } from './chunk-CQHNYT2V.mjs';
2
- import { useChartMethods, useChartState, useChartHover } from './chunk-HANSF33Z.mjs';
3
- import { resolveBarLabels } from '@primeui/chart-core';
4
- import { computed, h, ref, watch, onUnmounted } from 'vue';
1
+ import { useCartesianFrame, useCartesianFrameRegistration } from './chunk-I2BWSDNR.mjs';
2
+ import { useChartMethods, useChartState, useChartHover } from './chunk-QOWKMWNO.mjs';
3
+ import { resolveBarLabels, safeRenderProp } from '@primeui/chart-core';
4
+ import { computed, h, ref, shallowRef, watch, onUnmounted } from 'vue';
5
5
 
6
6
  function useBarLayer(useBarRenderer) {
7
7
  const frame = useCartesianFrame();
@@ -33,12 +33,15 @@ function useBarLayer(useBarRenderer) {
33
33
  if (methods.renderer !== "svg" || !layout || !lc?.render) return [];
34
34
  const visibility = state.value.datasetVisibility;
35
35
  const nodes = [];
36
- for (const [dsId, barLayout] of bar.barLayouts) {
36
+ for (const [dsId, barLayout] of bar.liveLayouts.value) {
37
37
  if (visibility?.get(dsId) === false) continue;
38
38
  const dsTotal = layout.datasetTotals.get(dsId) ?? 0;
39
39
  const resolved = resolveBarLabels(barLayout.visibleBars, barLayout.colors, dsTotal, layout.orientation, lc, layout.isPercentStacked, bar.barRenderProps.get(dsId)?.name, bar.barRenderProps.get(dsId)?.data);
40
40
  for (const lbl of resolved) {
41
- const result = lc.render({ index: lbl.dataIndex, value: lbl.value, percentage: lbl.percentage, formattedText: lbl.text, label: lbl.seriesName ?? lbl.category, color: lbl.color, x: lbl.x, y: lbl.y });
41
+ const result = safeRenderProp(
42
+ () => lc.render({ index: lbl.dataIndex, value: lbl.value, percentage: lbl.percentage, formattedText: lbl.text, label: lbl.seriesName ?? lbl.category, color: lbl.color, x: lbl.x, y: lbl.y }),
43
+ "data label"
44
+ );
42
45
  if (result != null) {
43
46
  nodes.push(h("g", { key: `bar-${dsId}-${lbl.dataIndex}`, transform: `translate(${lbl.x},${lbl.y})`, "text-anchor": lbl.textAnchor, "dominant-baseline": lbl.baseline }, [result]));
44
47
  }
@@ -68,13 +71,10 @@ function useBarLayer(useBarRenderer) {
68
71
  function useBarRendererBase(controller, options) {
69
72
  const { renderer, canvasEl, datasets, datasetVisibility, hover, hoverConfig, chartId, layoutData, features, labelConfig, isZoomed, compositor, dir, theme } = options;
70
73
  const groupRef = ref(null);
71
- const hasBarData = computed(() => {
72
- const visibility = datasetVisibility.value;
73
- for (const [id, ds] of datasets.value) {
74
- if (ds.type === "bar" && visibility.get(id) !== false) return true;
75
- }
76
- return false;
77
- });
74
+ const liveLayoutsRef = shallowRef(controller.renderedLayouts);
75
+ controller.onFrame = () => {
76
+ liveLayoutsRef.value = controller.renderedLayouts;
77
+ };
78
78
  watch(
79
79
  [layoutData, datasetVisibility, features, groupRef, hoverConfig, theme, dir],
80
80
  () => {
@@ -107,6 +107,7 @@ function useBarRendererBase(controller, options) {
107
107
  svgGroup: groupRef.value,
108
108
  theme: theme.value
109
109
  });
110
+ liveLayoutsRef.value = controller.renderedLayouts;
110
111
  },
111
112
  { immediate: true, flush: "post" }
112
113
  );
@@ -136,12 +137,12 @@ function useBarRendererBase(controller, options) {
136
137
  hitTest,
137
138
  findNearest,
138
139
  findAllNearest,
139
- hasBarData,
140
140
  applyPropertyAnimations,
141
141
  renderFrameCycle,
142
142
  get barLayouts() {
143
143
  return controller.layouts;
144
144
  },
145
+ liveLayouts: liveLayoutsRef,
145
146
  get barRenderProps() {
146
147
  return controller.renderProps;
147
148
  }
@@ -1,5 +1,5 @@
1
- import { registerZoomController } from './chunk-CQHNYT2V.mjs';
2
- import { useCustomizationRegistration } from './chunk-PQV55JYI.mjs';
1
+ import { registerZoomController } from './chunk-I2BWSDNR.mjs';
2
+ import { useCustomizationRegistration } from './chunk-ZLD5VNMP.mjs';
3
3
  import { defineComponent, getCurrentInstance, computed } from 'vue';
4
4
  import { ZoomPanController } from '@primeui/chart-core';
5
5
 
@@ -1,4 +1,4 @@
1
- import { useCustomizationRegistration } from './chunk-PQV55JYI.mjs';
1
+ import { useCustomizationRegistration } from './chunk-ZLD5VNMP.mjs';
2
2
  import { defineComponent, computed, renderSlot } from 'vue';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,8 +1,118 @@
1
- import { useCartesianFrame, useLineRenderer, useCartesianFrameRegistration } from './chunk-CQHNYT2V.mjs';
2
- import { useChartMethods, useChartState, useChartHover } from './chunk-HANSF33Z.mjs';
3
- import { defineComponent, computed, h, unref, openBlock, createElementBlock, createCommentVNode } from 'vue';
4
- import { resolvePointLabels } from '@primeui/chart-core';
1
+ import { useControllerLifecycle } from './chunk-KNNYJD4D.mjs';
2
+ import { useCartesianFrame, useCartesianFrameRegistration } from './chunk-I2BWSDNR.mjs';
3
+ import { useChartMethods, useChartState, useChartHover } from './chunk-QOWKMWNO.mjs';
4
+ import { defineComponent, computed, h, unref, openBlock, createElementBlock, createCommentVNode, ref, shallowRef, watch } from 'vue';
5
+ import { resolvePointLabels, safeRenderProp } from '@primeui/chart-core';
6
+ import { createLineRendererCanvas } from '@primeui/chart-core/series/line/controller-canvas';
7
+ import { createLineRendererSvg } from '@primeui/chart-core/series/line/controller-svg';
5
8
 
9
+ function useLineRenderer(options) {
10
+ const {
11
+ chartArea,
12
+ renderer,
13
+ canvasEl,
14
+ datasets,
15
+ datasetVisibility,
16
+ hover,
17
+ hoverConfig,
18
+ chartId,
19
+ width,
20
+ height,
21
+ categoryScale,
22
+ valueScales,
23
+ firstValueAxisId,
24
+ axisIdProp,
25
+ orientation,
26
+ lineStackBasesMap,
27
+ lineTransformedValues,
28
+ rangeGroups,
29
+ features,
30
+ compositor,
31
+ layoutData,
32
+ dir,
33
+ theme
34
+ } = options;
35
+ const groupRef = ref(null);
36
+ const controller = renderer === "canvas" ? createLineRendererCanvas() : createLineRendererSvg();
37
+ const layoutCacheRef = shallowRef(/* @__PURE__ */ new Map());
38
+ const liveLayoutsRef = shallowRef(controller.renderedLayouts);
39
+ const renderPropsCacheRef = shallowRef(/* @__PURE__ */ new Map());
40
+ const markerOverlaysRef = ref([]);
41
+ controller.onFrame = () => {
42
+ markerOverlaysRef.value = controller.markerOverlays;
43
+ liveLayoutsRef.value = controller.renderedLayouts;
44
+ };
45
+ watch(
46
+ [datasets, datasetVisibility, chartArea, categoryScale, valueScales, firstValueAxisId, axisIdProp, lineStackBasesMap, lineTransformedValues, rangeGroups, features, groupRef, width, height, dir, theme],
47
+ () => {
48
+ if (renderer === "svg" && !groupRef.value) return;
49
+ controller.update({
50
+ datasets: datasets.value,
51
+ datasetVisibility: datasetVisibility.value,
52
+ chartArea: chartArea.value,
53
+ chartId,
54
+ width: width.value,
55
+ height: height.value,
56
+ renderer,
57
+ categoryScale: categoryScale.value,
58
+ valueXScales: layoutData?.value?.valueXScales,
59
+ valueScales: valueScales.value,
60
+ firstValueAxisId: firstValueAxisId.value,
61
+ axisIdProp: axisIdProp.value,
62
+ orientation: orientation?.value,
63
+ lineStackBasesMap: lineStackBasesMap.value,
64
+ lineTransformedValues: lineTransformedValues.value,
65
+ groupedDataOverride: layoutData?.value?.groupedDataOverride,
66
+ layoutData: layoutData?.value ?? null,
67
+ rangeGroups: rangeGroups.value,
68
+ features: features.value,
69
+ hover: hover.value,
70
+ hoverConfig: hoverConfig.value,
71
+ compositor,
72
+ canvasEl: canvasEl.value,
73
+ svgGroup: groupRef.value,
74
+ labelConfig: options.labelConfig?.value,
75
+ dir: dir.value,
76
+ theme: theme.value
77
+ });
78
+ layoutCacheRef.value = controller.layouts;
79
+ liveLayoutsRef.value = controller.renderedLayouts;
80
+ renderPropsCacheRef.value = controller.renderProps;
81
+ markerOverlaysRef.value = controller.markerOverlays;
82
+ },
83
+ { immediate: true, flush: "post" }
84
+ );
85
+ watch(hover, () => {
86
+ controller.applyHover(hover.value);
87
+ });
88
+ const { applyPropertyAnimations, renderFrameCycle } = useControllerLifecycle(controller);
89
+ function hitTest(x, y) {
90
+ return controller.hitTest(x, y);
91
+ }
92
+ function findAllNearest(x, y) {
93
+ return controller.findAllNearest(x, y);
94
+ }
95
+ function syncWithAnimatedScale(categoryScale2, valueScales2) {
96
+ controller.syncWithAnimatedScale(categoryScale2, valueScales2);
97
+ markerOverlaysRef.value = controller.markerOverlays;
98
+ liveLayoutsRef.value = controller.renderedLayouts;
99
+ }
100
+ return {
101
+ groupRef,
102
+ hitTest,
103
+ findAllNearest,
104
+ lineLayouts: layoutCacheRef,
105
+ liveLayouts: liveLayoutsRef,
106
+ lineRenderProps: renderPropsCacheRef,
107
+ subscribeTipPositions: (cb) => controller.subscribeTipPositions(cb),
108
+ markerOverlays: markerOverlaysRef,
109
+ syncWithAnimatedScale,
110
+ applyPropertyAnimations,
111
+ renderFrameCycle
112
+ };
113
+ }
114
+
115
+ // src/components/renderers/layers/LineLayer.vue
6
116
  var _hoisted_1 = ["clip-path"];
7
117
  var _sfc_main = /* @__PURE__ */ defineComponent({
8
118
  __name: "LineLayer",
@@ -27,6 +137,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
27
137
  valueScales: computed(() => frame.layoutData.value?.valueScales),
28
138
  firstValueAxisId: computed(() => frame.layoutData.value?.valueScales?.keys().next().value ?? "default"),
29
139
  axisIdProp: computed(() => frame.layoutData.value?.orientation === "horizontal" ? "xAxisId" : "yAxisId"),
140
+ orientation: computed(() => frame.layoutData.value?.orientation ?? "vertical"),
30
141
  lineStackBasesMap: computed(() => frame.layoutData.value?.lineStackBasesMap),
31
142
  lineTransformedValues: computed(() => frame.layoutData.value?.lineTransformedValues),
32
143
  rangeGroups: computed(() => frame.layoutData.value?.rangeGroups),
@@ -42,14 +153,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
42
153
  if (methods.renderer !== "svg" || !frame.layoutData.value || !lc?.render) return [];
43
154
  const visibility = state.value.datasetVisibility;
44
155
  const nodes = [];
45
- for (const [dsId, lineLayout] of line.lineLayouts.value) {
156
+ for (const [dsId, lineLayout] of line.liveLayouts.value) {
46
157
  if (visibility?.get(dsId) === false) continue;
47
158
  const lineProps = line.lineRenderProps.value.get(dsId);
48
159
  const seriesColor = typeof lineProps?.color === "string" ? lineProps.color : typeof lineLayout.lineColor === "string" ? lineLayout.lineColor : lc.color ?? "";
49
160
  const dsTotal = lineLayout.visiblePoints.reduce((sum, pt) => sum + Math.abs(pt.value ?? 0), 0);
50
161
  const resolved = resolvePointLabels(lineLayout.visiblePoints, seriesColor, dsTotal, lc, lineProps?.name);
51
162
  for (const lbl of resolved) {
52
- const result = lc.render({
163
+ const result = safeRenderProp(() => lc.render({
53
164
  index: lbl.dataIndex,
54
165
  value: lbl.value,
55
166
  percentage: lbl.percentage,
@@ -58,7 +169,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
58
169
  color: lbl.color,
59
170
  x: lbl.x,
60
171
  y: lbl.y
61
- });
172
+ }), "data label");
62
173
  if (result != null) {
63
174
  nodes.push(h("g", {
64
175
  key: `line-${dsId}-${lbl.dataIndex}`,
@@ -98,7 +209,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
98
209
  snapX: lnHit.x,
99
210
  snapY: lnHit.y,
100
211
  formattedValue: fmtVal,
101
- cursorFormattedValue: ""
212
+ cursorFormattedValue: "",
213
+ independentIsCategory: lnHit.independentIsCategory,
214
+ xValue: lnHit.xValue,
215
+ yValue: lnHit.yValue,
216
+ xAxisTitle: lnHit.xAxisTitle,
217
+ yAxisTitle: lnHit.yAxisTitle
102
218
  };
103
219
  },
104
220
  findAllNearest: (x, y) => line.findAllNearest(x, y),
@@ -126,7 +242,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
126
242
  }
127
243
  });
128
244
  return (_ctx, _cache) => {
129
- return unref(methods).renderer === "svg" && unref(line).hasLineData.value ? (openBlock(), createElementBlock("g", {
245
+ return unref(methods).renderer === "svg" ? (openBlock(), createElementBlock("g", {
130
246
  key: 0,
131
247
  ref: (el) => {
132
248
  unref(line).groupRef.value = el;
@@ -1,4 +1,4 @@
1
- import { useChartMethods } from './chunk-HANSF33Z.mjs';
1
+ import { useChartMethods } from './chunk-QOWKMWNO.mjs';
2
2
  import { defineComponent, computed, onMounted, watch, onUnmounted } from 'vue';
3
3
 
4
4
  var referenceLineIdCounter = 0;
@@ -1,9 +1,9 @@
1
- import { CandlestickLayer_default } from './chunk-FFBK7Q3W.mjs';
2
- import { CartesianRenderer_default } from './chunk-HTZVV6VV.mjs';
3
- import { registerFamilyRenderer, registerChartLayer, useDatasetAnimationRegistration, useDatasetRegistration, useItemCollector } from './chunk-CQHNYT2V.mjs';
4
- import { useRendererHint, useChartMethods } from './chunk-HANSF33Z.mjs';
1
+ import { CandlestickLayer_default } from './chunk-YI3GLQYF.mjs';
2
+ import { CartesianRenderer_default } from './chunk-YZQS2YBK.mjs';
3
+ import { registerFamilyRenderer, registerChartLayer, useDatasetAnimationRegistration, useDatasetRegistration, useItemCollector } from './chunk-I2BWSDNR.mjs';
4
+ import { useRendererHint, useChartMethods } from './chunk-QOWKMWNO.mjs';
5
5
  import { defineComponent, useSlots, computed, onMounted, watch, onUnmounted, renderSlot, createCommentVNode } from 'vue';
6
- import { candlestickRenderer } from '@primeui/chart-core';
6
+ import { candlestickRenderer } from '@primeui/chart-core/series/candlestick';
7
7
 
8
8
  var candlestickIdCounter = 0;
9
9
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -12,10 +12,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
12
12
  id: {},
13
13
  name: {},
14
14
  data: {},
15
- timeField: { type: [
15
+ categoryXField: { type: [
16
+ String,
17
+ Function,
18
+ Array
19
+ ] },
20
+ categoryYField: { type: [
21
+ String,
22
+ Function,
23
+ Array
24
+ ] },
25
+ valueXField: { type: [
26
+ String,
27
+ Function,
28
+ Number,
29
+ null,
30
+ Array
31
+ ] },
32
+ valueYField: { type: [
16
33
  String,
17
34
  Function,
18
35
  Number,
36
+ null,
19
37
  Array
20
38
  ] },
21
39
  openField: { type: [
@@ -136,7 +154,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
136
154
  const datasetProps = computed(() => ({
137
155
  id: autoId,
138
156
  data: props.data,
139
- timeField: props.timeField,
157
+ categoryXField: props.categoryXField,
158
+ categoryYField: props.categoryYField,
159
+ valueXField: props.valueXField,
160
+ valueYField: props.valueYField,
140
161
  openField: props.openField,
141
162
  highField: props.highField,
142
163
  lowField: props.lowField,
@@ -172,10 +193,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
172
193
  if (hasChildren.value) {
173
194
  let buildSynthesizedProps2 = function() {
174
195
  const items = getItems();
196
+ const horizontal = items.some((it) => it.categoryY != null);
197
+ const axisBinding = horizontal ? { categoryYField: (ctx) => ctx.datum.categoryY ?? "" } : { categoryXField: (ctx) => ctx.datum.categoryX ?? "" };
175
198
  return {
176
199
  id: autoId,
177
200
  data: items,
178
- timeField: (ctx) => ctx.datum.time ?? ctx.datum.label ?? "",
201
+ ...axisBinding,
179
202
  openField: (ctx) => ctx.datum.open ?? 0,
180
203
  highField: (ctx) => ctx.datum.high ?? 0,
181
204
  lowField: (ctx) => ctx.datum.low ?? 0,
@@ -1,10 +1,10 @@
1
- import { CartesianRenderer_default } from './chunk-HTZVV6VV.mjs';
2
- import { LineLayer_default } from './chunk-4CRHCZV3.mjs';
3
- import { registerFamilyRenderer, registerChartLayer, useDatasetAnimationRegistration, useDatasetRegistration, useItemCollector } from './chunk-CQHNYT2V.mjs';
4
- import { STACKED_CONTEXT_KEY, RANGE_CONTEXT_KEY } from './chunk-TEOO4OLV.mjs';
5
- import { useRendererHint, useChartMethods } from './chunk-HANSF33Z.mjs';
1
+ import { CartesianRenderer_default } from './chunk-YZQS2YBK.mjs';
2
+ import { LineLayer_default } from './chunk-CMJXLIEY.mjs';
3
+ import { registerFamilyRenderer, registerChartLayer, useDatasetAnimationRegistration, useDatasetRegistration, useItemCollector } from './chunk-I2BWSDNR.mjs';
4
+ import { STACKED_CONTEXT_KEY, RANGE_CONTEXT_KEY } from './chunk-L6N5IYAJ.mjs';
5
+ import { useRendererHint, useChartMethods } from './chunk-QOWKMWNO.mjs';
6
6
  import { defineComponent, useSlots, computed, inject, onMounted, watch, onUnmounted, renderSlot, createCommentVNode } from 'vue';
7
- import { lineRenderer } from '@primeui/chart-core';
7
+ import { lineRenderer } from '@primeui/chart-core/series/line';
8
8
 
9
9
  var lineIdCounter = 0;
10
10
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -13,12 +13,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
13
13
  id: {},
14
14
  boost: { type: [Boolean, String] },
15
15
  data: {},
16
- categoryField: { type: [
16
+ categoryXField: { type: [
17
17
  String,
18
18
  Function,
19
19
  Array
20
20
  ] },
21
- valueField: { type: [
21
+ categoryYField: { type: [
22
+ String,
23
+ Function,
24
+ Array
25
+ ] },
26
+ valueXField: { type: [
27
+ String,
28
+ Function,
29
+ Number,
30
+ null,
31
+ Array
32
+ ] },
33
+ valueYField: { type: [
22
34
  String,
23
35
  Function,
24
36
  Number,
@@ -193,8 +205,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
193
205
  const p = {
194
206
  id: autoId,
195
207
  data: props.data,
196
- categoryField: props.categoryField,
197
- valueField: props.valueField,
208
+ categoryXField: props.categoryXField,
209
+ categoryYField: props.categoryYField,
210
+ valueXField: props.valueXField,
211
+ valueYField: props.valueYField,
198
212
  color: props.color,
199
213
  name: props.name,
200
214
  order: effectiveOrder,
@@ -254,11 +268,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
254
268
  if (hasChildren.value) {
255
269
  let buildSynthesizedProps2 = function() {
256
270
  const items = getItems();
271
+ const horizontal = items.some((it) => it.categoryY != null);
272
+ const axisBinding = horizontal ? {
273
+ categoryYField: (ctx) => ctx.datum.categoryY ?? "",
274
+ valueXField: (ctx) => ctx.datum.valueX
275
+ } : {
276
+ categoryXField: (ctx) => ctx.datum.categoryX ?? "",
277
+ valueYField: (ctx) => ctx.datum.valueY
278
+ };
257
279
  return {
258
280
  id: autoId,
259
281
  data: items,
260
- categoryField: (ctx) => ctx.datum.label ?? "",
261
- valueField: (ctx) => ctx.datum.value,
282
+ ...axisBinding,
262
283
  pointColors: items.some((i) => i.color != null) ? items.map((i) => i.color) : void 0,
263
284
  name: props.name,
264
285
  color: props.color,
@@ -1,5 +1,5 @@
1
- import { AXIS_GROUP_REGISTRY_KEY } from './chunk-5SRBQVU5.mjs';
2
- import { useAxisComponentBase } from './chunk-CQHNYT2V.mjs';
1
+ import { AXIS_GROUP_REGISTRY_KEY } from './chunk-EHSDNH7K.mjs';
2
+ import { useAxisComponentBase } from './chunk-I2BWSDNR.mjs';
3
3
  import { defineComponent, useSlots, computed, provide, renderSlot } from 'vue';
4
4
 
5
5
  var __default__ = { inheritAttrs: false };
@@ -1,4 +1,4 @@
1
- import { Chart_default } from './chunk-372K2BMN.mjs';
1
+ import { Chart_default } from './chunk-4EU72IBK.mjs';
2
2
  import { defineComponent, ref, openBlock, createBlock, mergeProps, withCtx, renderSlot } from 'vue';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -25,10 +25,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
25
25
  type: [Object, Boolean],
26
26
  default: void 0
27
27
  },
28
- animations: {},
29
- transitions: {}
28
+ animations: {}
30
29
  },
31
- emits: ["resize"],
30
+ emits: [
31
+ "resize",
32
+ "point-click",
33
+ "point-hover"
34
+ ],
32
35
  setup(__props, { expose: __expose }) {
33
36
  const chartRef = ref(null);
34
37
  __expose({ redraw: () => chartRef.value?.redraw() });
@@ -38,7 +41,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
38
41
  ref: chartRef
39
42
  }, _ctx.$props, {
40
43
  renderer: "svg",
41
- onResize: _cache[0] || (_cache[0] = (w, h) => _ctx.$emit("resize", w, h))
44
+ onResize: _cache[0] || (_cache[0] = (w, h) => _ctx.$emit("resize", w, h)),
45
+ onPointClick: _cache[1] || (_cache[1] = (e) => _ctx.$emit("point-click", e)),
46
+ onPointHover: _cache[2] || (_cache[2] = (e) => _ctx.$emit("point-hover", e))
42
47
  }), {
43
48
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
44
49
  _: 3