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.
Files changed (273) hide show
  1. package/README.md +151 -0
  2. package/dist/animation/Animate.d.ts +1 -1
  3. package/dist/cartesian/area/type.d.ts +3 -3
  4. package/dist/cartesian/bar/type.d.ts +1 -13
  5. package/dist/cartesian/brush/components/Slide.d.ts +1 -1
  6. package/dist/cartesian/brush/components/TravellerLayer.d.ts +1 -1
  7. package/dist/cartesian/brush/type.d.ts +2 -1
  8. package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +2 -1
  9. package/dist/cartesian/funnel/Funnel.d.ts +2 -0
  10. package/dist/cartesian/funnel/index.d.ts +2 -0
  11. package/dist/cartesian/funnel/type.d.ts +74 -6
  12. package/dist/cartesian/index.d.ts +2 -0
  13. package/dist/cartesian/line/Line.d.ts +7 -13
  14. package/dist/cartesian/line/type.d.ts +4 -17
  15. package/dist/cartesian/reference-area/ReferenceArea.d.ts +16 -16
  16. package/dist/cartesian/reference-dot/ReferenceDot.d.ts +143 -0
  17. package/dist/cartesian/reference-dot/index.d.ts +2 -0
  18. package/dist/cartesian/reference-line/ReferenceLine.d.ts +8 -8
  19. package/dist/cartesian/scatter/Scatter.d.ts +1 -1
  20. package/dist/chart/FunnelChart.d.ts +1 -0
  21. package/dist/chart/RechartsWrapper.d.ts +7 -3
  22. package/dist/chart/Surface.d.ts +2 -1
  23. package/dist/chart/Treemap.d.ts +237 -0
  24. package/dist/chart/generateCategoricalChart.d.ts +2 -1
  25. package/dist/chart/index.d.ts +2 -0
  26. package/dist/chart/treemapUtils.d.ts +22 -0
  27. package/dist/components/Customized.d.ts +23 -0
  28. package/dist/components/Text.d.ts +4 -4
  29. package/dist/components/Tooltip.d.ts +1 -1
  30. package/dist/components/index.d.ts +2 -0
  31. package/dist/components/label/Label.d.ts +3 -3
  32. package/dist/components/label/types.d.ts +1 -1
  33. package/dist/container/Surface.d.ts +3 -2
  34. package/dist/es/animation/Animate.mjs +48 -22
  35. package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
  36. package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
  37. package/dist/es/cartesian/area/Area.mjs +42 -31
  38. package/dist/es/cartesian/area/ClipRect.mjs +79 -58
  39. package/dist/es/cartesian/area/RenderArea.mjs +142 -108
  40. package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
  41. package/dist/es/cartesian/area/type.mjs +13 -15
  42. package/dist/es/cartesian/area/utils.mjs +69 -49
  43. package/dist/es/cartesian/axis/XAxis.mjs +87 -73
  44. package/dist/es/cartesian/axis/YAxis.mjs +67 -56
  45. package/dist/es/cartesian/bar/Bar.mjs +78 -71
  46. package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
  47. package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
  48. package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
  49. package/dist/es/cartesian/bar/type.mjs +11 -25
  50. package/dist/es/cartesian/bar/utils.mjs +97 -70
  51. package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
  52. package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
  53. package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
  54. package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
  55. package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
  56. package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
  57. package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
  58. package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
  59. package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
  60. package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
  61. package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
  62. package/dist/es/cartesian/funnel/Funnel.mjs +162 -0
  63. package/dist/es/cartesian/funnel/type.mjs +78 -0
  64. package/dist/es/cartesian/funnel/utils.mjs +102 -0
  65. package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
  66. package/dist/es/cartesian/line/Line.mjs +41 -37
  67. package/dist/es/cartesian/line/StaticLine.mjs +191 -122
  68. package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
  69. package/dist/es/cartesian/line/type.mjs +13 -18
  70. package/dist/es/cartesian/line/utils.mjs +27 -26
  71. package/dist/es/cartesian/reference-area/ReferenceArea.mjs +79 -78
  72. package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +134 -0
  73. package/dist/es/cartesian/reference-line/ReferenceLine.mjs +93 -84
  74. package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
  75. package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
  76. package/dist/es/cartesian/useNeedsClip.mjs +18 -9
  77. package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
  78. package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
  79. package/dist/es/chart/AreaChart.mjs +5 -5
  80. package/dist/es/chart/BarChart.mjs +5 -5
  81. package/dist/es/chart/ComposedChart.mjs +5 -5
  82. package/dist/es/chart/FunnelChart.mjs +11 -0
  83. package/dist/es/chart/LegendPortalContext.mjs +3 -3
  84. package/dist/es/chart/LineChart.mjs +5 -5
  85. package/dist/es/chart/PieChart.mjs +5 -5
  86. package/dist/es/chart/RadarChart.mjs +5 -5
  87. package/dist/es/chart/RadialBarChart.mjs +5 -5
  88. package/dist/es/chart/RechartsWrapper.mjs +113 -89
  89. package/dist/es/chart/ScatterChart.mjs +5 -5
  90. package/dist/es/chart/Surface.mjs +3 -3
  91. package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
  92. package/dist/es/chart/TooltipPortalContext.mjs +3 -3
  93. package/dist/es/chart/Treemap.mjs +379 -0
  94. package/dist/es/chart/const.mjs +2 -2
  95. package/dist/es/chart/generateCategoricalChart.mjs +99 -89
  96. package/dist/es/chart/provideClipPathId.mjs +12 -7
  97. package/dist/es/chart/treemapUtils.mjs +32 -0
  98. package/dist/es/components/Cell.mjs +16 -4
  99. package/dist/es/components/Customized.mjs +43 -0
  100. package/dist/es/components/Text.mjs +3 -3
  101. package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
  102. package/dist/es/components/Tooltip.mjs +274 -199
  103. package/dist/es/components/label/Label.mjs +30 -26
  104. package/dist/es/components/label/LabelList.mjs +45 -39
  105. package/dist/es/components/label/types.mjs +10 -6
  106. package/dist/es/components/label/utils.mjs +194 -162
  107. package/dist/es/components/legend/Legend.mjs +82 -71
  108. package/dist/es/components/legend/LegendSymbol.mjs +40 -38
  109. package/dist/es/components/legend/hooks/useLegend.mjs +71 -46
  110. package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
  111. package/dist/es/components/legend/type.mjs +2 -2
  112. package/dist/es/components/legend/utils.mjs +19 -11
  113. package/dist/es/components/utils.mjs +35 -22
  114. package/dist/es/container/ClipPath.mjs +14 -14
  115. package/dist/es/container/Layer.mjs +9 -7
  116. package/dist/es/container/ResponsiveContainer.mjs +3 -3
  117. package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
  118. package/dist/es/container/Surface.mjs +25 -23
  119. package/dist/es/container/useSizeContext.mjs +3 -3
  120. package/dist/es/context/ChartDataContextProvider.mjs +19 -13
  121. package/dist/es/context/PanoramaContextProvider.mjs +15 -10
  122. package/dist/es/context/accessibilityContext.mjs +3 -3
  123. package/dist/es/context/cartesianLabelListContext.mjs +3 -3
  124. package/dist/es/context/chartLayoutContext.mjs +33 -30
  125. package/dist/es/context/cursorLayerContext.mjs +3 -3
  126. package/dist/es/context/graphicalLayerContext.mjs +3 -3
  127. package/dist/es/context/labelLayerContext.mjs +3 -3
  128. package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
  129. package/dist/es/context/useTooltipAxis.mjs +14 -12
  130. package/dist/es/events/useChartSynchronisation.mjs +91 -66
  131. package/dist/es/hooks/publicHooks.mjs +207 -0
  132. package/dist/es/hooks/useIsAnimating.mjs +28 -0
  133. package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
  134. package/dist/es/index.mjs +54 -42
  135. package/dist/es/polar/pie/Pie.mjs +131 -115
  136. package/dist/es/polar/pie/type.mjs +8 -10
  137. package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
  138. package/dist/es/polar/radar/PolarGrid.mjs +72 -59
  139. package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
  140. package/dist/es/polar/radar/Radar.mjs +181 -145
  141. package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
  142. package/dist/es/polar/radial-bar/type.mjs +9 -9
  143. package/dist/es/shape/Cross.mjs +11 -10
  144. package/dist/es/shape/Curve.mjs +71 -44
  145. package/dist/es/shape/Dot.mjs +12 -11
  146. package/dist/es/shape/Polygon.mjs +19 -0
  147. package/dist/es/shape/Rectangle.mjs +41 -30
  148. package/dist/es/shape/Sector.mjs +105 -79
  149. package/dist/es/shape/Symbols.mjs +45 -34
  150. package/dist/es/shape/Trapezoid.mjs +50 -0
  151. package/dist/es/state/ReportChartProps.mjs +23 -24
  152. package/dist/es/state/ReportMainChartProps.mjs +26 -21
  153. package/dist/es/state/ReportPolarOptions.mjs +23 -22
  154. package/dist/es/state/SetGraphicalItem.mjs +42 -27
  155. package/dist/es/state/SetLegendPayload.mjs +17 -13
  156. package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
  157. package/dist/es/state/brushSlice.mjs +12 -8
  158. package/dist/es/state/cartesianAxisSlice.mjs +23 -17
  159. package/dist/es/state/chartDataSlice.mjs +18 -13
  160. package/dist/es/state/externalEventsMiddleware.mjs +25 -15
  161. package/dist/es/state/graphicalItemsSlice.mjs +29 -25
  162. package/dist/es/state/hooks.mjs +24 -3
  163. package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
  164. package/dist/es/state/layoutSlice.mjs +18 -12
  165. package/dist/es/state/legendSlice.mjs +19 -14
  166. package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
  167. package/dist/es/state/optionsSlice.mjs +14 -11
  168. package/dist/es/state/polarAxisSlice.mjs +15 -13
  169. package/dist/es/state/polarOptionsSlice.mjs +8 -6
  170. package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
  171. package/dist/es/state/referenceElementsSlice.mjs +21 -19
  172. package/dist/es/state/rootPropsSlice.mjs +20 -9
  173. package/dist/es/state/selectors/areaSelectors.mjs +65 -55
  174. package/dist/es/state/selectors/axisSelectors.mjs +784 -569
  175. package/dist/es/state/selectors/barSelectors.mjs +225 -162
  176. package/dist/es/state/selectors/brushSelectors.mjs +15 -14
  177. package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
  178. package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
  179. package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
  180. package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
  181. package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
  182. package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
  183. package/dist/es/state/selectors/common.mjs +2 -2
  184. package/dist/es/state/selectors/containerSelectors.mjs +5 -2
  185. package/dist/es/state/selectors/dataSelectors.mjs +28 -9
  186. package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
  187. package/dist/es/state/selectors/legendSelectors.mjs +7 -6
  188. package/dist/es/state/selectors/lineSelectors.mjs +54 -47
  189. package/dist/es/state/selectors/pickAxisId.mjs +2 -2
  190. package/dist/es/state/selectors/pickAxisType.mjs +2 -2
  191. package/dist/es/state/selectors/pieSelectors.mjs +116 -81
  192. package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
  193. package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
  194. package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
  195. package/dist/es/state/selectors/polarSelectors.mjs +79 -62
  196. package/dist/es/state/selectors/radarSelectors.mjs +111 -91
  197. package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
  198. package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
  199. package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
  200. package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
  201. package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
  202. package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
  203. package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
  204. package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
  205. package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
  206. package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
  207. package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
  208. package/dist/es/state/selectors/selectors.mjs +94 -75
  209. package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
  210. package/dist/es/state/selectors/touchSelectors.mjs +17 -14
  211. package/dist/es/state/store.mjs +46 -46
  212. package/dist/es/state/tooltipSlice.mjs +64 -37
  213. package/dist/es/state/touchEventsMiddleware.mjs +35 -29
  214. package/dist/es/state/utils/useReportScale.mjs +16 -13
  215. package/dist/es/synchronisation/syncSelectors.mjs +3 -3
  216. package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
  217. package/dist/es/types/common.mjs +12 -0
  218. package/dist/es/types/event.mjs +164 -2
  219. package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
  220. package/dist/es/utils/VueUtils.mjs +35 -14
  221. package/dist/es/utils/attrs.mjs +43 -26
  222. package/dist/es/utils/cartesian.mjs +47 -15
  223. package/dist/es/utils/cell.mjs +28 -0
  224. package/dist/es/utils/chart.mjs +298 -197
  225. package/dist/es/utils/const.mjs +30 -2
  226. package/dist/es/utils/createCategoricalInverse.mjs +46 -0
  227. package/dist/es/utils/createContext.mjs +28 -9
  228. package/dist/es/utils/data-utils.mjs +9 -8
  229. package/dist/es/utils/data.mjs +35 -21
  230. package/dist/es/utils/events.mjs +5 -3
  231. package/dist/es/utils/getLinearRegression.mjs +28 -11
  232. package/dist/es/utils/grid.mjs +20 -5
  233. package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
  234. package/dist/es/utils/legend.mjs +13 -12
  235. package/dist/es/utils/log.mjs +10 -7
  236. package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
  237. package/dist/es/utils/polar.mjs +37 -30
  238. package/dist/es/utils/props.mjs +16 -10
  239. package/dist/es/utils/resolveDefaultProps.mjs +23 -4
  240. package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
  241. package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
  242. package/dist/es/utils/scale/utils/utils.mjs +43 -24
  243. package/dist/es/utils/scale.mjs +46 -0
  244. package/dist/es/utils/style.mjs +24 -13
  245. package/dist/es/utils/tick.mjs +34 -23
  246. package/dist/es/utils/tooltip/translate.mjs +63 -49
  247. package/dist/es/utils/validate.mjs +40 -29
  248. package/dist/hooks/publicHooks.d.ts +143 -0
  249. package/dist/hooks/useIsAnimating.d.ts +14 -0
  250. package/dist/index.d.ts +1 -0
  251. package/dist/polar/pie/type.d.ts +2 -2
  252. package/dist/polar/radar/Radar.d.ts +4 -4
  253. package/dist/shape/Curve.d.ts +2 -1
  254. package/dist/shape/Polygon.d.ts +9 -0
  255. package/dist/shape/Rectangle.d.ts +0 -4
  256. package/dist/shape/Sector.d.ts +2 -2
  257. package/dist/shape/Symbols.d.ts +2 -1
  258. package/dist/shape/Trapezoid.d.ts +30 -0
  259. package/dist/shape/index.d.ts +2 -0
  260. package/dist/shape/types.d.ts +4 -5
  261. package/dist/state/ReportChartProps.d.ts +3 -3
  262. package/dist/state/graphicalItemsSlice.d.ts +1 -1
  263. package/dist/state/rootPropsSlice.d.ts +2 -2
  264. package/dist/state/selectors/axisSelectors.d.ts +5 -0
  265. package/dist/types/axis.d.ts +2 -2
  266. package/dist/types/bar.d.ts +2 -6
  267. package/dist/types/categorical.d.ts +2 -2
  268. package/dist/types/common.d.ts +7 -1
  269. package/dist/types/tooltip.d.ts +2 -2
  270. package/dist/utils/cell.d.ts +11 -0
  271. package/dist/utils/createCategoricalInverse.d.ts +16 -0
  272. package/dist/utils/scale.d.ts +23 -0
  273. package/package.json +2 -1
