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,118 +1,134 @@
|
|
|
1
|
-
import { isNullish
|
|
2
|
-
import { selectChartDataWithIndexesIfNotInPanorama
|
|
3
|
-
import { getCateCoordinateOfLine
|
|
4
|
-
import { implicitZAxis
|
|
5
|
-
import { toRaw
|
|
6
|
-
import { createSelector
|
|
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
|
|
9
|
-
return
|
|
8
|
+
function selectXAxisWithScale(state, xAxisId, _yAxisId, _zAxisId, _scatterSettings, isPanorama) {
|
|
9
|
+
return selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function selectXAxisTicks(state, xAxisId, _yAxisId, _zAxisId, _scatterSettings, isPanorama) {
|
|
12
|
+
return selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function selectYAxisWithScale(state, _xAxisId, yAxisId, _zAxisId, _scatterSettings, isPanorama) {
|
|
15
|
+
return selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function selectYAxisTicks(state, _xAxisId, yAxisId, _zAxisId, _scatterSettings, isPanorama) {
|
|
18
|
+
return selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function selectZAxis(state, _xAxisId, _yAxisId, zAxisId) {
|
|
21
|
+
return selectZAxisWithScale(state, "zAxis", zAxisId, false);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function pickScatterSettings(_state, _xAxisId, _yAxisId, _zAxisId, scatterSettings) {
|
|
24
|
+
return scatterSettings;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function scatterChartDataSelector(state, xAxisId, yAxisId, _zAxisId, _scatterSettings, isPanorama) {
|
|
27
|
+
return selectChartDataWithIndexesIfNotInPanorama(state, xAxisId, yAxisId, isPanorama);
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
if (
|
|
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
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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:
|
|
44
|
-
unit:
|
|
45
|
-
value:
|
|
46
|
-
payload:
|
|
47
|
-
dataKey:
|
|
48
|
-
type:
|
|
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
|
-
|
|
51
|
-
name:
|
|
52
|
-
unit:
|
|
53
|
-
value:
|
|
54
|
-
payload:
|
|
55
|
-
dataKey:
|
|
56
|
-
type:
|
|
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
|
-
|
|
59
|
-
|
|
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
|
-
...
|
|
75
|
-
cx:
|
|
76
|
-
cy:
|
|
77
|
-
x:
|
|
78
|
-
y:
|
|
79
|
-
width: 2 *
|
|
80
|
-
height: 2 *
|
|
81
|
-
size
|
|
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
|
|
84
|
-
y
|
|
85
|
-
z
|
|
96
|
+
x,
|
|
97
|
+
y,
|
|
98
|
+
z
|
|
86
99
|
},
|
|
87
|
-
tooltipPayload
|
|
100
|
+
tooltipPayload,
|
|
88
101
|
tooltipPosition: {
|
|
89
|
-
x:
|
|
90
|
-
y:
|
|
102
|
+
x: cx,
|
|
103
|
+
y: cy
|
|
91
104
|
},
|
|
92
|
-
payload:
|
|
105
|
+
payload: entry
|
|
93
106
|
};
|
|
94
107
|
});
|
|
95
108
|
}
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
], ({ chartData
|
|
105
|
-
if (
|
|
106
|
-
let
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 {
|
|
134
|
+
export { selectScatterPoints };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { selectChartOffset
|
|
2
|
-
import { selectChartLayout
|
|
3
|
-
import { selectPolarViewBox
|
|
4
|
-
import { selectTooltipAxisRangeWithReverse
|
|
5
|
-
import { combineActiveProps
|
|
6
|
-
import { createSelector
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
20
|
+
export { selectActivePropsFromChartPointer };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { createSelector
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
2
2
|
//#region src/state/selectors/selectAllAxes.ts
|
|
3
|
-
var
|
|
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 {
|
|
10
|
+
export { selectAllXAxes, selectAllYAxes };
|
|
@@ -1,60 +1,69 @@
|
|
|
1
|
-
import { selectChartHeight
|
|
2
|
-
import { selectAllXAxes
|
|
3
|
-
import { selectLegendSettings
|
|
4
|
-
import { appendOffsetOfLegend
|
|
5
|
-
import { createSelector
|
|
6
|
-
import { get
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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:
|
|
26
|
-
right:
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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:
|
|
36
|
-
bottom:
|
|
39
|
+
top: margin.top || 0,
|
|
40
|
+
bottom: margin.bottom || 0
|
|
37
41
|
}),
|
|
38
|
-
...
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
44
|
-
...
|
|
45
|
-
width: Math.max(
|
|
46
|
-
height: Math.max(
|
|
50
|
+
brushBottom,
|
|
51
|
+
...offset,
|
|
52
|
+
width: Math.max(offsetWidth, 0),
|
|
53
|
+
height: Math.max(offsetHeight, 0)
|
|
47
54
|
};
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
57
|
-
height
|
|
65
|
+
width,
|
|
66
|
+
height
|
|
58
67
|
}));
|
|
59
68
|
//#endregion
|
|
60
|
-
export {
|
|
69
|
+
export { selectAxisViewBox, selectBrushHeight, selectChartOffset, selectChartViewBox };
|
|
@@ -1,55 +1,66 @@
|
|
|
1
|
-
import { selectChartHeight
|
|
2
|
-
import { selectAllXAxes
|
|
3
|
-
import { selectLegendSettings
|
|
4
|
-
import { appendOffsetOfLegend
|
|
5
|
-
import { selectBrushHeight
|
|
6
|
-
import { get
|
|
7
|
-
import { createSelector
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
...
|
|
25
|
-
[
|
|
30
|
+
...result,
|
|
31
|
+
[orientation]: result[orientation] + width
|
|
26
32
|
};
|
|
27
33
|
}
|
|
28
|
-
return
|
|
34
|
+
return result;
|
|
29
35
|
}, {
|
|
30
|
-
left:
|
|
31
|
-
right:
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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:
|
|
41
|
-
bottom:
|
|
48
|
+
top: margin.top || 0,
|
|
49
|
+
bottom: margin.bottom || 0
|
|
42
50
|
}),
|
|
43
|
-
...
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
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
|
|
49
|
-
...
|
|
50
|
-
width: Math.max(
|
|
51
|
-
height: Math.max(
|
|
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 {
|
|
66
|
+
export { selectChartOffsetInternal };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { useAppSelector
|
|
1
|
+
import { useAppSelector } from "../hooks.mjs";
|
|
2
2
|
//#region src/state/selectors/selectTooltipEventType.ts
|
|
3
|
-
function
|
|
4
|
-
return
|
|
3
|
+
function selectDefaultTooltipEventType(state) {
|
|
4
|
+
return state.options.defaultTooltipEventType;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
6
|
+
function selectValidateTooltipEventTypes(state) {
|
|
7
|
+
return state.options.validateTooltipEventTypes;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
15
|
-
return
|
|
15
|
+
function selectTooltipEventType(state, shared) {
|
|
16
|
+
return combineTooltipEventType(shared, selectDefaultTooltipEventType(state), selectValidateTooltipEventTypes(state));
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
18
|
+
function useTooltipEventType(shared) {
|
|
19
|
+
return useAppSelector((state) => selectTooltipEventType(state, shared));
|
|
19
20
|
}
|
|
20
21
|
//#endregion
|
|
21
|
-
export {
|
|
22
|
+
export { combineTooltipEventType, selectDefaultTooltipEventType, selectTooltipEventType, selectValidateTooltipEventTypes, useTooltipEventType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/state/selectors/selectTooltipPayloadSearcher.ts
|
|
2
|
-
function
|
|
3
|
-
return
|
|
2
|
+
function selectTooltipPayloadSearcher(state) {
|
|
3
|
+
return state.options.tooltipPayloadSearcher;
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { selectTooltipPayloadSearcher };
|