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.
Files changed (215) hide show
  1. package/dist/cartesian/funnel/Funnel.d.ts +2 -0
  2. package/dist/cartesian/funnel/index.d.ts +2 -0
  3. package/dist/cartesian/funnel/type.d.ts +74 -5
  4. package/dist/cartesian/index.d.ts +1 -0
  5. package/dist/chart/FunnelChart.d.ts +1 -0
  6. package/dist/chart/index.d.ts +1 -0
  7. package/dist/es/animation/Animate.mjs +48 -22
  8. package/dist/es/cartesian/GraphicalItemClipPath.mjs +16 -15
  9. package/dist/es/cartesian/area/ActivePoints.mjs +44 -40
  10. package/dist/es/cartesian/area/Area.mjs +42 -31
  11. package/dist/es/cartesian/area/ClipRect.mjs +79 -58
  12. package/dist/es/cartesian/area/RenderArea.mjs +142 -108
  13. package/dist/es/cartesian/area/hooks/useArea.mjs +71 -47
  14. package/dist/es/cartesian/area/type.mjs +11 -11
  15. package/dist/es/cartesian/area/utils.mjs +69 -49
  16. package/dist/es/cartesian/axis/XAxis.mjs +87 -73
  17. package/dist/es/cartesian/axis/YAxis.mjs +67 -56
  18. package/dist/es/cartesian/bar/Bar.mjs +93 -71
  19. package/dist/es/cartesian/bar/components/BarBackground.mjs +22 -19
  20. package/dist/es/cartesian/bar/components/BarRectangles.mjs +117 -80
  21. package/dist/es/cartesian/bar/hooks/useBar.mjs +49 -37
  22. package/dist/es/cartesian/bar/type.mjs +9 -9
  23. package/dist/es/cartesian/bar/utils.mjs +97 -70
  24. package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +165 -115
  25. package/dist/es/cartesian/cartesian-grid/Background.mjs +19 -16
  26. package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +116 -97
  27. package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +24 -23
  28. package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +24 -24
  29. package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +23 -22
  30. package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +24 -24
  31. package/dist/es/cartesian/cartesian-grid/const.mjs +317 -10
  32. package/dist/es/cartesian/cartesian-grid/utils.mjs +18 -13
  33. package/dist/es/cartesian/error-bar/ErrorBar.mjs +111 -83
  34. package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +13 -12
  35. package/dist/es/cartesian/funnel/Funnel.mjs +177 -0
  36. package/dist/es/cartesian/funnel/type.mjs +80 -0
  37. package/dist/es/cartesian/funnel/utils.mjs +102 -0
  38. package/dist/es/cartesian/line/ActivePoints.mjs +45 -41
  39. package/dist/es/cartesian/line/Line.mjs +41 -37
  40. package/dist/es/cartesian/line/StaticLine.mjs +191 -122
  41. package/dist/es/cartesian/line/hooks/useLine.mjs +60 -44
  42. package/dist/es/cartesian/line/type.mjs +11 -11
  43. package/dist/es/cartesian/line/utils.mjs +27 -26
  44. package/dist/es/cartesian/reference-area/ReferenceArea.mjs +86 -69
  45. package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -77
  46. package/dist/es/cartesian/scatter/Scatter.mjs +168 -140
  47. package/dist/es/cartesian/scatter/hooks/useScatter.mjs +18 -14
  48. package/dist/es/cartesian/useNeedsClip.mjs +18 -9
  49. package/dist/es/cartesian/utils/get-ticks.mjs +103 -68
  50. package/dist/es/cartesian/z-axis/ZAxis.mjs +30 -28
  51. package/dist/es/chart/AreaChart.mjs +5 -5
  52. package/dist/es/chart/BarChart.mjs +5 -5
  53. package/dist/es/chart/ComposedChart.mjs +5 -5
  54. package/dist/es/chart/FunnelChart.mjs +11 -0
  55. package/dist/es/chart/LegendPortalContext.mjs +3 -3
  56. package/dist/es/chart/LineChart.mjs +5 -5
  57. package/dist/es/chart/PieChart.mjs +5 -5
  58. package/dist/es/chart/RadarChart.mjs +5 -5
  59. package/dist/es/chart/RadialBarChart.mjs +5 -5
  60. package/dist/es/chart/RechartsWrapper.mjs +111 -88
  61. package/dist/es/chart/ScatterChart.mjs +5 -5
  62. package/dist/es/chart/Surface.mjs +3 -3
  63. package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +51 -45
  64. package/dist/es/chart/TooltipPortalContext.mjs +3 -3
  65. package/dist/es/chart/const.mjs +2 -2
  66. package/dist/es/chart/generateCategoricalChart.mjs +97 -88
  67. package/dist/es/chart/provideClipPathId.mjs +12 -7
  68. package/dist/es/components/Cell.mjs +16 -4
  69. package/dist/es/components/Text.mjs +3 -3
  70. package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +106 -69
  71. package/dist/es/components/Tooltip.mjs +274 -199
  72. package/dist/es/components/label/Label.mjs +30 -26
  73. package/dist/es/components/label/LabelList.mjs +45 -39
  74. package/dist/es/components/label/types.mjs +8 -5
  75. package/dist/es/components/label/utils.mjs +194 -162
  76. package/dist/es/components/legend/Legend.mjs +82 -71
  77. package/dist/es/components/legend/LegendSymbol.mjs +40 -38
  78. package/dist/es/components/legend/hooks/useLegend.mjs +66 -46
  79. package/dist/es/components/legend/hooks/useLegendContent.mjs +52 -31
  80. package/dist/es/components/legend/type.mjs +2 -2
  81. package/dist/es/components/legend/utils.mjs +19 -11
  82. package/dist/es/components/utils.mjs +35 -22
  83. package/dist/es/container/ClipPath.mjs +14 -14
  84. package/dist/es/container/Layer.mjs +9 -7
  85. package/dist/es/container/ResponsiveContainer.mjs +3 -3
  86. package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +109 -77
  87. package/dist/es/container/Surface.mjs +23 -19
  88. package/dist/es/container/useSizeContext.mjs +3 -3
  89. package/dist/es/context/ChartDataContextProvider.mjs +19 -13
  90. package/dist/es/context/PanoramaContextProvider.mjs +15 -10
  91. package/dist/es/context/accessibilityContext.mjs +3 -3
  92. package/dist/es/context/cartesianLabelListContext.mjs +3 -3
  93. package/dist/es/context/chartLayoutContext.mjs +33 -30
  94. package/dist/es/context/cursorLayerContext.mjs +3 -3
  95. package/dist/es/context/graphicalLayerContext.mjs +3 -3
  96. package/dist/es/context/labelLayerContext.mjs +3 -3
  97. package/dist/es/context/polarLabelViewBoxContext.mjs +5 -5
  98. package/dist/es/context/useTooltipAxis.mjs +14 -12
  99. package/dist/es/events/useChartSynchronisation.mjs +91 -66
  100. package/dist/es/hooks/useIsAnimating.mjs +28 -0
  101. package/dist/es/hooks/useSetupGraphicalItem.mjs +52 -43
  102. package/dist/es/index.mjs +46 -42
  103. package/dist/es/polar/pie/Pie.mjs +131 -115
  104. package/dist/es/polar/pie/type.mjs +6 -6
  105. package/dist/es/polar/radar/PolarAngleAxis.mjs +103 -84
  106. package/dist/es/polar/radar/PolarGrid.mjs +72 -59
  107. package/dist/es/polar/radar/PolarRadiusAxis.mjs +90 -65
  108. package/dist/es/polar/radar/Radar.mjs +181 -145
  109. package/dist/es/polar/radial-bar/RadialBar.mjs +161 -140
  110. package/dist/es/polar/radial-bar/type.mjs +9 -9
  111. package/dist/es/shape/Cross.mjs +11 -10
  112. package/dist/es/shape/Curve.mjs +69 -43
  113. package/dist/es/shape/Dot.mjs +12 -11
  114. package/dist/es/shape/Rectangle.mjs +41 -26
  115. package/dist/es/shape/Sector.mjs +103 -75
  116. package/dist/es/shape/Symbols.mjs +45 -34
  117. package/dist/es/shape/Trapezoid.mjs +52 -0
  118. package/dist/es/state/ReportChartProps.mjs +21 -20
  119. package/dist/es/state/ReportMainChartProps.mjs +26 -21
  120. package/dist/es/state/ReportPolarOptions.mjs +23 -22
  121. package/dist/es/state/SetGraphicalItem.mjs +42 -27
  122. package/dist/es/state/SetLegendPayload.mjs +17 -13
  123. package/dist/es/state/SetTooltipEntrySettings.mjs +14 -12
  124. package/dist/es/state/brushSlice.mjs +12 -8
  125. package/dist/es/state/cartesianAxisSlice.mjs +23 -17
  126. package/dist/es/state/chartDataSlice.mjs +18 -13
  127. package/dist/es/state/externalEventsMiddleware.mjs +25 -15
  128. package/dist/es/state/graphicalItemsSlice.mjs +29 -25
  129. package/dist/es/state/hooks.mjs +4 -3
  130. package/dist/es/state/keyboardEventsMiddleware.mjs +50 -42
  131. package/dist/es/state/layoutSlice.mjs +18 -12
  132. package/dist/es/state/legendSlice.mjs +19 -14
  133. package/dist/es/state/mouseEventsMiddleware.mjs +31 -24
  134. package/dist/es/state/optionsSlice.mjs +14 -11
  135. package/dist/es/state/polarAxisSlice.mjs +15 -13
  136. package/dist/es/state/polarOptionsSlice.mjs +8 -6
  137. package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +5 -3
  138. package/dist/es/state/referenceElementsSlice.mjs +21 -19
  139. package/dist/es/state/rootPropsSlice.mjs +20 -9
  140. package/dist/es/state/selectors/areaSelectors.mjs +65 -55
  141. package/dist/es/state/selectors/axisSelectors.mjs +755 -569
  142. package/dist/es/state/selectors/barSelectors.mjs +225 -162
  143. package/dist/es/state/selectors/brushSelectors.mjs +15 -14
  144. package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +6 -5
  145. package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +36 -27
  146. package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +5 -3
  147. package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +13 -11
  148. package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +26 -21
  149. package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +10 -6
  150. package/dist/es/state/selectors/common.mjs +2 -2
  151. package/dist/es/state/selectors/containerSelectors.mjs +5 -2
  152. package/dist/es/state/selectors/dataSelectors.mjs +28 -9
  153. package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
  154. package/dist/es/state/selectors/legendSelectors.mjs +7 -6
  155. package/dist/es/state/selectors/lineSelectors.mjs +54 -47
  156. package/dist/es/state/selectors/pickAxisId.mjs +2 -2
  157. package/dist/es/state/selectors/pickAxisType.mjs +2 -2
  158. package/dist/es/state/selectors/pieSelectors.mjs +116 -81
  159. package/dist/es/state/selectors/polarAxisSelectors.mjs +113 -94
  160. package/dist/es/state/selectors/polarGridSelectors.mjs +13 -11
  161. package/dist/es/state/selectors/polarScaleSelectors.mjs +49 -46
  162. package/dist/es/state/selectors/polarSelectors.mjs +79 -62
  163. package/dist/es/state/selectors/radarSelectors.mjs +111 -91
  164. package/dist/es/state/selectors/radialBarSelectors.mjs +230 -183
  165. package/dist/es/state/selectors/rootPropsSelectors.mjs +11 -5
  166. package/dist/es/state/selectors/scatterSelectors.mjs +111 -95
  167. package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +19 -17
  168. package/dist/es/state/selectors/selectAllAxes.mjs +8 -3
  169. package/dist/es/state/selectors/selectChartOffset.mjs +59 -50
  170. package/dist/es/state/selectors/selectChartOffsetInternal.mjs +55 -44
  171. package/dist/es/state/selectors/selectTooltipEventType.mjs +15 -14
  172. package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +3 -3
  173. package/dist/es/state/selectors/selectTooltipSettings.mjs +2 -2
  174. package/dist/es/state/selectors/selectTooltipState.mjs +2 -2
  175. package/dist/es/state/selectors/selectors.mjs +94 -75
  176. package/dist/es/state/selectors/tooltipSelectors.mjs +253 -204
  177. package/dist/es/state/selectors/touchSelectors.mjs +17 -14
  178. package/dist/es/state/store.mjs +46 -46
  179. package/dist/es/state/tooltipSlice.mjs +64 -37
  180. package/dist/es/state/touchEventsMiddleware.mjs +35 -29
  181. package/dist/es/state/utils/useReportScale.mjs +16 -13
  182. package/dist/es/synchronisation/syncSelectors.mjs +3 -3
  183. package/dist/es/synchronisation/useChartSynchronisation.mjs +33 -19
  184. package/dist/es/types/event.mjs +164 -2
  185. package/dist/es/utils/ReduceCSSCalc.mjs +81 -49
  186. package/dist/es/utils/VueUtils.mjs +35 -14
  187. package/dist/es/utils/attrs.mjs +43 -26
  188. package/dist/es/utils/cartesian.mjs +47 -15
  189. package/dist/es/utils/chart.mjs +298 -197
  190. package/dist/es/utils/const.mjs +30 -2
  191. package/dist/es/utils/createContext.mjs +28 -9
  192. package/dist/es/utils/data-utils.mjs +9 -8
  193. package/dist/es/utils/data.mjs +35 -21
  194. package/dist/es/utils/events.mjs +5 -3
  195. package/dist/es/utils/getLinearRegression.mjs +28 -11
  196. package/dist/es/utils/grid.mjs +20 -5
  197. package/dist/es/utils/isDomainSpecifiedByUser.mjs +105 -54
  198. package/dist/es/utils/legend.mjs +13 -12
  199. package/dist/es/utils/log.mjs +10 -7
  200. package/dist/es/utils/payload/getUniqPayload.mjs +6 -4
  201. package/dist/es/utils/polar.mjs +37 -30
  202. package/dist/es/utils/props.mjs +16 -10
  203. package/dist/es/utils/resolveDefaultProps.mjs +23 -4
  204. package/dist/es/utils/scale/getNiceTickValues.mjs +127 -49
  205. package/dist/es/utils/scale/utils/arithmetic.mjs +49 -19
  206. package/dist/es/utils/scale/utils/utils.mjs +43 -24
  207. package/dist/es/utils/style.mjs +24 -13
  208. package/dist/es/utils/tick.mjs +34 -23
  209. package/dist/es/utils/tooltip/translate.mjs +63 -49
  210. package/dist/es/utils/validate.mjs +40 -29
  211. package/dist/hooks/useIsAnimating.d.ts +14 -0
  212. package/dist/shape/Trapezoid.d.ts +31 -0
  213. package/dist/shape/index.d.ts +1 -0
  214. package/dist/state/graphicalItemsSlice.d.ts +1 -1
  215. package/package.json +1 -1