@@ -1,47 +1,51 @@
1
- import { interpolate as e } from "../../utils/data-utils.mjs";
2
- import { useIsPanorama as t } from "../../context/PanoramaContextProvider.mjs";
3
- import { useAppSelector as n } from "../../state/hooks.mjs";
4
- import { Layer as r } from "../../container/Layer.mjs";
5
- import { Dot as i } from "../../shape/Dot.mjs";
6
- import { provideCartesianLabelListData as a } from "../../context/cartesianLabelListContext.mjs";
7
- import { LabelList as o } from "../../components/label/LabelList.mjs";
8
- import { Animate as s } from "../../animation/Animate.mjs";
9
- import { SetPolarGraphicalItem as c } from "../../state/SetGraphicalItem.mjs";
10
- import { SetLegendPayload as l } from "../../state/SetLegendPayload.mjs";
11
- import { SetTooltipEntrySettings as u } from "../../state/SetTooltipEntrySettings.mjs";
12
- import { useGraphicalLayerRef as d } from "../../context/graphicalLayerContext.mjs";
13
- import { ActivePoints as f } from "../../cartesian/line/ActivePoints.mjs";
14
- import { selectRadarPoints as p } from "../../state/selectors/radarSelectors.mjs";
15
- import { Fragment as m, Teleport as h, computed as g, createVNode as _, defineComponent as v, isVNode as y, mergeProps as b, ref as x } from "vue";
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 S(e) {
18
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !y(e);
18
+ function _isSlot(s) {
19
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
19
20
  }
20
- function C(e, t) {
21
- return e && e !== "none" ? e : t;
21
+ function getLegendItemColor(stroke, fill) {
22
+ return stroke && stroke !== "none" ? stroke : fill;
22
23
  }
23
- function w(e) {
24
- return e.length ? `${[...e, e[0]].map((e, t) => `${t === 0 ? "M" : "L"}${e.x},${e.y}`).join("")}Z` : "";
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 T(e, t) {
27
- let n = w(e), r = w([...t].reverse());
28
- return `${n.endsWith("Z") ? n.slice(0, -1) : n}L${r.slice(1)}`;
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 E(t, n, r, i, a) {
31
- let o = t && t[Math.floor(a * n)];
32
- return o ? {
33
- ...i,
34
- x: e(o.x, i.x, r),
35
- y: e(o.y, i.y, r)
36
- } : {
37
- ...i,
38
- x: e(i.cx ?? 0, i.x, r),
39
- y: e(i.cy ?? 0, i.y, r)
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 D = /* @__PURE__ */ v({
46
+ var Radar = /* @__PURE__ */ defineComponent({
43
47
  name: "Radar",
44
- inheritAttrs: !1,
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: !0
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: !1
92
+ default: false
89
93
  },
90
94
  hide: {
91
95
  type: Boolean,
92
- default: !1
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: !1
108
+ default: false
105
109
  },
106
110
  label: {
107
111
  type: [Boolean, Object],
108
- default: !1
112
+ default: false
109
113
  },
110
114
  isAnimationActive: {
111
115
  type: Boolean,
112
- default: !0
116
+ default: true
113
117
  },
114
118
  activeDot: {
115
119
  type: [Object, Boolean],
116
- default: !0
120
+ default: true
117
121
  }
118
122
  },
119
- setup(e) {
120
- let v = t();
121
- c(g(() => ({
123
+ setup(props) {
124
+ const isPanorama = useIsPanorama();
125
+ SetPolarGraphicalItem(computed(() => ({
122
126
  type: "radar",
123
127
  data: void 0,
124
- dataKey: e.dataKey,
125
- hide: e.hide,
126
- angleAxisId: e.angleAxisId,
127
- radiusAxisId: e.radiusAxisId
128
- }))), l(g(() => [{
129
- dataKey: e.dataKey,
130
- type: e.legendType,
131
- color: C(e.stroke, e.fill),
132
- value: e.name ?? String(e.dataKey ?? ""),
133
- payload: { ...e },
134
- inactive: e.hide
135
- }])), u({
136
- fn: (e) => e,
137
- args: g(() => ({
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: e.dataKey,
147
+ dataKey: props.dataKey,
142
148
  nameKey: void 0,
143
- name: e.name ?? String(e.dataKey ?? ""),
144
- hide: e.hide,
145
- type: e.tooltipType,
146
- color: C(e.stroke, e.fill),
147
- fill: e.fill,
148
- stroke: e.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
- let y = n((t) => p(t, e.radiusAxisId, e.angleAxisId, v, e.dataKey)), D = d(), O = x(e.isAnimationActive);
154
- a(g(() => {
155
- if (e.isAnimationActive && O.value) return;
156
- let t = y.value;
157
- if (t) return t.points.map((e) => ({
158
- x: e.x,
159
- y: e.y,
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: e.value ?? "",
163
- payload: e.payload
171
+ value: point.value ?? "",
172
+ payload: point.payload
164
173
  }));
165
174
  }));
166
- let k = null, A = null, j = 0, M, N = (t, n, a) => {
167
- let o = e.stroke ?? e.fill, s = o && o !== "none", c;
168
- c = a && n.length > 0 ? T(t, n) : w(t);
169
- let l = c.endsWith("Z");
170
- return _(r, { class: "v-charts-radar" }, { default: () => [_("g", { class: "v-charts-radar-polygon" }, [a && n.length > 0 ? _("g", null, [
171
- _("path", {
172
- d: c,
173
- fill: l ? e.fill : "none",
174
- "fill-opacity": e.fillOpacity,
175
- stroke: "none",
176
- "stroke-dasharray": e.strokeDasharray
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
- s && _("path", {
179
- d: w(t),
180
- fill: "none",
181
- stroke: o,
182
- "stroke-width": e.strokeWidth,
183
- "stroke-dasharray": e.strokeDasharray
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
- s && _("path", {
186
- d: w(n),
187
- fill: "none",
188
- stroke: o,
189
- "stroke-width": e.strokeWidth,
190
- "stroke-dasharray": e.strokeDasharray
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
- ]) : _("path", {
193
- d: c,
194
- fill: l ? e.fill : "none",
195
- "fill-opacity": e.fillOpacity,
196
- stroke: o,
197
- "stroke-width": e.strokeWidth,
198
- "stroke-dasharray": e.strokeDasharray
199
- }, null)]), e.dot && _("g", { class: "v-charts-radar-dots" }, [t.map((t, n) => {
200
- let r = typeof e.dot == "object" ? e.dot : {};
201
- return _(i, b({
202
- key: `dot-${n}`,
203
- cx: t.x,
204
- cy: t.y,
205
- r: 3,
206
- fill: e.fill,
207
- stroke: o
208
- }, r), null);
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 (e.hide) return null;
213
- let t = y.value;
214
- if (t == null || t.points.length === 0) return null;
215
- let { points: n, baseLinePoints: r, isRange: i } = t, a = _(f, {
216
- points: n,
217
- mainColor: C(e.stroke, e.fill) ?? e.fill,
218
- itemDataKey: e.dataKey,
219
- activeDot: e.activeDot
220
- }, null), c = D?.value ? _(h, { to: D.value }, S(a) ? a : { default: () => [a] }) : a, l = !O.value && e.label ? _(o, typeof e.label == "object" ? e.label : {}, null) : null;
221
- if (!e.isAnimationActive) return k = n, A = r, _(m, null, [
222
- N(n, r, i),
223
- l,
224
- c
225
- ]);
226
- let u = k, d = A, p = u ? u.length / n.length : 1, g = d ? d.length / r.length : 1;
227
- return t !== M && (j++, M = t), _(m, null, [
228
- _(s, {
229
- key: j,
230
- isActive: !0,
231
- onAnimationStart: () => {
232
- O.value = !0;
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
- O.value = !1;
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
- }, { default: (e) => {
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
- l,
242
- c
277
+ labelEl,
278
+ activePoints
243
279
  ]);
244
280
  };
245
281
  }
246
282
  });
247
283
  //#endregion
248
- export { D as Radar };
284
+ export { Radar };