@primeui/vue-chart 0.0.1-alpha.1 → 1.0.0-beta.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.
- package/dist/CartesianRenderer.rich.spec.d.ts +1 -0
- package/dist/Chart.features.spec.d.ts +1 -0
- package/dist/Chart.interactions.spec.d.ts +1 -0
- package/dist/Chart.pointEvents.spec.d.ts +1 -0
- package/dist/Chart.vue.d.ts +5 -1
- package/dist/ChartCanvas.mjs +15 -14
- package/dist/ChartCanvas.pipeline.spec.d.ts +1 -0
- package/dist/ChartCanvas.vue.d.ts +8 -4
- package/dist/ChartGroup.sync.spec.d.ts +1 -0
- package/dist/ChartLegend.spec.d.ts +1 -0
- package/dist/ChartSvg.containers.spec.d.ts +1 -0
- package/dist/ChartSvg.declarative.spec.d.ts +1 -0
- package/dist/ChartSvg.export-menu.spec.d.ts +1 -0
- package/dist/ChartSvg.hover.spec.d.ts +1 -0
- package/dist/ChartSvg.mjs +15 -14
- package/dist/ChartSvg.renderers.spec.d.ts +1 -0
- package/dist/ChartSvg.vue.d.ts +8 -4
- package/dist/ColorLegendRenderer.branches.spec.d.ts +1 -0
- package/dist/ColorLegendRenderer.spec.d.ts +1 -0
- package/dist/LegendRenderer.spec.d.ts +1 -0
- package/dist/NavigatorRenderer.spec.d.ts +1 -0
- package/dist/RadialHeatmap.rich.spec.d.ts +1 -0
- package/dist/TooltipRenderer.spec.d.ts +1 -0
- package/dist/{chunk-6S4JMPKC.mjs → chunks/chunk-2NZ3PUWW.mjs} +2 -2
- package/dist/{chunk-RRHYGSK6.mjs → chunks/chunk-2TOEQNJ6.mjs} +2 -2
- package/dist/{chunk-GX2MK6VT.mjs → chunks/chunk-36DHPBYP.mjs} +25 -23
- package/dist/{chunk-RSTIA3KM.mjs → chunks/chunk-3DINEX6C.mjs} +2 -1
- package/dist/{chunk-PJVOZSPF.mjs → chunks/chunk-3JA5JAHF.mjs} +2 -2
- package/dist/{chunk-KOWFD2AE.mjs → chunks/chunk-3PJULFR5.mjs} +22 -21
- package/dist/chunks/chunk-3X27K5XC.mjs +236 -0
- package/dist/chunks/chunk-3XOLEGDL.mjs +182 -0
- package/dist/{chunk-PSSXPTLQ.mjs → chunks/chunk-4SLSYRNY.mjs} +6 -6
- package/dist/chunks/chunk-4VWFG6HM.mjs +86 -0
- package/dist/{chunk-44BAFHPK.mjs → chunks/chunk-5HLEKAY2.mjs} +10 -5
- package/dist/{chunk-4NJ2PSHV.mjs → chunks/chunk-5ZLVNQ2L.mjs} +7 -4
- package/dist/{chunk-O6L3PNFC.mjs → chunks/chunk-6Z4MZIJI.mjs} +2 -2
- package/dist/chunks/chunk-7EZEZMGG.mjs +22 -0
- package/dist/chunks/chunk-ADAGGXFG.mjs +166 -0
- package/dist/{chunk-YRKAI2R2.mjs → chunks/chunk-AKMQHU5T.mjs} +15 -14
- package/dist/{chunk-ZRCOVQQM.mjs → chunks/chunk-BSROML7P.mjs} +2 -2
- package/dist/{chunk-WYV2MHP6.mjs → chunks/chunk-CGFPDWB4.mjs} +1 -1
- package/dist/{chunk-4CRHCZV3.mjs → chunks/chunk-CMJXLIEY.mjs} +125 -9
- package/dist/{chunk-42J32DPD.mjs → chunks/chunk-CRIB3I3L.mjs} +1 -1
- package/dist/{chunk-WKSQR6L5.mjs → chunks/chunk-CW2KYVYO.mjs} +31 -8
- package/dist/{chunk-644ROAHU.mjs → chunks/chunk-DDRSIMLE.mjs} +33 -12
- package/dist/{chunk-32XIRBZ7.mjs → chunks/chunk-DXKAPWMO.mjs} +2 -2
- package/dist/{chunk-372K2BMN.mjs → chunks/chunk-EKGCPOZJ.mjs} +56 -15
- package/dist/{chunk-E2U4W5FW.mjs → chunks/chunk-F7EK5D6J.mjs} +11 -11
- package/dist/{chunk-ZHFL3RYO.mjs → chunks/chunk-GE2Y2FHS.mjs} +6 -6
- package/dist/{chunk-AAX7FOW3.mjs → chunks/chunk-GIDIMIWE.mjs} +11 -11
- package/dist/{chunk-NLXOJSKK.mjs → chunks/chunk-GLFXRR7N.mjs} +29 -5
- package/dist/{chunk-W5M3BR6N.mjs → chunks/chunk-GV3CY6CQ.mjs} +1 -1
- package/dist/{chunk-CDXF6ZTL.mjs → chunks/chunk-HH5FUUXX.mjs} +1 -1
- package/dist/{chunk-RQURY2H3.mjs → chunks/chunk-HHZFGQN2.mjs} +2 -2
- package/dist/{chunk-2D3PWFR2.mjs → chunks/chunk-HVLFOABV.mjs} +4 -4
- package/dist/chunks/chunk-I2BWSDNR.mjs +832 -0
- package/dist/{chunk-MDA22SIZ.mjs → chunks/chunk-IFZSHQDZ.mjs} +2 -2
- package/dist/chunks/chunk-IRGQNA5W.mjs +289 -0
- package/dist/{chunk-72KINEJ6.mjs → chunks/chunk-IUGMS7ND.mjs} +10 -5
- package/dist/{chunk-56NMBNNX.mjs → chunks/chunk-JPKNWLLP.mjs} +3 -3
- package/dist/{chunk-XBDNMPF7.mjs → chunks/chunk-JVH4MDKX.mjs} +2 -2
- package/dist/chunks/chunk-KNNYJD4D.mjs +14 -0
- package/dist/{chunk-AUI5R4DA.mjs → chunks/chunk-L73MEG22.mjs} +2 -2
- package/dist/{chunk-K326BBF7.mjs → chunks/chunk-L74BEYTD.mjs} +38 -17
- package/dist/{chunk-DYVFVVTO.mjs → chunks/chunk-LJZCE7LQ.mjs} +102 -6
- package/dist/{chunk-YGHWUR7K.mjs → chunks/chunk-LP2YESP6.mjs} +1 -1
- package/dist/{chunk-WA735Y26.mjs → chunks/chunk-MGUGO3RV.mjs} +1 -1
- package/dist/{chunk-DOOXGOOB.mjs → chunks/chunk-OJHEN5FG.mjs} +96 -5
- package/dist/{chunk-ZNINPVG7.mjs → chunks/chunk-ON2FAZTD.mjs} +1 -1
- package/dist/{chunk-DLUFOM5K.mjs → chunks/chunk-PCBF6FSQ.mjs} +11 -11
- package/dist/{chunk-FQTWLAVA.mjs → chunks/chunk-QJCMFAHB.mjs} +1 -1
- package/dist/{chunk-62NGBLQ7.mjs → chunks/chunk-QONZ3SCZ.mjs} +1 -1
- package/dist/{chunk-HANSF33Z.mjs → chunks/chunk-QOWKMWNO.mjs} +1 -1
- package/dist/{chunk-GA4VV5V4.mjs → chunks/chunk-R4AZOPXC.mjs} +1 -1
- package/dist/{chunk-5DWO3G33.mjs → chunks/chunk-SGLTVJUA.mjs} +35 -21
- package/dist/{chunk-5FTUGKPC.mjs → chunks/chunk-TRGN3ZMM.mjs} +5 -5
- package/dist/{chunk-RSAZ7V5Z.mjs → chunks/chunk-TZ23VBFU.mjs} +2 -2
- package/dist/{chunk-4UVPCLJ7.mjs → chunks/chunk-U6X3GVJ3.mjs} +1 -1
- package/dist/{chunk-J2P5JBHC.mjs → chunks/chunk-UOMQNZMT.mjs} +1 -1
- package/dist/{chunk-4THCGGER.mjs → chunks/chunk-UOZFNTVQ.mjs} +2 -2
- package/dist/{chunk-TIV2FI4S.mjs → chunks/chunk-WVNDZNMV.mjs} +2 -2
- package/dist/{chunk-GFC24374.mjs → chunks/chunk-X4NWFK7L.mjs} +5 -5
- package/dist/{chunk-FFBK7Q3W.mjs → chunks/chunk-YI3GLQYF.mjs} +67 -4
- package/dist/{chunk-HTZVV6VV.mjs → chunks/chunk-YZQS2YBK.mjs} +8 -6
- package/dist/{chunk-PQV55JYI.mjs → chunks/chunk-ZLD5VNMP.mjs} +2 -2
- package/dist/components/charts/ChartBar.mjs +13 -13
- package/dist/components/charts/ChartCandlestick.mjs +11 -11
- package/dist/components/charts/ChartHeatmap.mjs +11 -11
- package/dist/components/charts/ChartLine.mjs +12 -11
- package/dist/components/charts/ChartPie.mjs +12 -11
- package/dist/components/charts/ChartPolar.mjs +13 -11
- package/dist/components/charts/ChartRadar.mjs +13 -11
- package/dist/components/charts/ChartScatter.mjs +12 -11
- package/dist/components/charts/ChartTreemap.mjs +10 -10
- package/dist/components/containers/ChartDecimation.mjs +6 -6
- package/dist/components/containers/ChartGroup.mjs +4 -4
- package/dist/components/containers/ChartOverlap.mjs +5 -5
- package/dist/components/containers/ChartRange.mjs +6 -6
- package/dist/components/containers/ChartStacked.mjs +6 -6
- package/dist/components/containers/ChartWaterfall.mjs +5 -5
- package/dist/components/customizations/ChartAccessibility.mjs +9 -9
- package/dist/components/customizations/ChartAnnotation.mjs +5 -5
- package/dist/components/customizations/ChartAxisCategory.mjs +3 -3
- package/dist/components/customizations/ChartAxisGroup.mjs +3 -3
- package/dist/components/customizations/ChartBreadcrumb.mjs +6 -6
- package/dist/components/customizations/ChartCaption.mjs +9 -9
- package/dist/components/customizations/ChartColorLegend.mjs +9 -9
- package/dist/components/customizations/ChartDataLabels.mjs +9 -9
- package/dist/components/customizations/ChartExportMenu.mjs +9 -9
- package/dist/components/customizations/ChartHover.mjs +9 -9
- package/dist/components/customizations/ChartLegend.mjs +9 -9
- package/dist/components/customizations/ChartNavigator.mjs +10 -10
- package/dist/components/customizations/ChartReferenceBand.mjs +5 -5
- package/dist/components/customizations/ChartReferenceLine.mjs +5 -5
- package/dist/components/customizations/ChartResponsive.mjs +9 -9
- package/dist/components/customizations/ChartTitle.mjs +9 -9
- package/dist/components/customizations/ChartTooltip.mjs +9 -9
- package/dist/components/customizations/ChartXAxis.mjs +10 -10
- package/dist/components/customizations/ChartYAxis.mjs +10 -10
- package/dist/components/customizations/ChartZoom.mjs +9 -9
- package/dist/components/items/ChartItem.mjs +3 -3
- package/dist/components/items/ChartTreemapGroup.mjs +5 -5
- package/dist/components/renderers/CartesianRenderer.mjs +9 -9
- package/dist/components/renderers/CartesianRenderer.vue.d.ts +2 -0
- package/dist/components/renderers/ColorLegendRenderer.mjs +2 -2
- package/dist/components/renderers/LegendRenderer.mjs +3 -3
- package/dist/components/renderers/NavigatorRenderer.mjs +5 -5
- package/dist/components/renderers/RadialRenderer.mjs +9 -9
- package/dist/components/renderers/RadialRenderer.vue.d.ts +1 -1
- package/dist/components/renderers/RectRenderer.mjs +9 -9
- package/dist/components/renderers/RectRenderer.vue.d.ts +1 -1
- package/dist/components/renderers/TooltipRenderer.mjs +4 -4
- package/dist/components/renderers/layers/BarLayerCanvas.mjs +10 -10
- package/dist/components/renderers/layers/BarLayerSvg.mjs +10 -10
- package/dist/components/renderers/layers/CandlestickLayer.mjs +9 -9
- package/dist/components/renderers/layers/HeatmapLayer.mjs +9 -9
- package/dist/components/renderers/layers/LineLayer.mjs +10 -9
- package/dist/components/renderers/layers/PieLayer.mjs +7 -9
- package/dist/components/renderers/layers/PolarLayer.mjs +8 -9
- package/dist/components/renderers/layers/RadarLayer.mjs +8 -9
- package/dist/components/renderers/layers/ScatterLayer.mjs +10 -9
- package/dist/composables/index.d.ts +0 -8
- package/dist/composables/useAnimationProps.d.ts +2 -5
- package/dist/composables/useChartSync.spec.d.ts +1 -0
- package/dist/composables/useChartSyncCoordinator.spec.d.ts +1 -0
- package/dist/composables/useHeatmapRenderer.spec.d.ts +1 -0
- package/dist/composables/usePolarRenderer.spec.d.ts +1 -0
- package/dist/composables/useResponsiveConfig.d.ts +1 -1
- package/dist/composables/useResponsiveDimensions.spec.d.ts +1 -0
- package/dist/composables/useTreemapRenderer.spec.d.ts +1 -0
- package/dist/context/ChartContext.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +69 -66
- package/dist/namespace.mjs +69 -112
- package/dist/types/animation.types.d.ts +2 -0
- package/dist/types/bar.types.d.ts +2 -1
- package/dist/types/candlestick.types.d.ts +0 -1
- package/dist/types/heatmap.types.d.ts +0 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/item.types.d.ts +0 -1
- package/dist/types/line.types.d.ts +4 -1
- package/dist/types/scatter.types.d.ts +3 -2
- package/dist/useChartContext.spec.d.ts +1 -0
- package/package.json +7 -7
- package/dist/chunk-54DLUFIA.mjs +0 -96
- package/dist/chunk-CQHNYT2V.mjs +0 -1692
- package/dist/chunk-JKK3D33U.mjs +0 -64
- package/dist/chunk-UO27BCRL.mjs +0 -86
- package/dist/chunk-VWABO23U.mjs +0 -143
- /package/dist/{chunk-FZ3PZ66C.mjs → chunks/chunk-4Q3QUNX6.mjs} +0 -0
- /package/dist/{chunk-5SRBQVU5.mjs → chunks/chunk-EHSDNH7K.mjs} +0 -0
- /package/dist/{chunk-LD57I4SY.mjs → chunks/chunk-H4HLHGUW.mjs} +0 -0
- /package/dist/{chunk-TEOO4OLV.mjs → chunks/chunk-L6N5IYAJ.mjs} +0 -0
- /package/dist/{chunk-E4ROAOPT.mjs → chunks/chunk-S4YR4YK7.mjs} +0 -0
- /package/dist/{chunk-7P6ASYW6.mjs → chunks/chunk-VIHIR2BE.mjs} +0 -0
- /package/dist/{chunk-J43KLCZF.mjs → chunks/chunk-ZH4A4L6W.mjs} +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { useControllerLifecycle } from './chunk-KNNYJD4D.mjs';
|
|
2
|
+
import { useRadialFrameRegistration } from './chunk-7EZEZMGG.mjs';
|
|
3
|
+
import { useChartMethods, useChartState, useChartHover } from './chunk-QOWKMWNO.mjs';
|
|
4
|
+
import { defineComponent, computed, toRef, unref, openBlock, createElementBlock, Fragment, createElementVNode, renderList, createBlock, createCommentVNode, ref, watch, h } from 'vue';
|
|
5
|
+
import { buildPieSliceContentItems } from '@primeui/chart-core';
|
|
6
|
+
import { createPieRendererCanvas } from '@primeui/chart-core/series/pie/controller-canvas';
|
|
7
|
+
import { createPieRendererSvg } from '@primeui/chart-core/series/pie/controller-svg';
|
|
8
|
+
|
|
9
|
+
function usePieRenderer(options) {
|
|
10
|
+
const { renderer, chartId, globalFont, adaptiveDataLabelFontSize, theme, dir } = options;
|
|
11
|
+
const groupRef = ref(null);
|
|
12
|
+
const labelGroupRef = ref(null);
|
|
13
|
+
const centerRef = ref(null);
|
|
14
|
+
const versionRef = ref(0);
|
|
15
|
+
const controller = renderer === "canvas" ? createPieRendererCanvas() : createPieRendererSvg();
|
|
16
|
+
controller.onFrame = () => {
|
|
17
|
+
versionRef.value++;
|
|
18
|
+
centerRef.value = controller.center;
|
|
19
|
+
};
|
|
20
|
+
watch(
|
|
21
|
+
[options.datasets, options.chartArea, options.datasetVisibility, options.hiddenItems, options.features, options.width, options.height, groupRef, dir, theme],
|
|
22
|
+
() => {
|
|
23
|
+
if (options.datasets.value.size === 0) return;
|
|
24
|
+
if (renderer === "svg" && !groupRef.value) return;
|
|
25
|
+
const hoverConfig = options.features.value.get("hover")?.props;
|
|
26
|
+
controller.update({
|
|
27
|
+
datasets: options.datasets.value,
|
|
28
|
+
datasetVisibility: options.datasetVisibility.value,
|
|
29
|
+
hiddenItems: options.hiddenItems.value,
|
|
30
|
+
chartArea: options.chartArea.value,
|
|
31
|
+
renderer,
|
|
32
|
+
width: options.width.value,
|
|
33
|
+
height: options.height.value,
|
|
34
|
+
chartId,
|
|
35
|
+
features: options.features.value,
|
|
36
|
+
hover: options.hover.value,
|
|
37
|
+
hoverConfig,
|
|
38
|
+
globalFont,
|
|
39
|
+
adaptiveDataLabelFontSize: adaptiveDataLabelFontSize?.value,
|
|
40
|
+
svgGroup: groupRef.value ?? void 0,
|
|
41
|
+
canvasEl: options.canvasEl.value ?? void 0,
|
|
42
|
+
dir: dir.value,
|
|
43
|
+
theme: theme.value
|
|
44
|
+
});
|
|
45
|
+
controller.registerLabelGroup(labelGroupRef.value);
|
|
46
|
+
centerRef.value = controller.center;
|
|
47
|
+
},
|
|
48
|
+
{ immediate: true, flush: "post" }
|
|
49
|
+
);
|
|
50
|
+
watch([options.hover, () => options.features.value.get("hover")?.props], () => {
|
|
51
|
+
controller.applyHover(options.hover.value);
|
|
52
|
+
});
|
|
53
|
+
const { applyPropertyAnimations, renderFrameCycle } = useControllerLifecycle(controller);
|
|
54
|
+
const svgContent = computed(() => {
|
|
55
|
+
if (renderer !== "svg") return [];
|
|
56
|
+
void versionRef.value;
|
|
57
|
+
const content = [];
|
|
58
|
+
for (const item of buildPieSliceContentItems(controller.entries, controller.lastRenderedSlices, controller.ringRadii, controller.animationLayout, options.hiddenItems.value, options.globalFont?.family, theme.value)) {
|
|
59
|
+
const result = item.renderFn(item.context);
|
|
60
|
+
if (result != null) {
|
|
61
|
+
content.push(
|
|
62
|
+
h(
|
|
63
|
+
"g",
|
|
64
|
+
{
|
|
65
|
+
key: item.datasetKey,
|
|
66
|
+
class: "slice-custom-content",
|
|
67
|
+
"data-dataset": item.datasetId,
|
|
68
|
+
"data-index": item.index,
|
|
69
|
+
transform: `translate(${item.contentX}, ${item.contentY})`,
|
|
70
|
+
onVnodeMounted: (vnode) => controller.registerCustomContent(item.key, vnode.el),
|
|
71
|
+
onVnodeUnmounted: () => controller.registerCustomContent(item.key, null)
|
|
72
|
+
},
|
|
73
|
+
[result]
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return content;
|
|
79
|
+
});
|
|
80
|
+
function hitTest(x, y) {
|
|
81
|
+
const hit = controller.hitTest(x, y);
|
|
82
|
+
if (!hit) return null;
|
|
83
|
+
return { datasetId: hit.datasetId, index: hit.index, label: hit.label, value: hit.value, percentage: hit.percentage, color: hit.color };
|
|
84
|
+
}
|
|
85
|
+
function getSlicePosition(datasetId, index) {
|
|
86
|
+
return controller.getSlicePosition(datasetId, index);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
groupRef,
|
|
90
|
+
labelGroupRef,
|
|
91
|
+
hitTest,
|
|
92
|
+
getSlicePosition,
|
|
93
|
+
center: centerRef,
|
|
94
|
+
svgContent,
|
|
95
|
+
applyPropertyAnimations,
|
|
96
|
+
renderFrameCycle
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/components/renderers/layers/PieLayer.vue
|
|
101
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
102
|
+
__name: "PieLayer",
|
|
103
|
+
props: {
|
|
104
|
+
chartArea: {},
|
|
105
|
+
width: {},
|
|
106
|
+
height: {},
|
|
107
|
+
canvasEl: {},
|
|
108
|
+
containerEl: {},
|
|
109
|
+
adaptiveDataLabelFontSize: {}
|
|
110
|
+
},
|
|
111
|
+
setup(__props) {
|
|
112
|
+
const VNodeRenderer = defineComponent({
|
|
113
|
+
props: { node: {
|
|
114
|
+
type: Object,
|
|
115
|
+
required: true
|
|
116
|
+
} },
|
|
117
|
+
render() {
|
|
118
|
+
return this.node;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const props = __props;
|
|
122
|
+
const methods = useChartMethods();
|
|
123
|
+
const state = useChartState();
|
|
124
|
+
const hoverCtx = useChartHover();
|
|
125
|
+
const pie = usePieRenderer({
|
|
126
|
+
chartArea: computed(() => props.chartArea),
|
|
127
|
+
renderer: methods.renderer,
|
|
128
|
+
canvasEl: toRef(props, "canvasEl"),
|
|
129
|
+
containerEl: toRef(props, "containerEl"),
|
|
130
|
+
datasets: computed(() => state.value.datasets),
|
|
131
|
+
features: computed(() => state.value.features),
|
|
132
|
+
hover: computed(() => hoverCtx.value.hover),
|
|
133
|
+
datasetVisibility: computed(() => state.value.datasetVisibility),
|
|
134
|
+
hiddenItems: computed(() => state.value.hiddenItems),
|
|
135
|
+
chartId: methods.chartId,
|
|
136
|
+
width: computed(() => props.width),
|
|
137
|
+
height: computed(() => props.height),
|
|
138
|
+
globalFont: methods.font,
|
|
139
|
+
adaptiveDataLabelFontSize: computed(() => props.adaptiveDataLabelFontSize),
|
|
140
|
+
dir: computed(() => methods.dir),
|
|
141
|
+
theme: computed(() => methods.theme)
|
|
142
|
+
});
|
|
143
|
+
useRadialFrameRegistration({
|
|
144
|
+
type: "pie",
|
|
145
|
+
hitTest: (x, y) => pie.hitTest(x, y),
|
|
146
|
+
getPointPosition: (datasetId, index) => {
|
|
147
|
+
const pos = pie.getSlicePosition(datasetId, index);
|
|
148
|
+
if (!pos) return null;
|
|
149
|
+
const r = 6;
|
|
150
|
+
return {
|
|
151
|
+
x: pos.x - r,
|
|
152
|
+
y: pos.y - r,
|
|
153
|
+
width: r * 2,
|
|
154
|
+
height: r * 2,
|
|
155
|
+
shape: "circle"
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
getCenter: () => pie.center.value,
|
|
159
|
+
applyPropertyAnimations: (store) => pie.applyPropertyAnimations(store),
|
|
160
|
+
renderFrameCycle: () => pie.renderFrameCycle()
|
|
161
|
+
});
|
|
162
|
+
return (_ctx, _cache) => {
|
|
163
|
+
return unref(methods).renderer === "svg" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
164
|
+
createElementVNode("g", { ref: (el) => {
|
|
165
|
+
unref(pie).groupRef.value = el;
|
|
166
|
+
} }, null, 512),
|
|
167
|
+
createElementVNode("g", { ref: (el) => {
|
|
168
|
+
unref(pie).labelGroupRef.value = el;
|
|
169
|
+
} }, null, 512),
|
|
170
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pie).svgContent.value, (el) => {
|
|
171
|
+
return openBlock(), createBlock(unref(VNodeRenderer), {
|
|
172
|
+
key: el.key ?? el.props?.key,
|
|
173
|
+
node: el
|
|
174
|
+
}, null, 8, ["node"]);
|
|
175
|
+
}), 128))
|
|
176
|
+
], 64)) : createCommentVNode("", true);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
var PieLayer_default = _sfc_main;
|
|
181
|
+
|
|
182
|
+
export { PieLayer_default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useCustomizationRegistration } from './chunk-
|
|
2
|
-
import { SYNC_BUS_KEY } from './chunk-
|
|
3
|
-
import { CHART_METHODS_KEY } from './chunk-
|
|
1
|
+
import { useCustomizationRegistration } from './chunk-ZLD5VNMP.mjs';
|
|
2
|
+
import { SYNC_BUS_KEY } from './chunk-H4HLHGUW.mjs';
|
|
3
|
+
import { CHART_METHODS_KEY } from './chunk-4Q3QUNX6.mjs';
|
|
4
4
|
import { defineComponent, inject, computed, ref, onMounted, onBeforeUnmount, openBlock, createElementBlock, Fragment, unref, normalizeStyle, normalizeClass, renderList, createBlock, resolveDynamicComponent, createElementVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
5
|
-
import { gradientToCssBackground, buildSharedLegendItems } from '@primeui/chart-core';
|
|
5
|
+
import { safeRenderProp, gradientToCssBackground, buildSharedLegendItems } from '@primeui/chart-core';
|
|
6
6
|
|
|
7
7
|
var _hoisted_1 = ["onClick", "onMouseenter"];
|
|
8
8
|
var _hoisted_2 = ["data-chart-gradient"];
|
|
@@ -151,7 +151,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
151
151
|
class: normalizeClass(props.class),
|
|
152
152
|
style: normalizeStyle([containerStyle.value, props.style])
|
|
153
153
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(sharedItems.value, (item) => {
|
|
154
|
-
return openBlock(), createElementBlock(Fragment, { key: getItemKey(item) }, [__props.render ? (openBlock(), createBlock(resolveDynamicComponent(() => __props.render({
|
|
154
|
+
return openBlock(), createElementBlock(Fragment, { key: getItemKey(item) }, [__props.render ? (openBlock(), createBlock(resolveDynamicComponent(() => unref(safeRenderProp)(() => __props.render({
|
|
155
155
|
type: item.type,
|
|
156
156
|
datasetId: item.datasetId,
|
|
157
157
|
label: item.label,
|
|
@@ -166,7 +166,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
166
166
|
onMouseLeave: () => {
|
|
167
167
|
hoveredId.value = null;
|
|
168
168
|
}
|
|
169
|
-
})), { key: 0 })) : (openBlock(), createElementBlock("button", {
|
|
169
|
+
}), "legend")), { key: 0 })) : (openBlock(), createElementBlock("button", {
|
|
170
170
|
key: 1,
|
|
171
171
|
type: "button",
|
|
172
172
|
style: normalizeStyle({
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ChartBar_default } from './chunk-L74BEYTD.mjs';
|
|
2
|
+
import { ChartTreemap_default } from './chunk-HVLFOABV.mjs';
|
|
3
|
+
import { ChartScatter_default } from './chunk-SGLTVJUA.mjs';
|
|
4
|
+
import { ChartRadar_default } from './chunk-F7EK5D6J.mjs';
|
|
5
|
+
import { ChartPolar_default } from './chunk-GIDIMIWE.mjs';
|
|
6
|
+
import { ChartPie_default } from './chunk-GE2Y2FHS.mjs';
|
|
7
|
+
import { ChartLine_default } from './chunk-DDRSIMLE.mjs';
|
|
8
|
+
import { ChartHeatmap_default } from './chunk-PCBF6FSQ.mjs';
|
|
9
|
+
import { ChartCandlestick_default } from './chunk-CW2KYVYO.mjs';
|
|
10
|
+
import { ChartAnnotation_default } from './chunk-ON2FAZTD.mjs';
|
|
11
|
+
import { ChartAccessibility_default } from './chunk-6Z4MZIJI.mjs';
|
|
12
|
+
import { ChartWaterfall_default } from './chunk-GV3CY6CQ.mjs';
|
|
13
|
+
import { ChartStacked_default } from './chunk-WVNDZNMV.mjs';
|
|
14
|
+
import { ChartRange_default } from './chunk-HHZFGQN2.mjs';
|
|
15
|
+
import { ChartOverlap_default } from './chunk-R4AZOPXC.mjs';
|
|
16
|
+
import { ChartGroup_default } from './chunk-3JA5JAHF.mjs';
|
|
17
|
+
import { ChartDecimation_default } from './chunk-TZ23VBFU.mjs';
|
|
18
|
+
import { ChartHover_default } from './chunk-3DINEX6C.mjs';
|
|
19
|
+
import { ChartExportMenu_default } from './chunk-X4NWFK7L.mjs';
|
|
20
|
+
import { ChartDataLabels_default } from './chunk-HH5FUUXX.mjs';
|
|
21
|
+
import { ChartColorLegend_default } from './chunk-CGFPDWB4.mjs';
|
|
22
|
+
import { ChartCaption_default } from './chunk-UOZFNTVQ.mjs';
|
|
23
|
+
import { ChartBreadcrumb_default } from './chunk-QONZ3SCZ.mjs';
|
|
24
|
+
import { ChartAxisGroup_default } from './chunk-MGUGO3RV.mjs';
|
|
25
|
+
import { ChartAxisCategory_default } from './chunk-QJCMFAHB.mjs';
|
|
26
|
+
import { ChartXAxis_default } from './chunk-DXKAPWMO.mjs';
|
|
27
|
+
import { ChartTooltip_default } from './chunk-LP2YESP6.mjs';
|
|
28
|
+
import { ChartTitle_default } from './chunk-2NZ3PUWW.mjs';
|
|
29
|
+
import { ChartResponsive_default } from './chunk-UOMQNZMT.mjs';
|
|
30
|
+
import { ChartReferenceLine_default } from './chunk-CRIB3I3L.mjs';
|
|
31
|
+
import { ChartReferenceBand_default } from './chunk-U6X3GVJ3.mjs';
|
|
32
|
+
import { ChartNavigator_default } from './chunk-JPKNWLLP.mjs';
|
|
33
|
+
import { ChartLegend_default } from './chunk-4SLSYRNY.mjs';
|
|
34
|
+
import { ChartTreemapGroup_default } from './chunk-L73MEG22.mjs';
|
|
35
|
+
import { ChartItem_default } from './chunk-3PJULFR5.mjs';
|
|
36
|
+
import { ChartZoom_default } from './chunk-BSROML7P.mjs';
|
|
37
|
+
import { ChartYAxis_default } from './chunk-JVH4MDKX.mjs';
|
|
38
|
+
import { ChartSvg_default } from './chunk-5HLEKAY2.mjs';
|
|
39
|
+
import { ChartCanvas_default } from './chunk-IUGMS7ND.mjs';
|
|
40
|
+
import { __export } from './chunk-VIHIR2BE.mjs';
|
|
41
|
+
|
|
42
|
+
// src/Chart.parts.ts
|
|
43
|
+
var Chart_parts_exports = {};
|
|
44
|
+
__export(Chart_parts_exports, {
|
|
45
|
+
Accessibility: () => ChartAccessibility_default,
|
|
46
|
+
Annotation: () => ChartAnnotation_default,
|
|
47
|
+
AxisCategory: () => ChartAxisCategory_default,
|
|
48
|
+
AxisGroup: () => ChartAxisGroup_default,
|
|
49
|
+
Bar: () => ChartBar_default,
|
|
50
|
+
Breadcrumb: () => ChartBreadcrumb_default,
|
|
51
|
+
Candlestick: () => ChartCandlestick_default,
|
|
52
|
+
Canvas: () => ChartCanvas_default,
|
|
53
|
+
Caption: () => ChartCaption_default,
|
|
54
|
+
ColorLegend: () => ChartColorLegend_default,
|
|
55
|
+
DataLabels: () => ChartDataLabels_default,
|
|
56
|
+
Decimation: () => ChartDecimation_default,
|
|
57
|
+
ExportMenu: () => ChartExportMenu_default,
|
|
58
|
+
Group: () => ChartGroup_default,
|
|
59
|
+
Heatmap: () => ChartHeatmap_default,
|
|
60
|
+
Hover: () => ChartHover_default,
|
|
61
|
+
Item: () => ChartItem_default,
|
|
62
|
+
Legend: () => ChartLegend_default,
|
|
63
|
+
Line: () => ChartLine_default,
|
|
64
|
+
Navigator: () => ChartNavigator_default,
|
|
65
|
+
Overlap: () => ChartOverlap_default,
|
|
66
|
+
Pie: () => ChartPie_default,
|
|
67
|
+
Polar: () => ChartPolar_default,
|
|
68
|
+
Radar: () => ChartRadar_default,
|
|
69
|
+
Range: () => ChartRange_default,
|
|
70
|
+
ReferenceBand: () => ChartReferenceBand_default,
|
|
71
|
+
ReferenceLine: () => ChartReferenceLine_default,
|
|
72
|
+
Responsive: () => ChartResponsive_default,
|
|
73
|
+
Scatter: () => ChartScatter_default,
|
|
74
|
+
Stacked: () => ChartStacked_default,
|
|
75
|
+
Svg: () => ChartSvg_default,
|
|
76
|
+
Title: () => ChartTitle_default,
|
|
77
|
+
Tooltip: () => ChartTooltip_default,
|
|
78
|
+
Treemap: () => ChartTreemap_default,
|
|
79
|
+
TreemapGroup: () => ChartTreemapGroup_default,
|
|
80
|
+
Waterfall: () => ChartWaterfall_default,
|
|
81
|
+
XAxis: () => ChartXAxis_default,
|
|
82
|
+
YAxis: () => ChartYAxis_default,
|
|
83
|
+
Zoom: () => ChartZoom_default
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export { Chart_parts_exports };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Chart_default } from './chunk-
|
|
1
|
+
import { Chart_default } from './chunk-EKGCPOZJ.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: [
|
|
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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useChartLayers, usePropertyAnimations } from './chunk-I2BWSDNR.mjs';
|
|
2
|
+
import { provideRadialFrame } from './chunk-7EZEZMGG.mjs';
|
|
3
|
+
import { useChartMethods, useChartState } from './chunk-QOWKMWNO.mjs';
|
|
3
4
|
import { defineComponent, computed, ref, watch, shallowRef, onUnmounted, openBlock, createElementBlock, Fragment, unref, createCommentVNode, renderList, createBlock, resolveDynamicComponent } from 'vue';
|
|
4
5
|
import { collectItems, computeRadialComboContext, materializeSvgGroup, renderRadialGridSvg, AnimatedPropertyStore, AnimationRegistry, buildRadialGridLayout, withReferenceFeatures, redrawRadialCanvas } from '@primeui/chart-core';
|
|
5
6
|
|
|
@@ -48,10 +49,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
49
|
const polarRaw = frame.handles.get("polar")?.layout?.value;
|
|
49
50
|
const src = radarRaw ? {
|
|
50
51
|
...radarRaw,
|
|
51
|
-
radius: radarRaw.radius
|
|
52
|
+
radius: radarRaw.radius,
|
|
53
|
+
innerRadius: 0
|
|
52
54
|
} : polarRaw ? {
|
|
53
55
|
...polarRaw,
|
|
54
|
-
radius: polarRaw.maxRadius
|
|
56
|
+
radius: polarRaw.maxRadius,
|
|
57
|
+
innerRadius: polarRaw.innerRadiusRatio * polarRaw.maxRadius
|
|
55
58
|
} : null;
|
|
56
59
|
if (!src) return _stickyGridLayout ? withReferenceFeatures(_stickyGridLayout, state.value.features) : null;
|
|
57
60
|
const xAxisProps = [...state.value.axes.x.values()][0]?.props;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { registerKeyboardController } from './chunk-
|
|
2
|
-
import { useCustomizationRegistration } from './chunk-
|
|
1
|
+
import { registerKeyboardController } from './chunk-I2BWSDNR.mjs';
|
|
2
|
+
import { useCustomizationRegistration } from './chunk-ZLD5VNMP.mjs';
|
|
3
3
|
import { defineComponent, getCurrentInstance, computed } from 'vue';
|
|
4
4
|
import { KeyboardNavigationController } from '@primeui/chart-core';
|
|
5
5
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { shallowReactive, provide, inject, onBeforeUnmount } from 'vue';
|
|
2
|
+
|
|
3
|
+
// src/composables/useRadialFrame.ts
|
|
4
|
+
var RADIAL_FRAME_KEY = /* @__PURE__ */ Symbol.for("primeui-chart-radial-frame");
|
|
5
|
+
function provideRadialFrame() {
|
|
6
|
+
const handles = shallowReactive(/* @__PURE__ */ new Map());
|
|
7
|
+
const frame = {
|
|
8
|
+
handles,
|
|
9
|
+
register: (h) => handles.set(h.type, h),
|
|
10
|
+
unregister: (type) => handles.delete(type)
|
|
11
|
+
};
|
|
12
|
+
provide(RADIAL_FRAME_KEY, frame);
|
|
13
|
+
return frame;
|
|
14
|
+
}
|
|
15
|
+
function useRadialFrameRegistration(handle) {
|
|
16
|
+
const frame = inject(RADIAL_FRAME_KEY, null);
|
|
17
|
+
if (!frame) return;
|
|
18
|
+
frame.register(handle);
|
|
19
|
+
onBeforeUnmount(() => frame.unregister(handle.type));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { provideRadialFrame, useRadialFrameRegistration };
|
|
@@ -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-
|
|
2
|
-
import { useChartMethods, useChartState, useChartHover } from './chunk-
|
|
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.
|
|
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 =
|
|
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
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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-
|
|
2
|
-
import { useCustomizationRegistration } from './chunk-
|
|
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
|
|