vccs 0.1.0 → 0.3.0
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/README.md +151 -0
- package/dist/animation/Animate.d.ts +1 -1
- package/dist/cartesian/area/type.d.ts +3 -3
- package/dist/cartesian/bar/type.d.ts +1 -13
- package/dist/cartesian/brush/components/Slide.d.ts +1 -1
- package/dist/cartesian/brush/components/TravellerLayer.d.ts +1 -1
- package/dist/cartesian/brush/type.d.ts +2 -1
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +2 -1
- package/dist/cartesian/funnel/Funnel.d.ts +2 -0
- package/dist/cartesian/funnel/index.d.ts +2 -0
- package/dist/cartesian/funnel/type.d.ts +74 -6
- package/dist/cartesian/index.d.ts +2 -0
- package/dist/cartesian/line/Line.d.ts +7 -13
- package/dist/cartesian/line/type.d.ts +4 -17
- package/dist/cartesian/reference-area/ReferenceArea.d.ts +16 -16
- package/dist/cartesian/reference-dot/ReferenceDot.d.ts +143 -0
- package/dist/cartesian/reference-dot/index.d.ts +2 -0
- package/dist/cartesian/reference-line/ReferenceLine.d.ts +8 -8
- package/dist/cartesian/scatter/Scatter.d.ts +1 -1
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/RechartsWrapper.d.ts +7 -3
- package/dist/chart/Surface.d.ts +2 -1
- package/dist/chart/Treemap.d.ts +237 -0
- package/dist/chart/generateCategoricalChart.d.ts +2 -1
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/treemapUtils.d.ts +22 -0
- package/dist/components/Customized.d.ts +23 -0
- package/dist/components/Text.d.ts +4 -4
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/label/Label.d.ts +3 -3
- package/dist/components/label/types.d.ts +1 -1
- package/dist/container/Surface.d.ts +3 -2
- package/dist/es/animation/Animate.mjs +48 -22
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
- package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
- package/dist/es/cartesian/area/Area.mjs +42 -31
- package/dist/es/cartesian/area/ClipRect.mjs +79 -58
- package/dist/es/cartesian/area/RenderArea.mjs +142 -108
- package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
- package/dist/es/cartesian/area/type.mjs +13 -15
- package/dist/es/cartesian/area/utils.mjs +69 -49
- package/dist/es/cartesian/axis/XAxis.mjs +87 -73
- package/dist/es/cartesian/axis/YAxis.mjs +67 -56
- package/dist/es/cartesian/bar/Bar.mjs +78 -71
- package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
- package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
- package/dist/es/cartesian/bar/type.mjs +11 -25
- package/dist/es/cartesian/bar/utils.mjs +97 -70
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
- package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
- package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
- package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
- package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
- package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
- package/dist/es/cartesian/funnel/Funnel.mjs +162 -0
- package/dist/es/cartesian/funnel/type.mjs +78 -0
- package/dist/es/cartesian/funnel/utils.mjs +102 -0
- package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
- package/dist/es/cartesian/line/Line.mjs +41 -37
- package/dist/es/cartesian/line/StaticLine.mjs +191 -122
- package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
- package/dist/es/cartesian/line/type.mjs +13 -18
- package/dist/es/cartesian/line/utils.mjs +27 -26
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +79 -78
- package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +134 -0
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +93 -84
- package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
- package/dist/es/cartesian/useNeedsClip.mjs +18 -9
- package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
- package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
- package/dist/es/chart/AreaChart.mjs +5 -5
- package/dist/es/chart/BarChart.mjs +5 -5
- package/dist/es/chart/ComposedChart.mjs +5 -5
- package/dist/es/chart/FunnelChart.mjs +11 -0
- package/dist/es/chart/LegendPortalContext.mjs +3 -3
- package/dist/es/chart/LineChart.mjs +5 -5
- package/dist/es/chart/PieChart.mjs +5 -5
- package/dist/es/chart/RadarChart.mjs +5 -5
- package/dist/es/chart/RadialBarChart.mjs +5 -5
- package/dist/es/chart/RechartsWrapper.mjs +113 -89
- package/dist/es/chart/ScatterChart.mjs +5 -5
- package/dist/es/chart/Surface.mjs +3 -3
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
- package/dist/es/chart/TooltipPortalContext.mjs +3 -3
- package/dist/es/chart/Treemap.mjs +379 -0
- package/dist/es/chart/const.mjs +2 -2
- package/dist/es/chart/generateCategoricalChart.mjs +99 -89
- package/dist/es/chart/provideClipPathId.mjs +12 -7
- package/dist/es/chart/treemapUtils.mjs +32 -0
- package/dist/es/components/Cell.mjs +16 -4
- package/dist/es/components/Customized.mjs +43 -0
- package/dist/es/components/Text.mjs +3 -3
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
- package/dist/es/components/Tooltip.mjs +274 -199
- package/dist/es/components/label/Label.mjs +30 -26
- package/dist/es/components/label/LabelList.mjs +45 -39
- package/dist/es/components/label/types.mjs +10 -6
- package/dist/es/components/label/utils.mjs +194 -162
- package/dist/es/components/legend/Legend.mjs +82 -71
- package/dist/es/components/legend/LegendSymbol.mjs +40 -38
- package/dist/es/components/legend/hooks/useLegend.mjs +71 -46
- package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
- package/dist/es/components/legend/type.mjs +2 -2
- package/dist/es/components/legend/utils.mjs +19 -11
- package/dist/es/components/utils.mjs +35 -22
- package/dist/es/container/ClipPath.mjs +14 -14
- package/dist/es/container/Layer.mjs +9 -7
- package/dist/es/container/ResponsiveContainer.mjs +3 -3
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
- package/dist/es/container/Surface.mjs +25 -23
- package/dist/es/container/useSizeContext.mjs +3 -3
- package/dist/es/context/ChartDataContextProvider.mjs +19 -13
- package/dist/es/context/PanoramaContextProvider.mjs +15 -10
- package/dist/es/context/accessibilityContext.mjs +3 -3
- package/dist/es/context/cartesianLabelListContext.mjs +3 -3
- package/dist/es/context/chartLayoutContext.mjs +33 -30
- package/dist/es/context/cursorLayerContext.mjs +3 -3
- package/dist/es/context/graphicalLayerContext.mjs +3 -3
- package/dist/es/context/labelLayerContext.mjs +3 -3
- package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
- package/dist/es/context/useTooltipAxis.mjs +14 -12
- package/dist/es/events/useChartSynchronisation.mjs +91 -66
- package/dist/es/hooks/publicHooks.mjs +207 -0
- package/dist/es/hooks/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
- package/dist/es/index.mjs +54 -42
- package/dist/es/polar/pie/Pie.mjs +131 -115
- package/dist/es/polar/pie/type.mjs +8 -10
- package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
- package/dist/es/polar/radar/PolarGrid.mjs +72 -59
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
- package/dist/es/polar/radar/Radar.mjs +181 -145
- package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
- package/dist/es/polar/radial-bar/type.mjs +9 -9
- package/dist/es/shape/Cross.mjs +11 -10
- package/dist/es/shape/Curve.mjs +71 -44
- package/dist/es/shape/Dot.mjs +12 -11
- package/dist/es/shape/Polygon.mjs +19 -0
- package/dist/es/shape/Rectangle.mjs +41 -30
- package/dist/es/shape/Sector.mjs +105 -79
- package/dist/es/shape/Symbols.mjs +45 -34
- package/dist/es/shape/Trapezoid.mjs +50 -0
- package/dist/es/state/ReportChartProps.mjs +23 -24
- package/dist/es/state/ReportMainChartProps.mjs +26 -21
- package/dist/es/state/ReportPolarOptions.mjs +23 -22
- package/dist/es/state/SetGraphicalItem.mjs +42 -27
- package/dist/es/state/SetLegendPayload.mjs +17 -13
- package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
- package/dist/es/state/brushSlice.mjs +12 -8
- package/dist/es/state/cartesianAxisSlice.mjs +23 -17
- package/dist/es/state/chartDataSlice.mjs +18 -13
- package/dist/es/state/externalEventsMiddleware.mjs +25 -15
- package/dist/es/state/graphicalItemsSlice.mjs +29 -25
- package/dist/es/state/hooks.mjs +24 -3
- package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
- package/dist/es/state/layoutSlice.mjs +18 -12
- package/dist/es/state/legendSlice.mjs +19 -14
- package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
- package/dist/es/state/optionsSlice.mjs +14 -11
- package/dist/es/state/polarAxisSlice.mjs +15 -13
- package/dist/es/state/polarOptionsSlice.mjs +8 -6
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
- package/dist/es/state/referenceElementsSlice.mjs +21 -19
- package/dist/es/state/rootPropsSlice.mjs +20 -9
- package/dist/es/state/selectors/areaSelectors.mjs +65 -55
- package/dist/es/state/selectors/axisSelectors.mjs +784 -569
- package/dist/es/state/selectors/barSelectors.mjs +225 -162
- package/dist/es/state/selectors/brushSelectors.mjs +15 -14
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
- package/dist/es/state/selectors/common.mjs +2 -2
- package/dist/es/state/selectors/containerSelectors.mjs +5 -2
- package/dist/es/state/selectors/dataSelectors.mjs +28 -9
- package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
- package/dist/es/state/selectors/legendSelectors.mjs +7 -6
- package/dist/es/state/selectors/lineSelectors.mjs +54 -47
- package/dist/es/state/selectors/pickAxisId.mjs +2 -2
- package/dist/es/state/selectors/pickAxisType.mjs +2 -2
- package/dist/es/state/selectors/pieSelectors.mjs +116 -81
- package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
- package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
- package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
- package/dist/es/state/selectors/polarSelectors.mjs +79 -62
- package/dist/es/state/selectors/radarSelectors.mjs +111 -91
- package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
- package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
- package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
- package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
- package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
- package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
- package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
- package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
- package/dist/es/state/selectors/selectors.mjs +94 -75
- package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
- package/dist/es/state/selectors/touchSelectors.mjs +17 -14
- package/dist/es/state/store.mjs +46 -46
- package/dist/es/state/tooltipSlice.mjs +64 -37
- package/dist/es/state/touchEventsMiddleware.mjs +35 -29
- package/dist/es/state/utils/useReportScale.mjs +16 -13
- package/dist/es/synchronisation/syncSelectors.mjs +3 -3
- package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
- package/dist/es/types/common.mjs +12 -0
- package/dist/es/types/event.mjs +164 -2
- package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
- package/dist/es/utils/VueUtils.mjs +35 -14
- package/dist/es/utils/attrs.mjs +43 -26
- package/dist/es/utils/cartesian.mjs +47 -15
- package/dist/es/utils/cell.mjs +28 -0
- package/dist/es/utils/chart.mjs +298 -197
- package/dist/es/utils/const.mjs +30 -2
- package/dist/es/utils/createCategoricalInverse.mjs +46 -0
- package/dist/es/utils/createContext.mjs +28 -9
- package/dist/es/utils/data-utils.mjs +9 -8
- package/dist/es/utils/data.mjs +35 -21
- package/dist/es/utils/events.mjs +5 -3
- package/dist/es/utils/getLinearRegression.mjs +28 -11
- package/dist/es/utils/grid.mjs +20 -5
- package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
- package/dist/es/utils/legend.mjs +13 -12
- package/dist/es/utils/log.mjs +10 -7
- package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
- package/dist/es/utils/polar.mjs +37 -30
- package/dist/es/utils/props.mjs +16 -10
- package/dist/es/utils/resolveDefaultProps.mjs +23 -4
- package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
- package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
- package/dist/es/utils/scale/utils/utils.mjs +43 -24
- package/dist/es/utils/scale.mjs +46 -0
- package/dist/es/utils/style.mjs +24 -13
- package/dist/es/utils/tick.mjs +34 -23
- package/dist/es/utils/tooltip/translate.mjs +63 -49
- package/dist/es/utils/validate.mjs +40 -29
- package/dist/hooks/publicHooks.d.ts +143 -0
- package/dist/hooks/useIsAnimating.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/polar/pie/type.d.ts +2 -2
- package/dist/polar/radar/Radar.d.ts +4 -4
- package/dist/shape/Curve.d.ts +2 -1
- package/dist/shape/Polygon.d.ts +9 -0
- package/dist/shape/Rectangle.d.ts +0 -4
- package/dist/shape/Sector.d.ts +2 -2
- package/dist/shape/Symbols.d.ts +2 -1
- package/dist/shape/Trapezoid.d.ts +30 -0
- package/dist/shape/index.d.ts +2 -0
- package/dist/shape/types.d.ts +4 -5
- package/dist/state/ReportChartProps.d.ts +3 -3
- package/dist/state/graphicalItemsSlice.d.ts +1 -1
- package/dist/state/rootPropsSlice.d.ts +2 -2
- package/dist/state/selectors/axisSelectors.d.ts +5 -0
- package/dist/types/axis.d.ts +2 -2
- package/dist/types/bar.d.ts +2 -6
- package/dist/types/categorical.d.ts +2 -2
- package/dist/types/common.d.ts +7 -1
- package/dist/types/tooltip.d.ts +2 -2
- package/dist/utils/cell.d.ts +11 -0
- package/dist/utils/createCategoricalInverse.d.ts +16 -0
- package/dist/utils/scale.d.ts +23 -0
- package/package.json +2 -1
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { addTooltipEntrySettings, mouseLeaveItem, removeTooltipEntrySettings, setActiveClickItemIndex, setActiveMouseOverItemIndex } from "../state/tooltipSlice.mjs";
|
|
2
|
+
import { useAppDispatch } from "../state/hooks.mjs";
|
|
3
|
+
import { Layer } from "../container/Layer.mjs";
|
|
4
|
+
import { getStringSize } from "../utils/attrs.mjs";
|
|
5
|
+
import { Animate } from "../animation/Animate.mjs";
|
|
6
|
+
import { createRechartsStore } from "../state/store.mjs";
|
|
7
|
+
import { RechartsWrapper } from "./RechartsWrapper.mjs";
|
|
8
|
+
import Surface from "../container/Surface.mjs";
|
|
9
|
+
import { computeTreemapLayout } from "./treemapUtils.mjs";
|
|
10
|
+
import { Fragment, computed, createTextVNode, createVNode, defineComponent, ref, watchEffect } from "vue";
|
|
11
|
+
import { provideStore } from "@reduxjs/vue-redux";
|
|
12
|
+
import { get } from "lodash-es";
|
|
13
|
+
//#region src/chart/Treemap.tsx
|
|
14
|
+
var DEFAULT_COLORS = [
|
|
15
|
+
"#8889DD",
|
|
16
|
+
"#9597E4",
|
|
17
|
+
"#8DC77B",
|
|
18
|
+
"#A5D297",
|
|
19
|
+
"#E2CF45",
|
|
20
|
+
"#F8C12D",
|
|
21
|
+
"#F89C24",
|
|
22
|
+
"#F56E1A"
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Recursively sum all descendant values for a given dataKey.
|
|
26
|
+
*/
|
|
27
|
+
function sumValues(item, dataKey) {
|
|
28
|
+
if (item.children && item.children.length > 0) return item.children.reduce((sum, child) => sum + sumValues(child, dataKey), 0);
|
|
29
|
+
const val = item[dataKey];
|
|
30
|
+
return typeof val === "number" && val > 0 ? val : 0;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Tooltip payload searcher for Treemap — navigates nested node structure
|
|
34
|
+
* using a path string like 'children[0].children[1]'.
|
|
35
|
+
*/
|
|
36
|
+
var treemapPayloadSearcher = (data, activeIndex) => {
|
|
37
|
+
if (!data || !activeIndex) return void 0;
|
|
38
|
+
return get(data, activeIndex);
|
|
39
|
+
};
|
|
40
|
+
var treemapOptions = {
|
|
41
|
+
chartName: "Treemap",
|
|
42
|
+
defaultTooltipEventType: "item",
|
|
43
|
+
validateTooltipEventTypes: ["item"],
|
|
44
|
+
tooltipPayloadSearcher: treemapPayloadSearcher,
|
|
45
|
+
eventEmitter: void 0
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Build a hierarchical node structure with tooltipIndex paths for tooltip lookup.
|
|
49
|
+
*/
|
|
50
|
+
function buildNodeTree(data, dataKey, nameKey, parentIndex = "") {
|
|
51
|
+
return {
|
|
52
|
+
children: data.map((item, i) => {
|
|
53
|
+
const tooltipIndex = `${parentIndex}children[${i}]`;
|
|
54
|
+
if (item.children && item.children.length > 0) {
|
|
55
|
+
const childTree = buildNodeTree(item.children, dataKey, nameKey, `${tooltipIndex}.`);
|
|
56
|
+
return {
|
|
57
|
+
...item,
|
|
58
|
+
tooltipIndex,
|
|
59
|
+
...childTree
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...item,
|
|
64
|
+
tooltipIndex,
|
|
65
|
+
value: sumValues(item, dataKey)
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
name: "root",
|
|
69
|
+
tooltipIndex: parentIndex
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
var TreemapVueProps = {
|
|
73
|
+
data: {
|
|
74
|
+
type: Array,
|
|
75
|
+
required: true
|
|
76
|
+
},
|
|
77
|
+
dataKey: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "value"
|
|
80
|
+
},
|
|
81
|
+
nameKey: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "name"
|
|
84
|
+
},
|
|
85
|
+
width: {
|
|
86
|
+
type: Number,
|
|
87
|
+
required: true
|
|
88
|
+
},
|
|
89
|
+
height: {
|
|
90
|
+
type: Number,
|
|
91
|
+
required: true
|
|
92
|
+
},
|
|
93
|
+
aspectRatio: {
|
|
94
|
+
type: Number,
|
|
95
|
+
default: 4 / 3
|
|
96
|
+
},
|
|
97
|
+
fill: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: "#808080"
|
|
100
|
+
},
|
|
101
|
+
stroke: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: "#fff"
|
|
104
|
+
},
|
|
105
|
+
type: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: "flat"
|
|
108
|
+
},
|
|
109
|
+
colorPanel: {
|
|
110
|
+
type: Array,
|
|
111
|
+
default: void 0
|
|
112
|
+
},
|
|
113
|
+
isAnimationActive: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: true
|
|
116
|
+
},
|
|
117
|
+
transition: {
|
|
118
|
+
type: Object,
|
|
119
|
+
default: () => ({
|
|
120
|
+
duration: .8,
|
|
121
|
+
ease: "easeOut"
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
onClick: {
|
|
125
|
+
type: Function,
|
|
126
|
+
default: void 0
|
|
127
|
+
},
|
|
128
|
+
onMouseEnter: {
|
|
129
|
+
type: Function,
|
|
130
|
+
default: void 0
|
|
131
|
+
},
|
|
132
|
+
onMouseLeave: {
|
|
133
|
+
type: Function,
|
|
134
|
+
default: void 0
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Inner component that has access to the Redux store (provided by Treemap wrapper).
|
|
139
|
+
*/
|
|
140
|
+
var TreemapInner = /* @__PURE__ */ defineComponent({
|
|
141
|
+
name: "TreemapInner",
|
|
142
|
+
props: TreemapVueProps,
|
|
143
|
+
slots: Object,
|
|
144
|
+
setup(props, { slots }) {
|
|
145
|
+
const dispatch = useAppDispatch();
|
|
146
|
+
const colors = computed(() => props.colorPanel ?? DEFAULT_COLORS);
|
|
147
|
+
const breadcrumbTrail = ref([]);
|
|
148
|
+
const currentData = ref(null);
|
|
149
|
+
const animationKey = ref(0);
|
|
150
|
+
const isNestMode = computed(() => props.type === "nest");
|
|
151
|
+
const nestCurrentData = computed(() => {
|
|
152
|
+
if (!isNestMode.value) return null;
|
|
153
|
+
return currentData.value ?? props.data;
|
|
154
|
+
});
|
|
155
|
+
function computeNestLevelData(data) {
|
|
156
|
+
return data.map((item) => {
|
|
157
|
+
const aggregatedValue = sumValues(item, props.dataKey);
|
|
158
|
+
const { children: _, ...rest } = item;
|
|
159
|
+
return {
|
|
160
|
+
...rest,
|
|
161
|
+
[props.dataKey]: aggregatedValue
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const nodes = computed(() => {
|
|
166
|
+
return computeTreemapLayout({
|
|
167
|
+
data: isNestMode.value ? computeNestLevelData(nestCurrentData.value ?? props.data) : props.data,
|
|
168
|
+
width: props.width,
|
|
169
|
+
height: props.height,
|
|
170
|
+
dataKey: props.dataKey,
|
|
171
|
+
nameKey: props.nameKey,
|
|
172
|
+
aspectRatio: props.aspectRatio,
|
|
173
|
+
colorPanel: colors.value
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
const nodeTree = computed(() => {
|
|
177
|
+
return buildNodeTree(isNestMode.value ? nestCurrentData.value ?? props.data : props.data, props.dataKey, props.nameKey);
|
|
178
|
+
});
|
|
179
|
+
watchEffect((onCleanup) => {
|
|
180
|
+
const tooltipEntrySettings = {
|
|
181
|
+
dataDefinedOnItem: nodeTree.value,
|
|
182
|
+
positions: void 0,
|
|
183
|
+
settings: {
|
|
184
|
+
stroke: props.stroke,
|
|
185
|
+
strokeWidth: void 0,
|
|
186
|
+
fill: props.fill,
|
|
187
|
+
dataKey: props.dataKey,
|
|
188
|
+
nameKey: props.nameKey,
|
|
189
|
+
name: void 0,
|
|
190
|
+
hide: false,
|
|
191
|
+
type: void 0,
|
|
192
|
+
color: props.fill,
|
|
193
|
+
unit: ""
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
dispatch(addTooltipEntrySettings(tooltipEntrySettings));
|
|
197
|
+
onCleanup(() => {
|
|
198
|
+
dispatch(removeTooltipEntrySettings(tooltipEntrySettings));
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
function getTooltipIndex(node) {
|
|
202
|
+
const data = isNestMode.value ? nestCurrentData.value ?? props.data : props.data;
|
|
203
|
+
const idx = data.findIndex((item) => item[props.nameKey] === node.name);
|
|
204
|
+
if (idx >= 0) return `children[${idx}]`;
|
|
205
|
+
for (let i = 0; i < data.length; i++) if (data[i].children) {
|
|
206
|
+
const childIdx = data[i].children.findIndex((c) => c[props.nameKey] === node.name);
|
|
207
|
+
if (childIdx >= 0) return `children[${i}].children[${childIdx}]`;
|
|
208
|
+
}
|
|
209
|
+
return `children[0]`;
|
|
210
|
+
}
|
|
211
|
+
function handleNestClick(node, e) {
|
|
212
|
+
const sourceData = nestCurrentData.value ?? props.data;
|
|
213
|
+
const clickedItem = sourceData.find((item) => item[props.nameKey] === node.name);
|
|
214
|
+
if (clickedItem?.children && clickedItem.children.length > 0) {
|
|
215
|
+
breadcrumbTrail.value = [...breadcrumbTrail.value, {
|
|
216
|
+
name: clickedItem[props.nameKey] ?? clickedItem.name,
|
|
217
|
+
data: sourceData
|
|
218
|
+
}];
|
|
219
|
+
currentData.value = clickedItem.children;
|
|
220
|
+
animationKey.value++;
|
|
221
|
+
}
|
|
222
|
+
props.onClick?.(node, e);
|
|
223
|
+
}
|
|
224
|
+
function navigateToBreadcrumb(index) {
|
|
225
|
+
if (index < 0) {
|
|
226
|
+
currentData.value = null;
|
|
227
|
+
breadcrumbTrail.value = [];
|
|
228
|
+
} else {
|
|
229
|
+
currentData.value = breadcrumbTrail.value[index].data;
|
|
230
|
+
breadcrumbTrail.value = breadcrumbTrail.value.slice(0, index);
|
|
231
|
+
}
|
|
232
|
+
animationKey.value++;
|
|
233
|
+
}
|
|
234
|
+
function getNodeFill(node) {
|
|
235
|
+
return node.color ?? props.fill;
|
|
236
|
+
}
|
|
237
|
+
function handleNodeMouseEnter(node, e) {
|
|
238
|
+
const tooltipIndex = getTooltipIndex(node);
|
|
239
|
+
const activeCoordinate = {
|
|
240
|
+
x: node.x + node.width / 2,
|
|
241
|
+
y: node.y + node.height / 2
|
|
242
|
+
};
|
|
243
|
+
dispatch(setActiveMouseOverItemIndex({
|
|
244
|
+
activeIndex: tooltipIndex,
|
|
245
|
+
activeDataKey: props.dataKey,
|
|
246
|
+
activeCoordinate
|
|
247
|
+
}));
|
|
248
|
+
props.onMouseEnter?.(node, e);
|
|
249
|
+
}
|
|
250
|
+
function handleNodeMouseLeave(node, e) {
|
|
251
|
+
dispatch(mouseLeaveItem());
|
|
252
|
+
props.onMouseLeave?.(node, e);
|
|
253
|
+
}
|
|
254
|
+
function handleNodeClick(node, e) {
|
|
255
|
+
if (isNestMode.value) handleNestClick(node, e);
|
|
256
|
+
else {
|
|
257
|
+
const tooltipIndex = getTooltipIndex(node);
|
|
258
|
+
const activeCoordinate = {
|
|
259
|
+
x: node.x + node.width / 2,
|
|
260
|
+
y: node.y + node.height / 2
|
|
261
|
+
};
|
|
262
|
+
dispatch(setActiveClickItemIndex({
|
|
263
|
+
activeIndex: tooltipIndex,
|
|
264
|
+
activeDataKey: props.dataKey,
|
|
265
|
+
activeCoordinate
|
|
266
|
+
}));
|
|
267
|
+
props.onClick?.(node, e);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function renderNodeAtProgress(node, index, progress) {
|
|
271
|
+
const nodeFill = getNodeFill(node);
|
|
272
|
+
const translateX = (-node.x - node.width) * (1 - progress);
|
|
273
|
+
const transform = progress < 1 ? `translate(${translateX}, 0)` : void 0;
|
|
274
|
+
const nodeProps = {
|
|
275
|
+
...node,
|
|
276
|
+
index,
|
|
277
|
+
fill: nodeFill,
|
|
278
|
+
stroke: props.stroke
|
|
279
|
+
};
|
|
280
|
+
if (slots.content) return createVNode("g", {
|
|
281
|
+
"key": `node-${index}`,
|
|
282
|
+
"class": "v-charts-treemap-node",
|
|
283
|
+
"style": { transformOrigin: `${node.x}px ${node.y}px` },
|
|
284
|
+
"transform": transform,
|
|
285
|
+
"onClick": (e) => handleNodeClick(node, e),
|
|
286
|
+
"onMouseenter": (e) => handleNodeMouseEnter(node, e),
|
|
287
|
+
"onMouseleave": (e) => handleNodeMouseLeave(node, e)
|
|
288
|
+
}, [slots.content(nodeProps)]);
|
|
289
|
+
const arrow = isNestMode.value && (() => {
|
|
290
|
+
const item = (nestCurrentData.value ?? props.data).find((d) => d[props.nameKey] === node.name);
|
|
291
|
+
return item?.children && item.children.length > 0;
|
|
292
|
+
})() && node.width > 10 && node.height > 10 ? createVNode("polygon", {
|
|
293
|
+
"points": `${node.x + 2},${node.y + node.height / 2} ${node.x + 6},${node.y + node.height / 2 + 3} ${node.x + 2},${node.y + node.height / 2 + 6}`,
|
|
294
|
+
"fill": "#fff"
|
|
295
|
+
}, null) : null;
|
|
296
|
+
const nameSize = node.width > 20 && node.height > 20 ? getStringSize(node.name, { fontSize: "14px" }) : {
|
|
297
|
+
width: Infinity,
|
|
298
|
+
height: Infinity
|
|
299
|
+
};
|
|
300
|
+
const text = node.width > 20 && node.height > 20 && nameSize.width < node.width && nameSize.height < node.height ? createVNode("text", {
|
|
301
|
+
"x": node.x + 8,
|
|
302
|
+
"y": node.y + node.height / 2 + 7,
|
|
303
|
+
"fill": "#fff",
|
|
304
|
+
"font-size": 14
|
|
305
|
+
}, [node.name]) : null;
|
|
306
|
+
return createVNode("g", {
|
|
307
|
+
"key": `node-${index}`,
|
|
308
|
+
"class": "v-charts-treemap-node",
|
|
309
|
+
"style": { transformOrigin: `${node.x}px ${node.y}px` },
|
|
310
|
+
"transform": transform,
|
|
311
|
+
"onClick": (e) => handleNodeClick(node, e),
|
|
312
|
+
"onMouseenter": (e) => handleNodeMouseEnter(node, e),
|
|
313
|
+
"onMouseleave": (e) => handleNodeMouseLeave(node, e)
|
|
314
|
+
}, [
|
|
315
|
+
createVNode("rect", {
|
|
316
|
+
"x": node.x,
|
|
317
|
+
"y": node.y,
|
|
318
|
+
"width": node.width,
|
|
319
|
+
"height": node.height,
|
|
320
|
+
"fill": nodeFill,
|
|
321
|
+
"stroke": props.stroke
|
|
322
|
+
}, null),
|
|
323
|
+
arrow,
|
|
324
|
+
text
|
|
325
|
+
]);
|
|
326
|
+
}
|
|
327
|
+
function renderBreadcrumb() {
|
|
328
|
+
if (!isNestMode.value || breadcrumbTrail.value.length === 0) return null;
|
|
329
|
+
return createVNode("div", { "class": "v-charts-treemap-breadcrumb" }, [createVNode("span", {
|
|
330
|
+
"class": "v-charts-treemap-breadcrumb-item",
|
|
331
|
+
"style": { cursor: "pointer" },
|
|
332
|
+
"onClick": () => navigateToBreadcrumb(-1)
|
|
333
|
+
}, [createTextVNode("Root")]), breadcrumbTrail.value.map((entry, i) => createVNode("span", { "key": i }, [createVNode("span", { "style": { margin: "0 4px" } }, [createTextVNode("/")]), createVNode("span", {
|
|
334
|
+
"class": "v-charts-treemap-breadcrumb-item",
|
|
335
|
+
"style": { cursor: "pointer" },
|
|
336
|
+
"onClick": () => navigateToBreadcrumb(i)
|
|
337
|
+
}, [entry.name])]))]);
|
|
338
|
+
}
|
|
339
|
+
return () => createVNode(Fragment, null, [renderBreadcrumb(), createVNode(Surface, {
|
|
340
|
+
"width": props.width,
|
|
341
|
+
"height": props.height
|
|
342
|
+
}, { default: () => [createVNode(Layer, { "class": "v-charts-treemap" }, { default: () => [createVNode(Animate, {
|
|
343
|
+
"key": animationKey.value,
|
|
344
|
+
"isActive": props.isAnimationActive,
|
|
345
|
+
"from": 0,
|
|
346
|
+
"to": 1,
|
|
347
|
+
"transition": props.transition
|
|
348
|
+
}, { default: (progress) => nodes.value.map((node, index) => renderNodeAtProgress(node, index, progress)) })] })] })]);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
/**
|
|
352
|
+
* Treemap chart — hierarchical data visualization using nested rectangles.
|
|
353
|
+
*
|
|
354
|
+
* Supports `<Tooltip>` as a child component (same pattern as BarChart, LineChart, etc.).
|
|
355
|
+
*
|
|
356
|
+
* Usage:
|
|
357
|
+
* ```vue
|
|
358
|
+
* <Treemap :data="data" data-key="value" :width="600" :height="400">
|
|
359
|
+
* <Tooltip />
|
|
360
|
+
* </Treemap>
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
var Treemap = /* @__PURE__ */ defineComponent({
|
|
364
|
+
name: "Treemap",
|
|
365
|
+
props: TreemapVueProps,
|
|
366
|
+
slots: Object,
|
|
367
|
+
setup(props, { slots }) {
|
|
368
|
+
provideStore({ store: createRechartsStore({ options: treemapOptions }, "Treemap") });
|
|
369
|
+
return () => {
|
|
370
|
+
if (!props.data || props.data.length === 0) return null;
|
|
371
|
+
return createVNode(RechartsWrapper, {
|
|
372
|
+
"width": props.width,
|
|
373
|
+
"height": props.height
|
|
374
|
+
}, { default: () => [createVNode(TreemapInner, props, { content: slots.content }), slots.default?.()] });
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
//#endregion
|
|
379
|
+
export { Treemap, TreemapVueProps, treemapPayloadSearcher };
|
package/dist/es/chart/const.mjs
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { classProp } from "../types/common.mjs";
|
|
2
|
+
import { validateWidthHeight } from "../utils/validate.mjs";
|
|
3
|
+
import { provideClipPathId } from "./provideClipPathId.mjs";
|
|
4
|
+
import { createRechartsStore } from "../state/store.mjs";
|
|
5
|
+
import Surface_default from "./Surface.mjs";
|
|
6
|
+
import { ChartDataContextProvider } from "../context/ChartDataContextProvider.mjs";
|
|
7
|
+
import ClipPath_default from "../container/ClipPath.mjs";
|
|
8
|
+
import { RechartsWrapper } from "./RechartsWrapper.mjs";
|
|
9
|
+
import { FULL_WIDTH_AND_HEIGHT } from "./const.mjs";
|
|
10
|
+
import { ReportMainChartProps } from "../state/ReportMainChartProps.mjs";
|
|
11
|
+
import ReportChartProps_default from "../state/ReportChartProps.mjs";
|
|
12
|
+
import { applyDefaultProps } from "../utils/props.mjs";
|
|
13
|
+
import { ReportPolarOptions } from "../state/ReportPolarOptions.mjs";
|
|
14
|
+
import { Fragment, createVNode, defineComponent, mergeProps } from "vue";
|
|
15
|
+
import { provideStore } from "@reduxjs/vue-redux";
|
|
15
16
|
//#region src/chart/generateCategoricalChart.tsx
|
|
16
|
-
var
|
|
17
|
+
var defaultLayout = "horizontal";
|
|
18
|
+
var defaultMargin = {
|
|
17
19
|
top: 5,
|
|
18
20
|
right: 5,
|
|
19
21
|
bottom: 5,
|
|
20
22
|
left: 5
|
|
21
|
-
}
|
|
23
|
+
};
|
|
24
|
+
var CategoricalProps = {
|
|
22
25
|
accessibilityLayer: {
|
|
23
26
|
type: Boolean,
|
|
24
|
-
default:
|
|
27
|
+
default: true
|
|
25
28
|
},
|
|
26
29
|
barCategoryGap: {
|
|
27
30
|
type: [Number, String],
|
|
@@ -32,7 +35,7 @@ var _ = "horizontal", v = {
|
|
|
32
35
|
default: 4
|
|
33
36
|
},
|
|
34
37
|
barSize: { type: [Number, String] },
|
|
35
|
-
class:
|
|
38
|
+
class: classProp,
|
|
36
39
|
compact: { type: Boolean },
|
|
37
40
|
cx: { type: [Number, String] },
|
|
38
41
|
cy: { type: [Number, String] },
|
|
@@ -52,17 +55,17 @@ var _ = "horizontal", v = {
|
|
|
52
55
|
innerRadius: { type: [Number, String] },
|
|
53
56
|
layout: {
|
|
54
57
|
type: String,
|
|
55
|
-
default:
|
|
58
|
+
default: defaultLayout
|
|
56
59
|
},
|
|
57
60
|
margin: {
|
|
58
61
|
type: Object,
|
|
59
|
-
default: () =>
|
|
62
|
+
default: () => defaultMargin
|
|
60
63
|
},
|
|
61
64
|
maxBarSize: { type: Number },
|
|
62
65
|
outerRadius: { type: [Number, String] },
|
|
63
66
|
reverseStackOrder: {
|
|
64
67
|
type: Boolean,
|
|
65
|
-
default:
|
|
68
|
+
default: false
|
|
66
69
|
},
|
|
67
70
|
role: { type: String },
|
|
68
71
|
stackOffset: {
|
|
@@ -82,85 +85,92 @@ var _ = "horizontal", v = {
|
|
|
82
85
|
width: { type: Number },
|
|
83
86
|
to: { type: [String, Object] }
|
|
84
87
|
};
|
|
85
|
-
function
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
name:
|
|
88
|
-
props:
|
|
89
|
-
setup(
|
|
90
|
-
|
|
91
|
-
chartName
|
|
92
|
-
defaultTooltipEventType
|
|
93
|
-
validateTooltipEventTypes
|
|
94
|
-
tooltipPayloadSearcher
|
|
88
|
+
function generateCategoricalChart({ chartName, defaultProps = {}, defaultTooltipEventType = "axis", validateTooltipEventTypes = ["axis"], tooltipPayloadSearcher }) {
|
|
89
|
+
return /* @__PURE__ */ defineComponent({
|
|
90
|
+
name: chartName,
|
|
91
|
+
props: applyDefaultProps(CategoricalProps, defaultProps),
|
|
92
|
+
setup(props, { attrs, slots }) {
|
|
93
|
+
provideStore({ store: createRechartsStore({ options: {
|
|
94
|
+
chartName,
|
|
95
|
+
defaultTooltipEventType,
|
|
96
|
+
validateTooltipEventTypes,
|
|
97
|
+
tooltipPayloadSearcher,
|
|
95
98
|
eventEmitter: void 0
|
|
96
|
-
} },
|
|
97
|
-
|
|
99
|
+
} }, props.id ?? chartName) });
|
|
100
|
+
const clipPathId = provideClipPathId(props);
|
|
98
101
|
return () => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
const { compact, width, height, title, desc, ...rest } = props;
|
|
103
|
+
const attributes = { ...attrs };
|
|
104
|
+
if (!validateWidthHeight({
|
|
105
|
+
width,
|
|
106
|
+
height
|
|
103
107
|
})) return null;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
const layout = props.layout ?? defaultProps.layout ?? defaultLayout;
|
|
109
|
+
const isPolarChart = layout === "centric" || layout === "radial";
|
|
110
|
+
if (compact) return createVNode(Fragment, null, [
|
|
111
|
+
createVNode(ChartDataContextProvider, { "chartData": props.data }, null),
|
|
112
|
+
createVNode(ReportMainChartProps, {
|
|
113
|
+
"width": width,
|
|
114
|
+
"height": height,
|
|
115
|
+
"layout": layout,
|
|
116
|
+
"margin": props.margin ?? defaultMargin
|
|
112
117
|
}, null),
|
|
113
|
-
|
|
114
|
-
cx:
|
|
115
|
-
cy:
|
|
116
|
-
startAngle:
|
|
117
|
-
endAngle:
|
|
118
|
-
innerRadius:
|
|
119
|
-
outerRadius:
|
|
118
|
+
isPolarChart && createVNode(ReportPolarOptions, {
|
|
119
|
+
"cx": props.cx ?? "50%",
|
|
120
|
+
"cy": props.cy ?? "50%",
|
|
121
|
+
"startAngle": props.startAngle ?? defaultProps.startAngle ?? 90,
|
|
122
|
+
"endAngle": props.endAngle ?? defaultProps.endAngle ?? -270,
|
|
123
|
+
"innerRadius": props.innerRadius ?? 0,
|
|
124
|
+
"outerRadius": props.outerRadius ?? "80%"
|
|
120
125
|
}, null),
|
|
121
|
-
|
|
122
|
-
width:
|
|
123
|
-
height:
|
|
124
|
-
title:
|
|
125
|
-
desc:
|
|
126
|
-
}), { default: () => [
|
|
126
|
+
createVNode(Surface_default, mergeProps(attrs, rest, {
|
|
127
|
+
"width": width,
|
|
128
|
+
"height": height,
|
|
129
|
+
"title": title,
|
|
130
|
+
"desc": desc
|
|
131
|
+
}), { default: () => [createVNode(ClipPath_default, { "clipPathId": clipPathId }, null), slots.default?.()] })
|
|
127
132
|
]);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
if (props.accessibilityLayer) {
|
|
134
|
+
attributes.tabindex = props.tabIndex ?? 0;
|
|
135
|
+
attributes.role = props.role ?? "application";
|
|
136
|
+
}
|
|
137
|
+
const eventHandlerAttrs = {};
|
|
138
|
+
const svgAttributes = {};
|
|
139
|
+
for (const [key, value] of Object.entries(attributes)) if (key.startsWith("on") && typeof value === "function") eventHandlerAttrs[key] = value;
|
|
140
|
+
else svgAttributes[key] = value;
|
|
141
|
+
return createVNode(Fragment, null, [
|
|
142
|
+
createVNode(ChartDataContextProvider, { "chartData": props.data }, null),
|
|
143
|
+
createVNode(ReportMainChartProps, {
|
|
144
|
+
"width": width,
|
|
145
|
+
"height": height,
|
|
146
|
+
"layout": layout,
|
|
147
|
+
"margin": props.margin ?? defaultMargin
|
|
138
148
|
}, null),
|
|
139
|
-
|
|
140
|
-
cx:
|
|
141
|
-
cy:
|
|
142
|
-
startAngle:
|
|
143
|
-
endAngle:
|
|
144
|
-
innerRadius:
|
|
145
|
-
outerRadius:
|
|
149
|
+
isPolarChart && createVNode(ReportPolarOptions, {
|
|
150
|
+
"cx": props.cx ?? "50%",
|
|
151
|
+
"cy": props.cy ?? "50%",
|
|
152
|
+
"startAngle": props.startAngle ?? defaultProps.startAngle ?? 90,
|
|
153
|
+
"endAngle": props.endAngle ?? defaultProps.endAngle ?? -270,
|
|
154
|
+
"innerRadius": props.innerRadius ?? 0,
|
|
155
|
+
"outerRadius": props.outerRadius ?? "80%"
|
|
146
156
|
}, null),
|
|
147
|
-
|
|
148
|
-
style:
|
|
149
|
-
class:
|
|
150
|
-
width:
|
|
151
|
-
height:
|
|
152
|
-
},
|
|
153
|
-
width:
|
|
154
|
-
height:
|
|
155
|
-
title:
|
|
156
|
-
desc:
|
|
157
|
-
style:
|
|
158
|
-
}), { default: () => [
|
|
159
|
-
|
|
157
|
+
createVNode(RechartsWrapper, mergeProps({
|
|
158
|
+
"style": props.style,
|
|
159
|
+
"class": props.class,
|
|
160
|
+
"width": width,
|
|
161
|
+
"height": height
|
|
162
|
+
}, eventHandlerAttrs), { default: () => [createVNode(Surface_default, mergeProps(svgAttributes, {
|
|
163
|
+
"width": width,
|
|
164
|
+
"height": height,
|
|
165
|
+
"title": title,
|
|
166
|
+
"desc": desc,
|
|
167
|
+
"style": FULL_WIDTH_AND_HEIGHT
|
|
168
|
+
}), { default: () => [createVNode(ClipPath_default, { "clipPathId": clipPathId }, null), slots.default?.()] }), slots.tooltip?.()] }),
|
|
169
|
+
createVNode(ReportChartProps_default, props, null)
|
|
160
170
|
]);
|
|
161
171
|
};
|
|
162
172
|
}
|
|
163
173
|
});
|
|
164
174
|
}
|
|
165
175
|
//#endregion
|
|
166
|
-
export {
|
|
176
|
+
export { generateCategoricalChart };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { uniqueId
|
|
2
|
-
import { createContext
|
|
1
|
+
import { uniqueId } from "../utils/data-utils.mjs";
|
|
2
|
+
import { createContext } from "../utils/createContext.mjs";
|
|
3
3
|
//#region src/chart/provideClipPathId.ts
|
|
4
|
-
var [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
var [useClipPathId, provideClipPathIdRaw] = createContext("clipPathId");
|
|
5
|
+
/**
|
|
6
|
+
* Provide the clipPathId to child components.
|
|
7
|
+
* @param props - The props object from the chart component
|
|
8
|
+
*/
|
|
9
|
+
function provideClipPathId(props) {
|
|
10
|
+
const clipPathId = `${props.id ?? uniqueId("v-charts")}-clip`;
|
|
11
|
+
provideClipPathIdRaw(clipPathId);
|
|
12
|
+
return clipPathId;
|
|
8
13
|
}
|
|
9
14
|
//#endregion
|
|
10
|
-
export {
|
|
15
|
+
export { provideClipPathId, useClipPathId };
|