@@ -1,118 +1,134 @@
1
- import { isNullish as e } from "../../utils/validate.mjs";
2
- import { selectChartDataWithIndexesIfNotInPanorama as t } from "./dataSelectors.mjs";
3
- import { getCateCoordinateOfLine as n, getValueByDataKey as r } from "../../utils/chart.mjs";
4
- import { implicitZAxis as i, selectAxisWithScale as a, selectTicksOfGraphicalItem as o, selectUnfilteredCartesianItems as s, selectZAxisWithScale as c } from "./axisSelectors.mjs";
5
- import { toRaw as l } from "vue";
6
- import { createSelector as u } from "@reduxjs/toolkit";
1
+ import { isNullish } from "../../utils/validate.mjs";
2
+ import { selectChartDataWithIndexesIfNotInPanorama } from "./dataSelectors.mjs";
3
+ import { getCateCoordinateOfLine, getValueByDataKey } from "../../utils/chart.mjs";
4
+ import { implicitZAxis, selectAxisWithScale, selectTicksOfGraphicalItem, selectUnfilteredCartesianItems, selectZAxisWithScale } from "./axisSelectors.mjs";
5
+ import { toRaw } from "vue";
6
+ import { createSelector } from "@reduxjs/toolkit";
7
7
  //#region src/state/selectors/scatterSelectors.ts
