vccs 0.1.0 → 0.2.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/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 -5
- package/dist/cartesian/index.d.ts +1 -0
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/index.d.ts +1 -0
- 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 +11 -11
- 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 +93 -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 +9 -9
- 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 +177 -0
- package/dist/es/cartesian/funnel/type.mjs +80 -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 +11 -11
- package/dist/es/cartesian/line/utils.mjs +27 -26
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +86 -69
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -77
- 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 +111 -88
- 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/const.mjs +2 -2
- package/dist/es/chart/generateCategoricalChart.mjs +97 -88
- package/dist/es/chart/provideClipPathId.mjs +12 -7
- package/dist/es/components/Cell.mjs +16 -4
- 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 +8 -5
- 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 +66 -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 +23 -19
- 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/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
- package/dist/es/index.mjs +46 -42
- package/dist/es/polar/pie/Pie.mjs +131 -115
- package/dist/es/polar/pie/type.mjs +6 -6
- 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 +69 -43
- package/dist/es/shape/Dot.mjs +12 -11
- package/dist/es/shape/Rectangle.mjs +41 -26
- package/dist/es/shape/Sector.mjs +103 -75
- package/dist/es/shape/Symbols.mjs +45 -34
- package/dist/es/shape/Trapezoid.mjs +52 -0
- package/dist/es/state/ReportChartProps.mjs +21 -20
- 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 +4 -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 +755 -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/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/chart.mjs +298 -197
- package/dist/es/utils/const.mjs +30 -2
- 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/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/useIsAnimating.d.ts +14 -0
- package/dist/shape/Trapezoid.d.ts +31 -0
- package/dist/shape/index.d.ts +1 -0
- package/dist/state/graphicalItemsSlice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,47 +1,51 @@
|
|
|
1
|
-
import { interpolate
|
|
2
|
-
import { useIsPanorama
|
|
3
|
-
import { useAppSelector
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
1
|
+
import { interpolate } from "../../utils/data-utils.mjs";
|
|
2
|
+
import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
|
|
3
|
+
import { useAppSelector } from "../../state/hooks.mjs";
|
|
4
|
+
import { useIsAnimating } from "../../hooks/useIsAnimating.mjs";
|
|
5
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
6
|
+
import { Dot } from "../../shape/Dot.mjs";
|
|
7
|
+
import { provideCartesianLabelListData } from "../../context/cartesianLabelListContext.mjs";
|
|
8
|
+
import { LabelList } from "../../components/label/LabelList.mjs";
|
|
9
|
+
import { Animate } from "../../animation/Animate.mjs";
|
|
10
|
+
import { SetPolarGraphicalItem } from "../../state/SetGraphicalItem.mjs";
|
|
11
|
+
import { SetLegendPayload } from "../../state/SetLegendPayload.mjs";
|
|
12
|
+
import { SetTooltipEntrySettings } from "../../state/SetTooltipEntrySettings.mjs";
|
|
13
|
+
import { useGraphicalLayerRef } from "../../context/graphicalLayerContext.mjs";
|
|
14
|
+
import { ActivePoints } from "../../cartesian/line/ActivePoints.mjs";
|
|
15
|
+
import { selectRadarPoints } from "../../state/selectors/radarSelectors.mjs";
|
|
16
|
+
import { Fragment, Teleport, computed, createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
16
17
|
//#region src/polar/radar/Radar.tsx
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
18
|
+
function _isSlot(s) {
|
|
19
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
21
|
+
function getLegendItemColor(stroke, fill) {
|
|
22
|
+
return stroke && stroke !== "none" ? stroke : fill;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
24
|
+
function getSinglePolygonPath(points) {
|
|
25
|
+
if (!points.length) return "";
|
|
26
|
+
return `${[...points, points[0]].map((p, i) => `${i === 0 ? "M" : "L"}${p.x},${p.y}`).join("")}Z`;
|
|
25
27
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
function getRangePath(points, baseLinePoints) {
|
|
29
|
+
const outerPath = getSinglePolygonPath(points);
|
|
30
|
+
const inner = getSinglePolygonPath([...baseLinePoints].reverse());
|
|
31
|
+
return `${outerPath.endsWith("Z") ? outerPath.slice(0, -1) : outerPath}L${inner.slice(1)}`;
|
|
29
32
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...
|
|
34
|
-
x:
|
|
35
|
-
y:
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
function interpolatePolarPoint(prevPoints, prevPointsDiffFactor, t, entry, index) {
|
|
34
|
+
const prev = prevPoints && prevPoints[Math.floor(index * prevPointsDiffFactor)];
|
|
35
|
+
if (prev) return {
|
|
36
|
+
...entry,
|
|
37
|
+
x: interpolate(prev.x, entry.x, t),
|
|
38
|
+
y: interpolate(prev.y, entry.y, t)
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...entry,
|
|
42
|
+
x: interpolate(entry.cx ?? 0, entry.x, t),
|
|
43
|
+
y: interpolate(entry.cy ?? 0, entry.y, t)
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
|
-
var
|
|
46
|
+
var Radar = /* @__PURE__ */ defineComponent({
|
|
43
47
|
name: "Radar",
|
|
44
|
-
inheritAttrs:
|
|
48
|
+
inheritAttrs: false,
|
|
45
49
|
props: {
|
|
46
50
|
dataKey: {
|
|
47
51
|
type: [
|
|
@@ -49,7 +53,7 @@ var D = /* @__PURE__ */ v({
|
|
|
49
53
|
Number,
|
|
50
54
|
Function
|
|
51
55
|
],
|
|
52
|
-
required:
|
|
56
|
+
required: true
|
|
53
57
|
},
|
|
54
58
|
name: {
|
|
55
59
|
type: String,
|
|
@@ -85,11 +89,11 @@ var D = /* @__PURE__ */ v({
|
|
|
85
89
|
},
|
|
86
90
|
dot: {
|
|
87
91
|
type: [Boolean, Object],
|
|
88
|
-
default:
|
|
92
|
+
default: false
|
|
89
93
|
},
|
|
90
94
|
hide: {
|
|
91
95
|
type: Boolean,
|
|
92
|
-
default:
|
|
96
|
+
default: false
|
|
93
97
|
},
|
|
94
98
|
legendType: {
|
|
95
99
|
type: String,
|
|
@@ -101,148 +105,180 @@ var D = /* @__PURE__ */ v({
|
|
|
101
105
|
},
|
|
102
106
|
connectNulls: {
|
|
103
107
|
type: Boolean,
|
|
104
|
-
default:
|
|
108
|
+
default: false
|
|
105
109
|
},
|
|
106
110
|
label: {
|
|
107
111
|
type: [Boolean, Object],
|
|
108
|
-
default:
|
|
112
|
+
default: false
|
|
109
113
|
},
|
|
110
114
|
isAnimationActive: {
|
|
111
115
|
type: Boolean,
|
|
112
|
-
default:
|
|
116
|
+
default: true
|
|
113
117
|
},
|
|
114
118
|
activeDot: {
|
|
115
119
|
type: [Object, Boolean],
|
|
116
|
-
default:
|
|
120
|
+
default: true
|
|
117
121
|
}
|
|
118
122
|
},
|
|
119
|
-
setup(
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
setup(props) {
|
|
124
|
+
const isPanorama = useIsPanorama();
|
|
125
|
+
SetPolarGraphicalItem(computed(() => ({
|
|
122
126
|
type: "radar",
|
|
123
127
|
data: void 0,
|
|
124
|
-
dataKey:
|
|
125
|
-
hide:
|
|
126
|
-
angleAxisId:
|
|
127
|
-
radiusAxisId:
|
|
128
|
-
})))
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
dataKey: props.dataKey,
|
|
129
|
+
hide: props.hide,
|
|
130
|
+
angleAxisId: props.angleAxisId,
|
|
131
|
+
radiusAxisId: props.radiusAxisId
|
|
132
|
+
})));
|
|
133
|
+
SetLegendPayload(computed(() => [{
|
|
134
|
+
dataKey: props.dataKey,
|
|
135
|
+
type: props.legendType,
|
|
136
|
+
color: getLegendItemColor(props.stroke, props.fill),
|
|
137
|
+
value: props.name ?? String(props.dataKey ?? ""),
|
|
138
|
+
payload: { ...props },
|
|
139
|
+
inactive: props.hide
|
|
140
|
+
}]));
|
|
141
|
+
SetTooltipEntrySettings({
|
|
142
|
+
fn: (v) => v,
|
|
143
|
+
args: computed(() => ({
|
|
138
144
|
dataDefinedOnItem: void 0,
|
|
139
145
|
positions: void 0,
|
|
140
146
|
settings: {
|
|
141
|
-
dataKey:
|
|
147
|
+
dataKey: props.dataKey,
|
|
142
148
|
nameKey: void 0,
|
|
143
|
-
name:
|
|
144
|
-
hide:
|
|
145
|
-
type:
|
|
146
|
-
color:
|
|
147
|
-
fill:
|
|
148
|
-
stroke:
|
|
149
|
+
name: props.name ?? String(props.dataKey ?? ""),
|
|
150
|
+
hide: props.hide,
|
|
151
|
+
type: props.tooltipType,
|
|
152
|
+
color: getLegendItemColor(props.stroke, props.fill),
|
|
153
|
+
fill: props.fill,
|
|
154
|
+
stroke: props.stroke,
|
|
149
155
|
unit: ""
|
|
150
156
|
}
|
|
151
157
|
}))
|
|
152
158
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
const radarPoints = useAppSelector((state) => selectRadarPoints(state, props.radiusAxisId, props.angleAxisId, isPanorama, props.dataKey));
|
|
160
|
+
const graphicalLayerRef = useGraphicalLayerRef();
|
|
161
|
+
const isAnimating = useIsAnimating(() => props.isAnimationActive);
|
|
162
|
+
provideCartesianLabelListData(computed(() => {
|
|
163
|
+
if (props.isAnimationActive && isAnimating.value) return void 0;
|
|
164
|
+
const data = radarPoints.value;
|
|
165
|
+
if (!data) return void 0;
|
|
166
|
+
return data.points.map((point) => ({
|
|
167
|
+
x: point.x,
|
|
168
|
+
y: point.y,
|
|
160
169
|
width: 0,
|
|
161
170
|
height: 0,
|
|
162
|
-
value:
|
|
163
|
-
payload:
|
|
171
|
+
value: point.value ?? "",
|
|
172
|
+
payload: point.payload
|
|
164
173
|
}));
|
|
165
174
|
}));
|
|
166
|
-
let
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
let prevPoints = null;
|
|
176
|
+
let prevBaseLinePoints = null;
|
|
177
|
+
let animationId = 0;
|
|
178
|
+
let lastData = void 0;
|
|
179
|
+
const renderPolygon = (points, baseLinePoints, isRange) => {
|
|
180
|
+
const stroke = props.stroke ?? props.fill;
|
|
181
|
+
const hasStroke = stroke && stroke !== "none";
|
|
182
|
+
let pathD;
|
|
183
|
+
if (isRange && baseLinePoints.length > 0) pathD = getRangePath(points, baseLinePoints);
|
|
184
|
+
else pathD = getSinglePolygonPath(points);
|
|
185
|
+
const isClosed = pathD.endsWith("Z");
|
|
186
|
+
return createVNode(Layer, { "class": "v-charts-radar" }, { default: () => [createVNode("g", { "class": "v-charts-radar-polygon" }, [isRange && baseLinePoints.length > 0 ? createVNode("g", null, [
|
|
187
|
+
createVNode("path", {
|
|
188
|
+
"d": pathD,
|
|
189
|
+
"fill": isClosed ? props.fill : "none",
|
|
190
|
+
"fill-opacity": props.fillOpacity,
|
|
191
|
+
"stroke": "none",
|
|
192
|
+
"stroke-dasharray": props.strokeDasharray
|
|
177
193
|
}, null),
|
|
178
|
-
|
|
179
|
-
d:
|
|
180
|
-
fill: "none",
|
|
181
|
-
stroke:
|
|
182
|
-
"stroke-width":
|
|
183
|
-
"stroke-dasharray":
|
|
194
|
+
hasStroke && createVNode("path", {
|
|
195
|
+
"d": getSinglePolygonPath(points),
|
|
196
|
+
"fill": "none",
|
|
197
|
+
"stroke": stroke,
|
|
198
|
+
"stroke-width": props.strokeWidth,
|
|
199
|
+
"stroke-dasharray": props.strokeDasharray
|
|
184
200
|
}, null),
|
|
185
|
-
|
|
186
|
-
d:
|
|
187
|
-
fill: "none",
|
|
188
|
-
stroke:
|
|
189
|
-
"stroke-width":
|
|
190
|
-
"stroke-dasharray":
|
|
201
|
+
hasStroke && createVNode("path", {
|
|
202
|
+
"d": getSinglePolygonPath(baseLinePoints),
|
|
203
|
+
"fill": "none",
|
|
204
|
+
"stroke": stroke,
|
|
205
|
+
"stroke-width": props.strokeWidth,
|
|
206
|
+
"stroke-dasharray": props.strokeDasharray
|
|
191
207
|
}, null)
|
|
192
|
-
]) :
|
|
193
|
-
d:
|
|
194
|
-
fill:
|
|
195
|
-
"fill-opacity":
|
|
196
|
-
stroke:
|
|
197
|
-
"stroke-width":
|
|
198
|
-
"stroke-dasharray":
|
|
199
|
-
}, null)]),
|
|
200
|
-
|
|
201
|
-
return
|
|
202
|
-
key: `dot-${
|
|
203
|
-
cx:
|
|
204
|
-
cy:
|
|
205
|
-
r: 3,
|
|
206
|
-
fill:
|
|
207
|
-
stroke:
|
|
208
|
-
},
|
|
208
|
+
]) : createVNode("path", {
|
|
209
|
+
"d": pathD,
|
|
210
|
+
"fill": isClosed ? props.fill : "none",
|
|
211
|
+
"fill-opacity": props.fillOpacity,
|
|
212
|
+
"stroke": stroke,
|
|
213
|
+
"stroke-width": props.strokeWidth,
|
|
214
|
+
"stroke-dasharray": props.strokeDasharray
|
|
215
|
+
}, null)]), props.dot && createVNode("g", { "class": "v-charts-radar-dots" }, [points.map((point, i) => {
|
|
216
|
+
const dotProps = typeof props.dot === "object" ? props.dot : {};
|
|
217
|
+
return createVNode(Dot, mergeProps({
|
|
218
|
+
"key": `dot-${i}`,
|
|
219
|
+
"cx": point.x,
|
|
220
|
+
"cy": point.y,
|
|
221
|
+
"r": 3,
|
|
222
|
+
"fill": props.fill,
|
|
223
|
+
"stroke": stroke
|
|
224
|
+
}, dotProps), null);
|
|
209
225
|
})])] });
|
|
210
226
|
};
|
|
211
227
|
return () => {
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
if (props.hide) return null;
|
|
229
|
+
const data = radarPoints.value;
|
|
230
|
+
if (data == null || data.points.length === 0) return null;
|
|
231
|
+
const { points, baseLinePoints, isRange } = data;
|
|
232
|
+
const mainColor = getLegendItemColor(props.stroke, props.fill) ?? props.fill;
|
|
233
|
+
const activePointsEl = createVNode(ActivePoints, {
|
|
234
|
+
"points": points,
|
|
235
|
+
"mainColor": mainColor,
|
|
236
|
+
"itemDataKey": props.dataKey,
|
|
237
|
+
"activeDot": props.activeDot
|
|
238
|
+
}, null);
|
|
239
|
+
const activePoints = graphicalLayerRef?.value ? createVNode(Teleport, { "to": graphicalLayerRef.value }, _isSlot(activePointsEl) ? activePointsEl : { default: () => [activePointsEl] }) : activePointsEl;
|
|
240
|
+
const labelEl = !isAnimating.value && props.label ? createVNode(LabelList, typeof props.label === "object" ? props.label : {}, null) : null;
|
|
241
|
+
if (!props.isAnimationActive) {
|
|
242
|
+
prevPoints = points;
|
|
243
|
+
prevBaseLinePoints = baseLinePoints;
|
|
244
|
+
return createVNode(Fragment, null, [
|
|
245
|
+
renderPolygon(points, baseLinePoints, isRange),
|
|
246
|
+
labelEl,
|
|
247
|
+
activePoints
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
const prevPts = prevPoints;
|
|
251
|
+
const prevBasePts = prevBaseLinePoints;
|
|
252
|
+
const prevPointsDiffFactor = prevPts ? prevPts.length / points.length : 1;
|
|
253
|
+
const prevBaseDiffFactor = prevBasePts ? prevBasePts.length / baseLinePoints.length : 1;
|
|
254
|
+
if (data !== lastData) {
|
|
255
|
+
animationId++;
|
|
256
|
+
lastData = data;
|
|
257
|
+
}
|
|
258
|
+
return createVNode(Fragment, null, [
|
|
259
|
+
createVNode(Animate, {
|
|
260
|
+
"key": animationId,
|
|
261
|
+
"isActive": true,
|
|
262
|
+
"onAnimationStart": () => {
|
|
263
|
+
isAnimating.value = true;
|
|
233
264
|
},
|
|
234
|
-
onAnimationEnd: () => {
|
|
235
|
-
|
|
265
|
+
"onAnimationEnd": () => {
|
|
266
|
+
isAnimating.value = false;
|
|
267
|
+
}
|
|
268
|
+
}, { default: (t) => {
|
|
269
|
+
const stepPoints = t === 1 ? points : points.map((entry, i) => interpolatePolarPoint(prevPts, prevPointsDiffFactor, t, entry, i));
|
|
270
|
+
const stepBaseLine = t === 1 ? baseLinePoints : baseLinePoints.map((entry, i) => interpolatePolarPoint(prevBasePts, prevBaseDiffFactor, t, entry, i));
|
|
271
|
+
if (t > 0) {
|
|
272
|
+
prevPoints = stepPoints;
|
|
273
|
+
prevBaseLinePoints = stepBaseLine;
|
|
236
274
|
}
|
|
237
|
-
|
|
238
|
-
let t = e === 1 ? n : n.map((t, n) => E(u, p, e, t, n)), a = e === 1 ? r : r.map((t, n) => E(d, g, e, t, n));
|
|
239
|
-
return e > 0 && (k = t, A = a), N(t, a, i);
|
|
275
|
+
return renderPolygon(stepPoints, stepBaseLine, isRange);
|
|
240
276
|
} }),
|
|
241
|
-
|
|
242
|
-
|
|
277
|
+
labelEl,
|
|
278
|
+
activePoints
|
|
243
279
|
]);
|
|
244
280
|
};
|
|
245
281
|
}
|
|
246
282
|
});
|
|
247
283
|
//#endregion
|
|
248
|
-
export {
|
|
284
|
+
export { Radar };
|