@primeui/vue-chart 0.0.1-alpha.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/LICENSE +23 -0
- package/README.md +1 -0
- package/dist/Chart.parts.d.ts +39 -0
- package/dist/Chart.vue.d.ts +27 -0
- package/dist/ChartCanvas.mjs +14 -0
- package/dist/ChartCanvas.render.spec.d.ts +1 -0
- package/dist/ChartCanvas.vue.d.ts +23 -0
- package/dist/ChartStacked.spec.d.ts +1 -0
- package/dist/ChartSvg.axes.spec.d.ts +1 -0
- package/dist/ChartSvg.context.spec.d.ts +1 -0
- package/dist/ChartSvg.customizations.spec.d.ts +1 -0
- package/dist/ChartSvg.features.spec.d.ts +1 -0
- package/dist/ChartSvg.legend.spec.d.ts +1 -0
- package/dist/ChartSvg.mjs +14 -0
- package/dist/ChartSvg.registration.spec.d.ts +1 -0
- package/dist/ChartSvg.render.spec.d.ts +1 -0
- package/dist/ChartSvg.vue.d.ts +23 -0
- package/dist/_test/fixtures.d.ts +34 -0
- package/dist/bundle-discipline.spec.d.ts +1 -0
- package/dist/chunk-2D3PWFR2.mjs +214 -0
- package/dist/chunk-32XIRBZ7.mjs +87 -0
- package/dist/chunk-372K2BMN.mjs +1476 -0
- package/dist/chunk-42J32DPD.mjs +70 -0
- package/dist/chunk-44BAFHPK.mjs +51 -0
- package/dist/chunk-4CRHCZV3.mjs +142 -0
- package/dist/chunk-4NJ2PSHV.mjs +230 -0
- package/dist/chunk-4THCGGER.mjs +53 -0
- package/dist/chunk-4UVPCLJ7.mjs +70 -0
- package/dist/chunk-54DLUFIA.mjs +96 -0
- package/dist/chunk-56NMBNNX.mjs +52 -0
- package/dist/chunk-5DWO3G33.mjs +276 -0
- package/dist/chunk-5FTUGKPC.mjs +167 -0
- package/dist/chunk-5SRBQVU5.mjs +6 -0
- package/dist/chunk-62NGBLQ7.mjs +28 -0
- package/dist/chunk-644ROAHU.mjs +362 -0
- package/dist/chunk-6S4JMPKC.mjs +55 -0
- package/dist/chunk-72KINEJ6.mjs +52 -0
- package/dist/chunk-7P6ASYW6.mjs +7 -0
- package/dist/chunk-AAX7FOW3.mjs +210 -0
- package/dist/chunk-AUI5R4DA.mjs +84 -0
- package/dist/chunk-CDXF6ZTL.mjs +50 -0
- package/dist/chunk-CQHNYT2V.mjs +1692 -0
- package/dist/chunk-DLUFOM5K.mjs +218 -0
- package/dist/chunk-DOOXGOOB.mjs +123 -0
- package/dist/chunk-DYVFVVTO.mjs +97 -0
- package/dist/chunk-E2U4W5FW.mjs +288 -0
- package/dist/chunk-E4ROAOPT.mjs +291 -0
- package/dist/chunk-FFBK7Q3W.mjs +91 -0
- package/dist/chunk-FQTWLAVA.mjs +23 -0
- package/dist/chunk-FZ3PZ66C.mjs +12 -0
- package/dist/chunk-GA4VV5V4.mjs +21 -0
- package/dist/chunk-GFC24374.mjs +244 -0
- package/dist/chunk-GX2MK6VT.mjs +255 -0
- package/dist/chunk-HANSF33Z.mjs +169 -0
- package/dist/chunk-HTZVV6VV.mjs +550 -0
- package/dist/chunk-J2P5JBHC.mjs +26 -0
- package/dist/chunk-J43KLCZF.mjs +10 -0
- package/dist/chunk-JKK3D33U.mjs +64 -0
- package/dist/chunk-K326BBF7.mjs +276 -0
- package/dist/chunk-KOWFD2AE.mjs +72 -0
- package/dist/chunk-LD57I4SY.mjs +5 -0
- package/dist/chunk-MDA22SIZ.mjs +29 -0
- package/dist/chunk-NLXOJSKK.mjs +727 -0
- package/dist/chunk-O6L3PNFC.mjs +49 -0
- package/dist/chunk-PJVOZSPF.mjs +55 -0
- package/dist/chunk-PQV55JYI.mjs +38 -0
- package/dist/chunk-PSSXPTLQ.mjs +210 -0
- package/dist/chunk-RQURY2H3.mjs +40 -0
- package/dist/chunk-RRHYGSK6.mjs +29 -0
- package/dist/chunk-RSAZ7V5Z.mjs +42 -0
- package/dist/chunk-RSTIA3KM.mjs +41 -0
- package/dist/chunk-TEOO4OLV.mjs +6 -0
- package/dist/chunk-TIV2FI4S.mjs +53 -0
- package/dist/chunk-UO27BCRL.mjs +86 -0
- package/dist/chunk-VWABO23U.mjs +143 -0
- package/dist/chunk-W5M3BR6N.mjs +26 -0
- package/dist/chunk-WA735Y26.mjs +101 -0
- package/dist/chunk-WKSQR6L5.mjs +247 -0
- package/dist/chunk-WYV2MHP6.mjs +34 -0
- package/dist/chunk-XBDNMPF7.mjs +87 -0
- package/dist/chunk-YGHWUR7K.mjs +45 -0
- package/dist/chunk-YRKAI2R2.mjs +151 -0
- package/dist/chunk-ZHFL3RYO.mjs +228 -0
- package/dist/chunk-ZNINPVG7.mjs +30 -0
- package/dist/chunk-ZRCOVQQM.mjs +47 -0
- package/dist/components/charts/ChartBar.mjs +13 -0
- package/dist/components/charts/ChartBar.vue.d.ts +11 -0
- package/dist/components/charts/ChartCandlestick.mjs +11 -0
- package/dist/components/charts/ChartCandlestick.vue.d.ts +11 -0
- package/dist/components/charts/ChartHeatmap.mjs +11 -0
- package/dist/components/charts/ChartHeatmap.vue.d.ts +11 -0
- package/dist/components/charts/ChartLine.mjs +11 -0
- package/dist/components/charts/ChartLine.vue.d.ts +11 -0
- package/dist/components/charts/ChartPie.mjs +11 -0
- package/dist/components/charts/ChartPie.vue.d.ts +15 -0
- package/dist/components/charts/ChartPolar.mjs +11 -0
- package/dist/components/charts/ChartPolar.vue.d.ts +11 -0
- package/dist/components/charts/ChartRadar.mjs +11 -0
- package/dist/components/charts/ChartRadar.vue.d.ts +11 -0
- package/dist/components/charts/ChartScatter.mjs +11 -0
- package/dist/components/charts/ChartScatter.vue.d.ts +11 -0
- package/dist/components/charts/ChartTreemap.mjs +10 -0
- package/dist/components/charts/ChartTreemap.vue.d.ts +15 -0
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/containers/ChartDecimation.mjs +6 -0
- package/dist/components/containers/ChartDecimation.vue.d.ts +29 -0
- package/dist/components/containers/ChartGroup.mjs +4 -0
- package/dist/components/containers/ChartGroup.vue.d.ts +13 -0
- package/dist/components/containers/ChartOverlap.mjs +5 -0
- package/dist/components/containers/ChartOverlap.vue.d.ts +13 -0
- package/dist/components/containers/ChartRange.mjs +6 -0
- package/dist/components/containers/ChartRange.vue.d.ts +13 -0
- package/dist/components/containers/ChartStacked.mjs +6 -0
- package/dist/components/containers/ChartStacked.vue.d.ts +21 -0
- package/dist/components/containers/ChartWaterfall.mjs +5 -0
- package/dist/components/containers/ChartWaterfall.vue.d.ts +17 -0
- package/dist/components/containers/keys.d.ts +5 -0
- package/dist/components/customizations/ChartAccessibility.mjs +9 -0
- package/dist/components/customizations/ChartAccessibility.vue.d.ts +28 -0
- package/dist/components/customizations/ChartAnnotation.mjs +5 -0
- package/dist/components/customizations/ChartAnnotation.vue.d.ts +8 -0
- package/dist/components/customizations/ChartAxisCategory.mjs +3 -0
- package/dist/components/customizations/ChartAxisCategory.vue.d.ts +4 -0
- package/dist/components/customizations/ChartAxisGroup.mjs +3 -0
- package/dist/components/customizations/ChartAxisGroup.vue.d.ts +14 -0
- package/dist/components/customizations/ChartBreadcrumb.mjs +6 -0
- package/dist/components/customizations/ChartBreadcrumb.vue.d.ts +15 -0
- package/dist/components/customizations/ChartCaption.mjs +9 -0
- package/dist/components/customizations/ChartCaption.vue.d.ts +4 -0
- package/dist/components/customizations/ChartColorLegend.mjs +9 -0
- package/dist/components/customizations/ChartColorLegend.vue.d.ts +47 -0
- package/dist/components/customizations/ChartDataLabels.mjs +9 -0
- package/dist/components/customizations/ChartDataLabels.vue.d.ts +53 -0
- package/dist/components/customizations/ChartExportMenu.mjs +9 -0
- package/dist/components/customizations/ChartExportMenu.vue.d.ts +29 -0
- package/dist/components/customizations/ChartHover.mjs +9 -0
- package/dist/components/customizations/ChartHover.vue.d.ts +4 -0
- package/dist/components/customizations/ChartLegend.mjs +9 -0
- package/dist/components/customizations/ChartLegend.vue.d.ts +7 -0
- package/dist/components/customizations/ChartNavigator.mjs +10 -0
- package/dist/components/customizations/ChartNavigator.vue.d.ts +4 -0
- package/dist/components/customizations/ChartReferenceBand.mjs +5 -0
- package/dist/components/customizations/ChartReferenceBand.vue.d.ts +4 -0
- package/dist/components/customizations/ChartReferenceLine.mjs +5 -0
- package/dist/components/customizations/ChartReferenceLine.vue.d.ts +4 -0
- package/dist/components/customizations/ChartResponsive.mjs +9 -0
- package/dist/components/customizations/ChartResponsive.vue.d.ts +12 -0
- package/dist/components/customizations/ChartTitle.mjs +9 -0
- package/dist/components/customizations/ChartTitle.vue.d.ts +4 -0
- package/dist/components/customizations/ChartTooltip.mjs +9 -0
- package/dist/components/customizations/ChartTooltip.vue.d.ts +6 -0
- package/dist/components/customizations/ChartXAxis.mjs +10 -0
- package/dist/components/customizations/ChartXAxis.vue.d.ts +24 -0
- package/dist/components/customizations/ChartYAxis.mjs +10 -0
- package/dist/components/customizations/ChartYAxis.vue.d.ts +23 -0
- package/dist/components/customizations/ChartZoom.mjs +9 -0
- package/dist/components/customizations/ChartZoom.vue.d.ts +4 -0
- package/dist/components/customizations/axisGroupKeys.d.ts +8 -0
- package/dist/components/customizations/index.d.ts +20 -0
- package/dist/components/items/ChartItem.mjs +3 -0
- package/dist/components/items/ChartItem.vue.d.ts +4 -0
- package/dist/components/items/ChartTreemapGroup.mjs +5 -0
- package/dist/components/items/ChartTreemapGroup.vue.d.ts +11 -0
- package/dist/components/items/index.d.ts +1 -0
- package/dist/components/renderers/CartesianRenderer.mjs +9 -0
- package/dist/components/renderers/CartesianRenderer.vue.d.ts +66 -0
- package/dist/components/renderers/ColorLegendRenderer.mjs +2 -0
- package/dist/components/renderers/ColorLegendRenderer.vue.d.ts +15 -0
- package/dist/components/renderers/LegendRenderer.mjs +3 -0
- package/dist/components/renderers/LegendRenderer.vue.d.ts +20 -0
- package/dist/components/renderers/NavigatorRenderer.mjs +5 -0
- package/dist/components/renderers/NavigatorRenderer.vue.d.ts +16 -0
- package/dist/components/renderers/RadialRenderer.mjs +9 -0
- package/dist/components/renderers/RadialRenderer.vue.d.ts +39 -0
- package/dist/components/renderers/RectRenderer.mjs +9 -0
- package/dist/components/renderers/RectRenderer.vue.d.ts +32 -0
- package/dist/components/renderers/TooltipRenderer.mjs +4 -0
- package/dist/components/renderers/TooltipRenderer.vue.d.ts +11 -0
- package/dist/components/renderers/layers/BarLayerCanvas.mjs +10 -0
- package/dist/components/renderers/layers/BarLayerCanvas.vue.d.ts +3 -0
- package/dist/components/renderers/layers/BarLayerSvg.mjs +10 -0
- package/dist/components/renderers/layers/BarLayerSvg.vue.d.ts +3 -0
- package/dist/components/renderers/layers/CandlestickLayer.mjs +9 -0
- package/dist/components/renderers/layers/CandlestickLayer.vue.d.ts +3 -0
- package/dist/components/renderers/layers/HeatmapLayer.mjs +9 -0
- package/dist/components/renderers/layers/HeatmapLayer.vue.d.ts +3 -0
- package/dist/components/renderers/layers/LineLayer.mjs +9 -0
- package/dist/components/renderers/layers/LineLayer.vue.d.ts +3 -0
- package/dist/components/renderers/layers/PieLayer.mjs +9 -0
- package/dist/components/renderers/layers/PieLayer.vue.d.ts +12 -0
- package/dist/components/renderers/layers/PolarLayer.mjs +9 -0
- package/dist/components/renderers/layers/PolarLayer.vue.d.ts +16 -0
- package/dist/components/renderers/layers/RadarLayer.mjs +9 -0
- package/dist/components/renderers/layers/RadarLayer.vue.d.ts +16 -0
- package/dist/components/renderers/layers/ScatterLayer.mjs +9 -0
- package/dist/components/renderers/layers/ScatterLayer.vue.d.ts +3 -0
- package/dist/composables/index.d.ts +35 -0
- package/dist/composables/useAnimationProps.d.ts +21 -0
- package/dist/composables/useAxisComponentBase.d.ts +11 -0
- package/dist/composables/useAxisRegistration.d.ts +7 -0
- package/dist/composables/useAxisTransition.d.ts +6 -0
- package/dist/composables/useBarLayer.d.ts +9 -0
- package/dist/composables/useBarRenderer.canvas.d.ts +2 -0
- package/dist/composables/useBarRenderer.svg.d.ts +2 -0
- package/dist/composables/useBarRendererBase.d.ts +3 -0
- package/dist/composables/useCandlestickRenderer.d.ts +2 -0
- package/dist/composables/useCartesianAnimation.d.ts +2 -0
- package/dist/composables/useCartesianFrame.d.ts +72 -0
- package/dist/composables/useCartesianLayout.d.ts +3 -0
- package/dist/composables/useChartContext.d.ts +40 -0
- package/dist/composables/useChartLayers.d.ts +31 -0
- package/dist/composables/useChartRefreshHook.d.ts +1 -0
- package/dist/composables/useChartSync.d.ts +2 -0
- package/dist/composables/useChartSyncCoordinator.d.ts +23 -0
- package/dist/composables/useControllerLifecycle.d.ts +18 -0
- package/dist/composables/useCustomizationRegistration.d.ts +18 -0
- package/dist/composables/useDatasetAnimationContext.d.ts +14 -0
- package/dist/composables/useDatasetRegistration.d.ts +6 -0
- package/dist/composables/useDrilldownState.d.ts +3 -0
- package/dist/composables/useFamilyRenderers.d.ts +10 -0
- package/dist/composables/useFamilyRenderers.spec.d.ts +1 -0
- package/dist/composables/useHeatmapRenderer.d.ts +2 -0
- package/dist/composables/useItemCollector.d.ts +2 -0
- package/dist/composables/useKeyboardController.d.ts +8 -0
- package/dist/composables/useKeyboardNavigation.d.ts +2 -0
- package/dist/composables/useLineRenderer.d.ts +2 -0
- package/dist/composables/useNavigatorRenderer.d.ts +7 -0
- package/dist/composables/usePieRenderer.d.ts +2 -0
- package/dist/composables/usePolarRenderer.d.ts +2 -0
- package/dist/composables/usePropertyAnimations.d.ts +4 -0
- package/dist/composables/useRadarRenderer.d.ts +2 -0
- package/dist/composables/useRadialFrame.d.ts +39 -0
- package/dist/composables/useResponsiveConfig.d.ts +8 -0
- package/dist/composables/useResponsiveDimensions.d.ts +2 -0
- package/dist/composables/useScatterRenderer.d.ts +2 -0
- package/dist/composables/useTreemapRenderer.d.ts +2 -0
- package/dist/composables/useZoomController.d.ts +9 -0
- package/dist/composables/useZoomPan.d.ts +2 -0
- package/dist/context/ChartContext.d.ts +21 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/keys.d.ts +52 -0
- package/dist/context/syncKeys.d.ts +5 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.mjs +67 -0
- package/dist/namespace.d.ts +1 -0
- package/dist/namespace.mjs +112 -0
- package/dist/release-date.d.ts +11 -0
- package/dist/types/animation.types.d.ts +38 -0
- package/dist/types/axes.types.d.ts +27 -0
- package/dist/types/axisComponentBase.types.d.ts +5 -0
- package/dist/types/axisGroup.types.d.ts +1 -0
- package/dist/types/bar.types.d.ts +42 -0
- package/dist/types/breadcrumb.types.d.ts +12 -0
- package/dist/types/candlestick.types.d.ts +41 -0
- package/dist/types/canvas.types.d.ts +5 -0
- package/dist/types/caption.types.d.ts +8 -0
- package/dist/types/cartesian.types.d.ts +22 -0
- package/dist/types/chart.types.d.ts +51 -0
- package/dist/types/heatmap.types.d.ts +58 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/item.types.d.ts +25 -0
- package/dist/types/keyboard.types.d.ts +24 -0
- package/dist/types/layout.types.d.ts +35 -0
- package/dist/types/legend.types.d.ts +13 -0
- package/dist/types/line.types.d.ts +64 -0
- package/dist/types/pie.types.d.ts +49 -0
- package/dist/types/polar.types.d.ts +63 -0
- package/dist/types/radar.types.d.ts +56 -0
- package/dist/types/responsiveDimensions.types.d.ts +16 -0
- package/dist/types/scatter.types.d.ts +50 -0
- package/dist/types/svg.types.d.ts +44 -0
- package/dist/types/tooltip.types.d.ts +6 -0
- package/dist/types/treemap.types.d.ts +50 -0
- package/dist/types/zoom.types.d.ts +45 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/styles.d.ts +10 -0
- package/package.json +63 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { CHART_METHODS_KEY, CHART_STATE_KEY, CHART_HOVER_KEY, RENDERER_HINT_KEY, CHART_REFRESH_NONCE_KEY, CHART_CORE_INSTANCE_KEY } from './chunk-FZ3PZ66C.mjs';
|
|
2
|
+
import { createChart, defaultLightTheme } from '@primeui/chart-core';
|
|
3
|
+
import { inject, shallowRef, ref, computed, watch, provide } from 'vue';
|
|
4
|
+
|
|
5
|
+
function useChartMethods() {
|
|
6
|
+
const ctx = inject(CHART_METHODS_KEY);
|
|
7
|
+
if (!ctx) {
|
|
8
|
+
throw new Error("useChartMethods must be used within a ChartSvg or ChartCanvas");
|
|
9
|
+
}
|
|
10
|
+
return ctx;
|
|
11
|
+
}
|
|
12
|
+
function useChartState() {
|
|
13
|
+
const stateRef = inject(CHART_STATE_KEY);
|
|
14
|
+
if (!stateRef) {
|
|
15
|
+
throw new Error("useChartState must be used within a ChartSvg or ChartCanvas");
|
|
16
|
+
}
|
|
17
|
+
return stateRef;
|
|
18
|
+
}
|
|
19
|
+
function useChartHover() {
|
|
20
|
+
const hoverRef = inject(CHART_HOVER_KEY);
|
|
21
|
+
if (!hoverRef) {
|
|
22
|
+
throw new Error("useChartHover must be used within a ChartSvg or ChartCanvas");
|
|
23
|
+
}
|
|
24
|
+
return hoverRef;
|
|
25
|
+
}
|
|
26
|
+
function useRendererHint(hint) {
|
|
27
|
+
const hintRef = inject(RENDERER_HINT_KEY);
|
|
28
|
+
if (hintRef) {
|
|
29
|
+
hintRef.value = hint;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function provideChartContext(options) {
|
|
33
|
+
const { chartId, renderer, width, height, devicePixelRatio, dir, fontFamily, fontSize, locale, theme } = options;
|
|
34
|
+
const emitHandlerRef = { current: null };
|
|
35
|
+
const version = shallowRef(0);
|
|
36
|
+
let pendingFlush = false;
|
|
37
|
+
const scheduleFlush = () => {
|
|
38
|
+
if (!pendingFlush) {
|
|
39
|
+
pendingFlush = true;
|
|
40
|
+
queueMicrotask(() => {
|
|
41
|
+
pendingFlush = false;
|
|
42
|
+
version.value++;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const coreChart = createChart({
|
|
47
|
+
emits: {
|
|
48
|
+
// Event emits → routed through emitHandlerRef (written by useChartContext)
|
|
49
|
+
tooltipChange: (...args) => emitHandlerRef.current?.("tooltip-change", ...args),
|
|
50
|
+
hoverChange: (...args) => emitHandlerRef.current?.("hover-change", ...args),
|
|
51
|
+
cursorChange: (...args) => emitHandlerRef.current?.("cursor-change", ...args),
|
|
52
|
+
syncBroadcast: (...args) => emitHandlerRef.current?.("sync-broadcast", ...args),
|
|
53
|
+
rectHoverUpdate: (...args) => emitHandlerRef.current?.("rect-hover-update", ...args),
|
|
54
|
+
clickCallback: (...args) => emitHandlerRef.current?.("click-callback", ...args),
|
|
55
|
+
datasetToggle: (...args) => emitHandlerRef.current?.("dataset-toggle", ...args),
|
|
56
|
+
itemToggle: (...args) => emitHandlerRef.current?.("item-toggle", ...args),
|
|
57
|
+
itemsToggle: (...args) => emitHandlerRef.current?.("items-toggle", ...args),
|
|
58
|
+
drilldown: (...args) => emitHandlerRef.current?.("drilldown", ...args),
|
|
59
|
+
legendCallback: (...args) => emitHandlerRef.current?.("legend-callback", ...args),
|
|
60
|
+
legendHover: (...args) => emitHandlerRef.current?.("legend-hover", ...args),
|
|
61
|
+
// Registration state change → directly triggers Vue re-render flush
|
|
62
|
+
stateChanged: () => scheduleFlush()
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const hoverState = ref({ datasetId: null, index: null });
|
|
66
|
+
const setHover = (datasetId, index, axisIndex, axisX) => {
|
|
67
|
+
const prev = hoverState.value;
|
|
68
|
+
if (prev.datasetId === datasetId && prev.index === index && prev.axisIndex === axisIndex && prev.axisX === axisX) return;
|
|
69
|
+
hoverState.value = { datasetId, index, axisIndex, axisX };
|
|
70
|
+
};
|
|
71
|
+
const methods = {
|
|
72
|
+
registerDataset: (id, type, props) => coreChart.registerDataset(id, type, props),
|
|
73
|
+
unregisterDataset: (id) => coreChart.unregisterDataset(id),
|
|
74
|
+
updateDataset: (id, props) => coreChart.updateDataset(id, props),
|
|
75
|
+
registerXAxis: (id, props) => coreChart.registerXAxis(id, props),
|
|
76
|
+
updateXAxis: (id, props) => coreChart.updateXAxis(id, props),
|
|
77
|
+
unregisterXAxis: (id) => coreChart.unregisterXAxis(id),
|
|
78
|
+
registerYAxis: (id, props) => coreChart.registerYAxis(id, props),
|
|
79
|
+
updateYAxis: (id, props) => coreChart.updateYAxis(id, props),
|
|
80
|
+
unregisterYAxis: (id) => coreChart.unregisterYAxis(id),
|
|
81
|
+
registerCustomization: (type, props) => coreChart.registerCustomization(type, props),
|
|
82
|
+
unregisterCustomization: (type) => coreChart.unregisterCustomization(type),
|
|
83
|
+
registerAnnotation: (render) => coreChart.registerAnnotation(render),
|
|
84
|
+
unregisterAnnotation: (id) => coreChart.unregisterAnnotation(id),
|
|
85
|
+
setHover,
|
|
86
|
+
toggleDatasetVisibility: (datasetId) => coreChart.toggleDatasetVisibility(datasetId),
|
|
87
|
+
setDatasetVisibility: (datasetId, visible) => coreChart.setDatasetVisibility(datasetId, visible),
|
|
88
|
+
toggleItemVisibility: (datasetId, index) => coreChart.toggleItemVisibility(datasetId, index),
|
|
89
|
+
chartId,
|
|
90
|
+
renderer,
|
|
91
|
+
get dimensions() {
|
|
92
|
+
return { width: width.value, height: height.value, devicePixelRatio };
|
|
93
|
+
},
|
|
94
|
+
get font() {
|
|
95
|
+
const t = theme?.value ?? defaultLightTheme;
|
|
96
|
+
return { family: fontFamily ?? t.fontFamily, size: fontSize ?? t.fontSize };
|
|
97
|
+
},
|
|
98
|
+
get locale() {
|
|
99
|
+
return locale?.value;
|
|
100
|
+
},
|
|
101
|
+
get dir() {
|
|
102
|
+
return dir?.value ?? "ltr";
|
|
103
|
+
},
|
|
104
|
+
get theme() {
|
|
105
|
+
return theme?.value ?? defaultLightTheme;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
function mapsEqual(a, b) {
|
|
109
|
+
if (a.size !== b.size) return false;
|
|
110
|
+
for (const [k, v] of a) {
|
|
111
|
+
if (b.get(k) !== v) return false;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
const s0 = coreChart.$state;
|
|
116
|
+
const snap = {
|
|
117
|
+
datasets: new Map(s0.datasets),
|
|
118
|
+
datasetVisibility: new Map(s0.datasetVisibility),
|
|
119
|
+
hiddenItems: new Map(s0.hiddenItems),
|
|
120
|
+
features: new Map(s0.features),
|
|
121
|
+
annotations: new Map(s0.annotations),
|
|
122
|
+
axesX: new Map(s0.axes.x),
|
|
123
|
+
axesY: new Map(s0.axes.y)
|
|
124
|
+
};
|
|
125
|
+
const stateValue = computed(() => {
|
|
126
|
+
void version.value;
|
|
127
|
+
const s = coreChart.$state;
|
|
128
|
+
const datasets = mapsEqual(s.datasets, snap.datasets) ? snap.datasets : snap.datasets = new Map(s.datasets);
|
|
129
|
+
const datasetVisibility = mapsEqual(s.datasetVisibility, snap.datasetVisibility) ? snap.datasetVisibility : snap.datasetVisibility = new Map(s.datasetVisibility);
|
|
130
|
+
const hiddenItems = mapsEqual(s.hiddenItems, snap.hiddenItems) ? snap.hiddenItems : snap.hiddenItems = new Map(s.hiddenItems);
|
|
131
|
+
const features = mapsEqual(s.features, snap.features) ? snap.features : snap.features = new Map(s.features);
|
|
132
|
+
const annotations = mapsEqual(s.annotations, snap.annotations) ? snap.annotations : snap.annotations = new Map(s.annotations);
|
|
133
|
+
const axesX = mapsEqual(s.axes.x, snap.axesX) ? snap.axesX : snap.axesX = new Map(s.axes.x);
|
|
134
|
+
const axesY = mapsEqual(s.axes.y, snap.axesY) ? snap.axesY : snap.axesY = new Map(s.axes.y);
|
|
135
|
+
return { datasets, datasetVisibility, hiddenItems, features, annotations, axes: { x: axesX, y: axesY } };
|
|
136
|
+
});
|
|
137
|
+
const hoverValue = computed(() => ({
|
|
138
|
+
hover: hoverState.value
|
|
139
|
+
}));
|
|
140
|
+
const rendererHint = ref(null);
|
|
141
|
+
watch(
|
|
142
|
+
rendererHint,
|
|
143
|
+
(hint) => {
|
|
144
|
+
coreChart.setRendererHint(hint);
|
|
145
|
+
},
|
|
146
|
+
{ immediate: true }
|
|
147
|
+
);
|
|
148
|
+
const refreshNonce = ref(0);
|
|
149
|
+
const redraw = () => {
|
|
150
|
+
refreshNonce.value++;
|
|
151
|
+
};
|
|
152
|
+
provide(CHART_METHODS_KEY, methods);
|
|
153
|
+
provide(CHART_STATE_KEY, stateValue);
|
|
154
|
+
provide(CHART_HOVER_KEY, hoverValue);
|
|
155
|
+
provide(RENDERER_HINT_KEY, rendererHint);
|
|
156
|
+
provide(CHART_REFRESH_NONCE_KEY, refreshNonce);
|
|
157
|
+
provide(CHART_CORE_INSTANCE_KEY, { coreChart, emitHandlerRef, setHover });
|
|
158
|
+
return {
|
|
159
|
+
coreChart,
|
|
160
|
+
emitHandlerRef,
|
|
161
|
+
methods,
|
|
162
|
+
state: stateValue,
|
|
163
|
+
hover: hoverValue,
|
|
164
|
+
rendererHint,
|
|
165
|
+
redraw
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export { provideChartContext, useChartHover, useChartMethods, useChartState, useRendererHint };
|