8
- function d(e, t, n, r, i, o) {
9
- return a(e, "xAxis", t, o);
8
+ function selectXAxisWithScale(state, xAxisId, _yAxisId, _zAxisId, _scatterSettings, isPanorama) {
9
+ return selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
10
10
  }
11
- function f(e, t, n, r, i, a) {
12
- return o(e, "xAxis", t, a);
11
+ function selectXAxisTicks(state, xAxisId, _yAxisId, _zAxisId, _scatterSettings, isPanorama) {
12
+ return selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
13
13
  }
14
- function p(e, t, n, r, i, o) {
15
- return a(e, "yAxis", n, o);
14
+ function selectYAxisWithScale(state, _xAxisId, yAxisId, _zAxisId, _scatterSettings, isPanorama) {
15
+ return selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
16
16
  }
17
- function m(e, t, n, r, i, a) {
18
- return o(e, "yAxis", n, a);
17
+ function selectYAxisTicks(state, _xAxisId, yAxisId, _zAxisId, _scatterSettings, isPanorama) {
18
+ return selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
19
19
  }
20
- function h(e, t, n, r) {
21
- return c(e, "zAxis", r, !1);
20
+ function selectZAxis(state, _xAxisId, _yAxisId, zAxisId) {
21
+ return selectZAxisWithScale(state, "zAxis", zAxisId, false);
22
22
  }
23
- function g(e, t, n, r, i) {
24
- return i;
23
+ function pickScatterSettings(_state, _xAxisId, _yAxisId, _zAxisId, scatterSettings) {
24
+ return scatterSettings;
25
25
  }
26
- function _(e, n, r, i, a, o) {
27
- return t(e, n, r, o);
26
+ function scatterChartDataSelector(state, xAxisId, yAxisId, _zAxisId, _scatterSettings, isPanorama) {
27
+ return selectChartDataWithIndexesIfNotInPanorama(state, xAxisId, yAxisId, isPanorama);
28
28
  }
29
- var v = u([s, g], (e, t) => {
30
- if (e.some((e) => e.type === "scatter" && t.dataKey === e.dataKey && t.data === e.data)) return t;
29
+ var selectSynchronisedScatterSettings = createSelector([selectUnfilteredCartesianItems, pickScatterSettings], (graphicalItems, scatterSettingsFromProps) => {
30
+ if (graphicalItems.some((cgis) => cgis.type === "scatter" && scatterSettingsFromProps.dataKey === cgis.dataKey && scatterSettingsFromProps.data === cgis.data)) return scatterSettingsFromProps;
31
31
  });
32
- function y({ displayedData: t, xAxis: a, yAxis: o, zAxis: s, scatterSettings: c, xAxisTicks: u, yAxisTicks: d }) {
33
- let f = e(a.dataKey) ? c.dataKey : a.dataKey, p = e(o.dataKey) ? c.dataKey : o.dataKey, m = s && s.dataKey, h = s ? s.range : i.range, g = h && h[0], _ = a.scale.bandwidth ? a.scale.bandwidth() : 0, v = o.scale.bandwidth ? o.scale.bandwidth() : 0;
34
- return t.map((t, i) => {
35
- let h = l(t), y = r(h, f), b = r(h, p), x = !e(m) && r(h, m) || "-", S = [{
36
- name: e(a.dataKey) ? c.name : a.name || String(a.dataKey),
37
- unit: a.unit || "",
38
- value: y,
39
- payload: h,
40
- dataKey: f,
41
- type: c.tooltipType
32
+ function computeScatterPoints({ displayedData, xAxis, yAxis, zAxis, scatterSettings, xAxisTicks, yAxisTicks }) {
33
+ const xAxisDataKey = isNullish(xAxis.dataKey) ? scatterSettings.dataKey : xAxis.dataKey;
34
+ const yAxisDataKey = isNullish(yAxis.dataKey) ? scatterSettings.dataKey : yAxis.dataKey;
35
+ const zAxisDataKey = zAxis && zAxis.dataKey;
36
+ const defaultRangeZ = zAxis ? zAxis.range : implicitZAxis.range;
37
+ const defaultZ = defaultRangeZ && defaultRangeZ[0];
38
+ const xBandSize = xAxis.scale.bandwidth ? xAxis.scale.bandwidth() : 0;
39
+ const yBandSize = yAxis.scale.bandwidth ? yAxis.scale.bandwidth() : 0;
40
+ return displayedData.map((rawEntry, index) => {
41
+ const entry = toRaw(rawEntry);
42
+ const x = getValueByDataKey(entry, xAxisDataKey);
43
+ const y = getValueByDataKey(entry, yAxisDataKey);
44
+ const z = !isNullish(zAxisDataKey) && getValueByDataKey(entry, zAxisDataKey) || "-";
45
+ const tooltipPayload = [{
46
+ name: isNullish(xAxis.dataKey) ? scatterSettings.name : xAxis.name || String(xAxis.dataKey),
47
+ unit: xAxis.unit || "",
48
+ value: x,
49
+ payload: entry,
50
+ dataKey: xAxisDataKey,
51
+ type: scatterSettings.tooltipType
42
52
  }, {
43
- name: e(o.dataKey) ? c.name : o.name || String(o.dataKey),
44
- unit: o.unit || "",
45
- value: b,
46
- payload: h,
47
- dataKey: p,
48
- type: c.tooltipType
53
+ name: isNullish(yAxis.dataKey) ? scatterSettings.name : yAxis.name || String(yAxis.dataKey),
54
+ unit: yAxis.unit || "",
55
+ value: y,
56
+ payload: entry,
57
+ dataKey: yAxisDataKey,
58
+ type: scatterSettings.tooltipType
49
59
  }];
50
- x !== "-" && s != null && S.push({
51
- name: s.name || String(s.dataKey),
52
- unit: s.unit || "",
53
- value: x,
54
- payload: h,
55
- dataKey: m,
56
- type: c.tooltipType
60
+ if (z !== "-" && zAxis != null) tooltipPayload.push({
61
+ name: zAxis.name || String(zAxis.dataKey),
62
+ unit: zAxis.unit || "",
63
+ value: z,
64
+ payload: entry,
65
+ dataKey: zAxisDataKey,
66
+ type: scatterSettings.tooltipType
67
+ });
68
+ const cx = getCateCoordinateOfLine({
69
+ axis: xAxis,
70
+ ticks: xAxisTicks,
71
+ bandSize: xBandSize,
72
+ entry,
73
+ index,
74
+ dataKey: xAxisDataKey
75
+ });
76
+ const cy = getCateCoordinateOfLine({
77
+ axis: yAxis,
78
+ ticks: yAxisTicks,
79
+ bandSize: yBandSize,
80
+ entry,
81
+ index,
82
+ dataKey: yAxisDataKey
57
83
  });
58
- let C = n({
59
- axis: a,
60
- ticks: u,
61
- bandSize: _,
62
- entry: h,
63
- index: i,
64
- dataKey: f
65
- }), w = n({
66
- axis: o,
67
- ticks: d,
68
- bandSize: v,
69
- entry: h,
70
- index: i,
71
- dataKey: p
72
- }), T = x !== "-" && s != null ? s.scale(x) : g, E = T == null ? 0 : Math.sqrt(Math.max(T, 0) / Math.PI);
84
+ const size = z !== "-" && zAxis != null ? zAxis.scale(z) : defaultZ;
85
+ const radius = size == null ? 0 : Math.sqrt(Math.max(size, 0) / Math.PI);
73
86
  return {
74
- ...h,
75
- cx: C ?? void 0,
76
- cy: w ?? void 0,
77
- x: C == null ? void 0 : C - E,
78
- y: w == null ? void 0 : w - E,
79
- width: 2 * E,
80
- height: 2 * E,
81
- size: T,
87
+ ...entry,
88
+ cx: cx ?? void 0,
89
+ cy: cy ?? void 0,
90
+ x: cx == null ? void 0 : cx - radius,
91
+ y: cy == null ? void 0 : cy - radius,
92
+ width: 2 * radius,
93
+ height: 2 * radius,
94
+ size,
82
95
  node: {
83
- x: y,
84
- y: b,
85
- z: x
96
+ x,
97
+ y,
98
+ z
86
99
  },
87
- tooltipPayload: S,
100
+ tooltipPayload,
88
101
  tooltipPosition: {
89
- x: C,
90
- y: w
102
+ x: cx,
103
+ y: cy
91
104
  },
92
- payload: h
105
+ payload: entry
93
106
  };
94
107
  });
95
108
  }
96
- var b = u([
97
- _,
98
- d,
99
- f,
100
- p,
101
- m,
102
- h,
103
- v
104
- ], ({ chartData: e, dataStartIndex: t, dataEndIndex: n }, r, i, a, o, s, c) => {
105
- if (c == null) return;
106
- let l;
107
- if (l = c?.data?.length > 0 ? c.data : e?.slice(t, n + 1), !(l == null || r == null || a == null || i?.length === 0 || o?.length === 0)) return y({
108
- displayedData: l,
109
- xAxis: r,
110
- yAxis: a,
111
- zAxis: s,
112
- scatterSettings: c,
113
- xAxisTicks: i,
114
- yAxisTicks: o
109
+ var selectScatterPoints = createSelector([
110
+ scatterChartDataSelector,
111
+ selectXAxisWithScale,
112
+ selectXAxisTicks,
113
+ selectYAxisWithScale,
114
+ selectYAxisTicks,
115
+ selectZAxis,
116
+ selectSynchronisedScatterSettings
117
+ ], ({ chartData, dataStartIndex, dataEndIndex }, xAxis, xAxisTicks, yAxis, yAxisTicks, zAxis, scatterSettings) => {
118
+ if (scatterSettings == null) return;
119
+ let displayedData;
120
+ if (scatterSettings?.data?.length > 0) displayedData = scatterSettings.data;
121
+ else displayedData = chartData?.slice(dataStartIndex, dataEndIndex + 1);
122
+ if (displayedData == null || xAxis == null || yAxis == null || xAxisTicks?.length === 0 || yAxisTicks?.length === 0) return;
123
+ return computeScatterPoints({
124
+ displayedData,
125
+ xAxis,
126
+ yAxis,
127
+ zAxis,
128
+ scatterSettings,
129
+ xAxisTicks,
130
+ yAxisTicks
115
131
  });
116
132
  });
117
133
  //#endregion
118
- export { b as selectScatterPoints };
134
+ export { selectScatterPoints };
@@ -1,18 +1,20 @@
1
- import { selectChartOffset as e } from "./selectChartOffset.mjs";
2
- import { selectChartLayout as t } from "./common.mjs";
3
- import { selectPolarViewBox as n } from "./polarAxisSelectors.mjs";
4
- import { selectTooltipAxisRangeWithReverse as r, selectTooltipAxisTicks as i, selectTooltipAxisType as a } from "./tooltipSelectors.mjs";
5
- import { combineActiveProps as o, selectOrderedTooltipTicks as s } from "./selectors.mjs";
6
- import { createSelector as c } from "@reduxjs/toolkit";
7
- var l = c([
8
- (e, t) => t,
9
- t,
10
- n,
11
- a,
12
- r,
13
- i,
14
- s,
15
- e
16
- ], o);
1
+ import { selectChartOffset } from "./selectChartOffset.mjs";
2
+ import { selectChartLayout } from "./common.mjs";
3
+ import { selectPolarViewBox } from "./polarAxisSelectors.mjs";
4
+ import { selectTooltipAxisRangeWithReverse, selectTooltipAxisTicks, selectTooltipAxisType } from "./tooltipSelectors.mjs";
5
+ import { combineActiveProps, selectOrderedTooltipTicks } from "./selectors.mjs";
6
+ import { createSelector } from "@reduxjs/toolkit";
7
+ //#region src/state/selectors/selectActivePropsFromChartPointer.ts
8
+ var pickChartPointer = (_state, chartPointer) => chartPointer;
9
+ var selectActivePropsFromChartPointer = createSelector([
10
+ pickChartPointer,
11
+ selectChartLayout,
12
+ selectPolarViewBox,
13
+ selectTooltipAxisType,
14
+ selectTooltipAxisRangeWithReverse,
15
+ selectTooltipAxisTicks,
16
+ selectOrderedTooltipTicks,
17
+ selectChartOffset
18
+ ], combineActiveProps);
17
19
  //#endregion
18
- export { l as selectActivePropsFromChartPointer };
20
+ export { selectActivePropsFromChartPointer };
@@ -1,5 +1,10 @@
1
- import { createSelector as e } from "@reduxjs/toolkit";
1
+ import { createSelector } from "@reduxjs/toolkit";
2
2
  //#region src/state/selectors/selectAllAxes.ts
3
- var t = e((e) => e.cartesianAxis.xAxis, (e) => Object.values(e)), n = e((e) => e.cartesianAxis.yAxis, (e) => Object.values(e));
3
+ var selectAllXAxes = createSelector((state) => state.cartesianAxis.xAxis, (xAxisMap) => {
4
+ return Object.values(xAxisMap);
5
+ });
6
+ var selectAllYAxes = createSelector((state) => state.cartesianAxis.yAxis, (yAxisMap) => {
7
+ return Object.values(yAxisMap);
8
+ });
4
9
  //#endregion
5
- export { t as selectAllXAxes, n as selectAllYAxes };
10
+ export { selectAllXAxes, selectAllYAxes };
@@ -1,60 +1,69 @@
1
- import { selectChartHeight as e, selectChartWidth as t, selectMargin as n } from "./containerSelectors.mjs";
2
- import { selectAllXAxes as r, selectAllYAxes as i } from "./selectAllAxes.mjs";
3
- import { selectLegendSettings as a, selectLegendSize as o } from "./legendSelectors.mjs";
4
- import { appendOffsetOfLegend as s } from "../../utils/legend.mjs";
5
- import { createSelector as c } from "@reduxjs/toolkit";
6
- import { get as l } from "lodash-es";
1
+ import { selectChartHeight, selectChartWidth, selectMargin } from "./containerSelectors.mjs";
2
+ import { selectAllXAxes, selectAllYAxes } from "./selectAllAxes.mjs";
3
+ import { selectLegendSettings, selectLegendSize } from "./legendSelectors.mjs";
4
+ import { appendOffsetOfLegend } from "../../utils/legend.mjs";
5
+ import { createSelector } from "@reduxjs/toolkit";
6
+ import { get } from "lodash-es";
7
7
  //#region src/state/selectors/selectChartOffset.ts
8
- var u = (e) => e.brush.height, d = c([
9
- t,
10
- e,
11
- n,
12
- u,
13
- r,
14
- i,
15
- a,
16
- o
17
- ], (e, t, n, r, i, a, o, c) => {
18
- let u = a.reduce((e, t) => {
19
- let { orientation: n } = t;
20
- return !t.mirror && !t.hide ? {
21
- ...e,
22
- [n]: e[n] + t.width
23
- } : e;
8
+ var selectBrushHeight = (state) => state.brush.height;
9
+ var selectChartOffset = createSelector([
10
+ selectChartWidth,
11
+ selectChartHeight,
12
+ selectMargin,
13
+ selectBrushHeight,
14
+ selectAllXAxes,
15
+ selectAllYAxes,
16
+ selectLegendSettings,
17
+ selectLegendSize
18
+ ], (chartWidth, chartHeight, margin, brushHeight, xAxes, yAxes, legendSettings, legendSize) => {
19
+ const offsetH = yAxes.reduce((result, entry) => {
20
+ const { orientation } = entry;
21
+ if (!entry.mirror && !entry.hide) return {
22
+ ...result,
23
+ [orientation]: result[orientation] + entry.width
24
+ };
25
+ return result;
24
26
  }, {
25
- left: n.left || 0,
26
- right: n.right || 0
27
- }), d = {
28
- ...i.reduce((e, t) => {
29
- let { orientation: n } = t;
30
- return !t.mirror && !t.hide ? {
31
- ...e,
32
- [n]: l(e, `${n}`) + t.height
33
- } : e;
27
+ left: margin.left || 0,
28
+ right: margin.right || 0
29
+ });
30
+ let offset = {
31
+ ...xAxes.reduce((result, entry) => {
32
+ const { orientation } = entry;
33
+ if (!entry.mirror && !entry.hide) return {
34
+ ...result,
35
+ [orientation]: get(result, `${orientation}`) + entry.height
36
+ };
37
+ return result;
34
38
  }, {
35
- top: n.top || 0,
36
- bottom: n.bottom || 0
39
+ top: margin.top || 0,
40
+ bottom: margin.bottom || 0
37
41
  }),
38
- ...u
39
- }, f = d.bottom;
40
- d.bottom += r, d = s(d, o, c);
41
- let p = e - d.left - d.right, m = t - d.top - d.bottom;
42
+ ...offsetH
43
+ };
44
+ const brushBottom = offset.bottom;
45
+ offset.bottom += brushHeight;
46
+ offset = appendOffsetOfLegend(offset, legendSettings, legendSize);
47
+ const offsetWidth = chartWidth - offset.left - offset.right;
48
+ const offsetHeight = chartHeight - offset.top - offset.bottom;
42
49
  return {
43
- brushBottom: f,
44
- ...d,
45
- width: Math.max(p, 0),
46
- height: Math.max(m, 0)
50
+ brushBottom,
51
+ ...offset,
52
+ width: Math.max(offsetWidth, 0),
53
+ height: Math.max(offsetHeight, 0)
47
54
  };
48
- }), f = c(d, (e) => ({
49
- x: e.left,
50
- y: e.top,
51
- width: e.width,
52
- height: e.height
53
- })), p = c(t, e, (e, t) => ({
55
+ });
56
+ var selectChartViewBox = createSelector(selectChartOffset, (offset) => ({
57
+ x: offset.left,
58
+ y: offset.top,
59
+ width: offset.width,
60
+ height: offset.height
61
+ }));
62
+ var selectAxisViewBox = createSelector(selectChartWidth, selectChartHeight, (width, height) => ({
54
63
  x: 0,
55
64
  y: 0,
56
- width: e,
57
- height: t
65
+ width,
66
+ height
58
67
  }));
59
68
  //#endregion
60
- export { p as selectAxisViewBox, u as selectBrushHeight, d as selectChartOffset, f as selectChartViewBox };
69
+ export { selectAxisViewBox, selectBrushHeight, selectChartOffset, selectChartViewBox };
@@ -1,55 +1,66 @@
1
- import { selectChartHeight as e, selectChartWidth as t, selectMargin as n } from "./containerSelectors.mjs";
2
- import { selectAllXAxes as r, selectAllYAxes as i } from "./selectAllAxes.mjs";
3
- import { selectLegendSettings as a, selectLegendSize as o } from "./legendSelectors.mjs";
4
- import { appendOffsetOfLegend as s } from "../../utils/legend.mjs";
5
- import { selectBrushHeight as c } from "./selectChartOffset.mjs";
6
- import { get as l } from "es-toolkit/compat";
7
- import { createSelector as u } from "@reduxjs/toolkit";
1
+ import { selectChartHeight, selectChartWidth, selectMargin } from "./containerSelectors.mjs";
2
+ import { selectAllXAxes, selectAllYAxes } from "./selectAllAxes.mjs";
3
+ import { selectLegendSettings, selectLegendSize } from "./legendSelectors.mjs";
4
+ import { appendOffsetOfLegend } from "../../utils/legend.mjs";
5
+ import { selectBrushHeight } from "./selectChartOffset.mjs";
6
+ import { get } from "es-toolkit/compat";
7
+ import { createSelector } from "@reduxjs/toolkit";
8
8
  //#region src/state/selectors/selectChartOffsetInternal.ts
9
- var d = u([
10
- t,
11
- e,
12
- n,
13
- c,
14
- r,
15
- i,
16
- a,
17
- o
18
- ], (e, t, n, r, i, a, o, c) => {
19
- let u = a.reduce((e, t) => {
20
- let { orientation: n } = t;
21
- if (!t.mirror && !t.hide) {
22
- let r = typeof t.width == "number" ? t.width : 60;
9
+ /**
10
+ * For internal use only.
11
+ *
12
+ * @param root state
13
+ * @return ChartOffsetInternal
14
+ */
15
+ var selectChartOffsetInternal = createSelector([
16
+ selectChartWidth,
17
+ selectChartHeight,
18
+ selectMargin,
19
+ selectBrushHeight,
20
+ selectAllXAxes,
21
+ selectAllYAxes,
22
+ selectLegendSettings,
23
+ selectLegendSize
24
+ ], (chartWidth, chartHeight, margin, brushHeight, xAxes, yAxes, legendSettings, legendSize) => {
25
+ const offsetH = yAxes.reduce((result, entry) => {
26
+ const { orientation } = entry;
27
+ if (!entry.mirror && !entry.hide) {
28
+ const width = typeof entry.width === "number" ? entry.width : 60;
23
29
  return {
24
- ...e,
25
- [n]: e[n] + r
30
+ ...result,
31
+ [orientation]: result[orientation] + width
26
32
  };
27
33
  }
28
- return e;
34
+ return result;
29
35
  }, {
30
- left: n.left || 0,
31
- right: n.right || 0
32
- }), d = {
33
- ...i.reduce((e, t) => {
34
- let { orientation: n } = t;
35
- return !t.mirror && !t.hide ? {
36
- ...e,
37
- [n]: l(e, `${n}`) + t.height
38
- } : e;
36
+ left: margin.left || 0,
37
+ right: margin.right || 0
38
+ });
39
+ let offset = {
40
+ ...xAxes.reduce((result, entry) => {
41
+ const { orientation } = entry;
42
+ if (!entry.mirror && !entry.hide) return {
43
+ ...result,
44
+ [orientation]: get(result, `${orientation}`) + entry.height
45
+ };
46
+ return result;
39
47
  }, {
40
- top: n.top || 0,
41
- bottom: n.bottom || 0
48
+ top: margin.top || 0,
49
+ bottom: margin.bottom || 0
42
50
  }),
43
- ...u
44
- }, f = d.bottom;
45
- d.bottom += r, d = s(d, o, c);
46
- let p = e - d.left - d.right, m = t - d.top - d.bottom;
51
+ ...offsetH
52
+ };
53
+ const brushBottom = offset.bottom;
54
+ offset.bottom += brushHeight;
55
+ offset = appendOffsetOfLegend(offset, legendSettings, legendSize);
56
+ const offsetWidth = chartWidth - offset.left - offset.right;
57
+ const offsetHeight = chartHeight - offset.top - offset.bottom;
47
58
  return {
48
- brushBottom: f,
49
- ...d,
50
- width: Math.max(p, 0),
51
- height: Math.max(m, 0)
59
+ brushBottom,
60
+ ...offset,
61
+ width: Math.max(offsetWidth, 0),
62
+ height: Math.max(offsetHeight, 0)
52
63
  };
53
64
  });
54
65
  //#endregion
55
- export { d as selectChartOffsetInternal };
66
+ export { selectChartOffsetInternal };
@@ -1,21 +1,22 @@
1
- import { useAppSelector as e } from "../hooks.mjs";
1
+ import { useAppSelector } from "../hooks.mjs";
2
2
  //#region src/state/selectors/selectTooltipEventType.ts
3
- function t(e) {
4
- return e.options.defaultTooltipEventType;
3
+ function selectDefaultTooltipEventType(state) {
4
+ return state.options.defaultTooltipEventType;
5
5
  }
6
- function n(e) {
7
- return e.options.validateTooltipEventTypes;
6
+ function selectValidateTooltipEventTypes(state) {
7
+ return state.options.validateTooltipEventTypes;
8
8
  }
9
- function r(e, t, n) {
10
- if (e == null) return t;
11
- let r = e ? "axis" : "item";
12
- return n == null ? t : n.includes(r) ? r : t;
9
+ function combineTooltipEventType(shared, defaultTooltipEventType, validateTooltipEventTypes) {
10
+ if (shared == null) return defaultTooltipEventType;
11
+ const eventType = shared ? "axis" : "item";
12
+ if (validateTooltipEventTypes == null) return defaultTooltipEventType;
13
+ return validateTooltipEventTypes.includes(eventType) ? eventType : defaultTooltipEventType;
13
14
  }
14
- function i(e, i) {
15
- return r(i, t(e), n(e));
15
+ function selectTooltipEventType(state, shared) {
16
+ return combineTooltipEventType(shared, selectDefaultTooltipEventType(state), selectValidateTooltipEventTypes(state));
16
17
  }
17
- function a(t) {
18
- return e((e) => i(e, t));
18
+ function useTooltipEventType(shared) {
19
+ return useAppSelector((state) => selectTooltipEventType(state, shared));
19
20
  }
20
21
  //#endregion
21
- export { r as combineTooltipEventType, t as selectDefaultTooltipEventType, i as selectTooltipEventType, n as selectValidateTooltipEventTypes, a as useTooltipEventType };
22
+ export { combineTooltipEventType, selectDefaultTooltipEventType, selectTooltipEventType, selectValidateTooltipEventTypes, useTooltipEventType };
@@ -1,6 +1,6 @@
1
1
  //#region src/state/selectors/selectTooltipPayloadSearcher.ts
2
- function e(e) {
3
- return e.options.tooltipPayloadSearcher;
2
+ function selectTooltipPayloadSearcher(state) {
3
+ return state.options.tooltipPayloadSearcher;
4
4
  }
5
5
  //#endregion
6
- export { e as selectTooltipPayloadSearcher };
6
+ export { selectTooltipPayloadSearcher };
@@ -1,4 +1,4 @@
1
1
  //#region src/state/selectors/selectTooltipSettings.ts
2
- var e = (e) => e.tooltip.settings;
2
+ var selectTooltipSettings = (state) => state.tooltip.settings;
3
3
  //#endregion
4
- export { e as selectTooltipSettings };
4
+ export { selectTooltipSettings };
@@ -1,4 +1,4 @@
1
1
  //#region src/state/selectors/selectTooltipState.ts
2
- var e = (e) => e.tooltip;
2
+ var selectTooltipState = (state) => state.tooltip;
3
3
  //#endregion
4
- export { e as selectTooltipState };
4
+ export { selectTooltipState };