solid-recharts 0.1.0 → 0.2.1
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/LICENSE +24 -0
- package/package.json +10 -7
- package/src/cartesian/Area.tsx +40 -55
- package/src/cartesian/Bar.tsx +66 -58
- package/src/cartesian/BarStack.tsx +5 -2
- package/src/cartesian/Brush.tsx +1 -1
- package/src/cartesian/Funnel.tsx +15 -19
- package/src/cartesian/Line.tsx +34 -51
- package/src/cartesian/LineDrawShape.tsx +8 -6
- package/src/cartesian/ReferenceArea.tsx +25 -35
- package/src/cartesian/ReferenceDot.tsx +24 -34
- package/src/cartesian/ReferenceLine.tsx +25 -34
- package/src/cartesian/Scatter.tsx +25 -37
- package/src/cartesian/XAxis.tsx +54 -67
- package/src/cartesian/YAxis.tsx +53 -66
- package/src/cartesian/ZAxis.tsx +27 -40
- package/src/chart/SunburstChart.tsx +1 -1
- package/src/component/ActivePoints.tsx +0 -9
- package/src/component/Customized.tsx +1 -1
- package/src/component/Dots.tsx +7 -3
- package/src/context/ErrorBarContext.tsx +15 -24
- package/src/polar/Pie.tsx +36 -48
- package/src/polar/PolarAngleAxis.tsx +41 -50
- package/src/polar/PolarRadiusAxis.tsx +40 -48
- package/src/polar/Radar.tsx +22 -34
- package/src/polar/RadialBar.tsx +21 -39
- package/src/shape/Curve.tsx +1 -1
- package/src/shape/Symbols.tsx +1 -1
- package/src/state/RechartsReduxContext.tsx +1 -1
- package/src/state/SetLegendPayload.ts +19 -27
- package/src/state/SetTooltipEntrySettings.tsx +9 -26
- package/src/state/cartesianAxisSlice.ts +40 -60
- package/src/state/createCollectionActions.ts +51 -0
- package/src/state/createSelector.ts +97 -0
- package/src/state/externalEventsMiddleware.ts +2 -11
- package/src/state/graphicalItemsSlice.ts +27 -40
- package/src/state/isEventThrottled.ts +12 -0
- package/src/state/keyboardEventsMiddleware.ts +2 -8
- package/src/state/layoutSlice.ts +8 -4
- package/src/state/legendSlice.ts +24 -26
- package/src/state/mouseEventsMiddleware.ts +2 -13
- package/src/state/patched.ts +19 -0
- package/src/state/referenceElementsSlice.ts +40 -31
- package/src/state/registerInStore.ts +68 -0
- package/src/state/selectors/areaSelectors.ts +13 -36
- package/src/state/selectors/arrayEqualityCheck.ts +32 -7
- package/src/state/selectors/axisSelectors.ts +215 -169
- package/src/state/selectors/barSelectors.ts +8 -36
- package/src/state/selectors/combiners/combineConfiguredScale.ts +1 -1
- package/src/state/selectors/combiners/combineRealScaleType.ts +1 -1
- package/src/state/selectors/dataSelectors.ts +35 -16
- package/src/state/selectors/numberDomainEqualityCheck.ts +16 -8
- package/src/state/selectors/selectAxisForGraphicalItem.ts +52 -0
- package/src/state/store.ts +0 -1
- package/src/state/tooltipSlice.ts +93 -64
- package/src/util/ActiveShapeUtils.tsx +0 -7
- package/src/util/BarUtils.tsx +27 -22
- package/src/util/ChartUtils.ts +69 -25
- package/src/util/propsAreEqual.ts +3 -33
- package/src/util/stacks/stackTypes.ts +1 -1
- package/src/util/types.ts +2 -2
- package/test/animation/CSSTransitionAnimate.timing.spec.tsx +1 -1
- package/test/animation/JavascriptAnimate.spec.tsx +1 -1
- package/test/animation/legacyAnimationLengthChange.spec.tsx +1 -1
- package/test/cartesian/Area.animation.spec.tsx +1 -1
- package/test/cartesian/Area.range.spec.tsx +1 -1
- package/test/cartesian/Area.spec.tsx +1 -1
- package/test/cartesian/Area.stacked.render.spec.tsx +1 -1
- package/test/cartesian/Area.typed.spec.tsx +1 -1
- package/test/cartesian/Axis.integration.spec.tsx +1 -1
- package/test/cartesian/Bar/Bar.csstransition.spec.tsx +1 -1
- package/test/cartesian/Bar/Bar.spec.tsx +1 -1
- package/test/cartesian/Bar/Bar.typed.spec.tsx +1 -1
- package/test/cartesian/Bar.animation.spec.tsx +1 -1
- package/test/cartesian/Bar.stackDomain.spec.tsx +1 -1
- package/test/cartesian/Bar.stacked.render.spec.tsx +1 -1
- package/test/cartesian/Bar.zeroDimensionFiltering.spec.tsx +1 -1
- package/test/cartesian/Brush.keyboard.spec.tsx +1 -1
- package/test/cartesian/Brush.panorama.spec.tsx +1 -1
- package/test/cartesian/Brush.props.spec.tsx +1 -1
- package/test/cartesian/Brush.render.spec.tsx +1 -1
- package/test/cartesian/Brush.spec.tsx +1 -1
- package/test/cartesian/Brush.stacked.spec.tsx +1 -1
- package/test/cartesian/CartesianAxis.render.spec.tsx +1 -1
- package/test/cartesian/CartesianAxis.spec.tsx +2 -2
- package/test/cartesian/CartesianGrid.render.spec.tsx +1 -1
- package/test/cartesian/CartesianGrid.spec.tsx +1 -1
- package/test/cartesian/ErrorBar.render.spec.tsx +1 -1
- package/test/cartesian/ErrorBar.spec.tsx +1 -1
- package/test/cartesian/Funnel.animation.spec.tsx +1 -1
- package/test/cartesian/Funnel.spec.tsx +1 -1
- package/test/cartesian/Funnel.typed.spec.tsx +1 -1
- package/test/cartesian/GraphicalItemClipPath.scale-behavior.spec.tsx +2 -2
- package/test/cartesian/Line.animation.spec.tsx +1 -1
- package/test/cartesian/Line.sparseAnimationPath.spec.tsx +1 -1
- package/test/cartesian/Line.spec.tsx +1 -1
- package/test/cartesian/Line.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceArea.render.spec.tsx +1 -1
- package/test/cartesian/ReferenceArea.spec.tsx +1 -1
- package/test/cartesian/ReferenceArea.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceDot.render.spec.tsx +1 -1
- package/test/cartesian/ReferenceDot.spec.tsx +1 -1
- package/test/cartesian/ReferenceDot.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/ReferenceLine.panorama.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/ReferenceLine.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/ReferenceLine.typed.spec.tsx +1 -1
- package/test/cartesian/ReferenceLine/getEndPoints.spec.ts +1 -1
- package/test/cartesian/ReferenceLine.render.spec.tsx +1 -1
- package/test/cartesian/Scatter.animation.spec.tsx +1 -1
- package/test/cartesian/Scatter.render.spec.tsx +1 -1
- package/test/cartesian/Scatter.spec.tsx +1 -1
- package/test/cartesian/Scatter.typed.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.barSize.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.brush.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.categorydomain.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.datatypes.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.hide.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.multiaxis.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.numberdomain.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.padding.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.padding_clip.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.state.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.tick.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.timescale.spec.tsx +2 -2
- package/test/cartesian/XAxis/XAxis.typed.spec.tsx +1 -1
- package/test/cartesian/XAxis/XAxis.vertical.spec.tsx +1 -1
- package/test/cartesian/XAxis.tickFormatter.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.7362.derivedDomain.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.interval-zero.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.label.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.tick.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.tickFormatter.spec.tsx +1 -1
- package/test/cartesian/YAxis/YAxis.typed.spec.tsx +1 -1
- package/test/cartesian/ZAxis.spec.tsx +1 -1
- package/test/cartesian/ZAxis.typed.spec.tsx +1 -1
- package/test/cartesian/axisLineAndStroke.spec.tsx +1 -1
- package/test/cartesian/miscFeatureGaps.spec.tsx +1 -1
- package/test/chart/AccessibilityLayer.spec.tsx +1 -1
- package/test/chart/AccessibilityScans.spec.tsx +2 -2
- package/test/chart/AreaChart.spec.tsx +1 -1
- package/test/chart/AreaChart.typed.spec.tsx +1 -1
- package/test/chart/BarChart.spec.tsx +1 -1
- package/test/chart/BarChart.typed.spec.tsx +1 -1
- package/test/chart/CategoricalChart.spec.tsx +1 -1
- package/test/chart/ComposedChart.spec.tsx +1 -1
- package/test/chart/ComposedChart.typed.spec.tsx +1 -1
- package/test/chart/FunnelChart.spec.tsx +1 -1
- package/test/chart/FunnelChart.typed.spec.tsx +1 -1
- package/test/chart/LineChart.smoke.spec.tsx +1 -1
- package/test/chart/LineChart.spec.tsx +1 -1
- package/test/chart/LineChart.typed.spec.tsx +1 -1
- package/test/chart/NicheChartTooltip.spec.tsx +1 -1
- package/test/chart/PieChart.spec.tsx +1 -1
- package/test/chart/PieChart.typed.spec.tsx +1 -1
- package/test/chart/RadarChart.spec.tsx +1 -1
- package/test/chart/RadarChart.typed.spec.tsx +1 -1
- package/test/chart/RadialBarChart.spec.tsx +1 -1
- package/test/chart/RadialBarChart.typed.spec.tsx +1 -1
- package/test/chart/RechartsWrapper.spec.tsx +1 -1
- package/test/chart/Sankey.content.spec.tsx +1 -1
- package/test/chart/Sankey.spec.tsx +1 -1
- package/test/chart/ScatterChart.spec.tsx +1 -1
- package/test/chart/ScatterChart.typed.spec.tsx +1 -1
- package/test/chart/SunburstChart.spec.tsx +1 -1
- package/test/chart/Treemap.animation.spec.tsx +1 -1
- package/test/chart/Treemap.spec.tsx +1 -1
- package/test/chart/chartEvents.spec.tsx +1 -1
- package/test/chart/responsive.spec.tsx +1 -1
- package/test/component/Cell.render.spec.tsx +1 -1
- package/test/component/Cell.spec.tsx +1 -1
- package/test/component/Cursor.spec.tsx +1 -1
- package/test/component/DefaultTooltipContent.spec.tsx +1 -1
- package/test/component/Label.render.spec.tsx +1 -1
- package/test/component/Label.spec.tsx +1 -1
- package/test/component/LabelList.spec.tsx +1 -1
- package/test/component/Legend.itemSorter.spec.tsx +1 -1
- package/test/component/Legend.render.spec.tsx +1 -1
- package/test/component/Legend.spec.tsx +1 -1
- package/test/component/ResponsiveContainer.spec.tsx +1 -1
- package/test/component/ResponsiveContainerDataTest.spec.tsx +1 -1
- package/test/component/Text.spec.tsx +1 -1
- package/test/component/Tooltip/ActiveDot.spec.tsx +1 -1
- package/test/component/Tooltip/tooltipEventType.spec.tsx +1 -1
- package/test/component/Tooltip/tooltipTestHelpers.tsx +1 -1
- package/test/component/Tooltip.defaultIndex.spec.tsx +1 -1
- package/test/component/Tooltip.hover.spec.tsx +1 -1
- package/test/component/Tooltip.item.spec.tsx +1 -1
- package/test/component/Tooltip.keyboard.spec.tsx +1 -1
- package/test/component/Tooltip.payload.spec.tsx +1 -1
- package/test/component/Tooltip.touch.spec.tsx +1 -1
- package/test/component/Tooltip.visibility.spec.tsx +1 -1
- package/test/component/TooltipBoundingBox.spec.tsx +2 -2
- package/test/container/ClipPath.spec.tsx +1 -1
- package/test/context/chartLayoutContext.spec.tsx +1 -1
- package/test/helper/createSelectorTestCase.tsx +1 -1
- package/test/helper/mockAxes.ts +1 -1
- package/test/helper/selectorTestHelpers.tsx +1 -1
- package/test/hooks/useActiveTooltipDataPoints.spec.tsx +1 -1
- package/test/hooks/useOffset.spec.tsx +1 -1
- package/test/hooks/useTooltipStateHooks.spec.tsx +1 -1
- package/test/polar/Pie/Pie-TwoLevelPieChart.spec.tsx +1 -1
- package/test/polar/Pie/Pie.spec.tsx +1 -1
- package/test/polar/Pie/Pie.typed.spec.tsx +1 -1
- package/test/polar/Pie.animation.spec.tsx +1 -1
- package/test/polar/PieWithLegend.animation.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis/PolarAngleAxis.events.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis/PolarAngleAxis.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis/PolarAngleAxis.typed.spec.tsx +1 -1
- package/test/polar/PolarAngleAxis.render.spec.tsx +1 -1
- package/test/polar/PolarGrid.render.spec.tsx +1 -1
- package/test/polar/PolarGrid.spec.tsx +1 -1
- package/test/polar/PolarLegendPerRow.render.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.events.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.render.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.spec.tsx +1 -1
- package/test/polar/PolarRadiusAxis.typed.spec.tsx +1 -1
- package/test/polar/PolarTooltipLegend.render.spec.tsx +1 -1
- package/test/polar/Radar.animation.spec.tsx +1 -1
- package/test/polar/Radar.render.spec.tsx +1 -1
- package/test/polar/Radar.spec.tsx +1 -1
- package/test/polar/Radar.typed.spec.tsx +1 -1
- package/test/polar/RadialBar/RadialBar.spec.tsx +1 -1
- package/test/polar/RadialBar/RadialBar.typed.spec.tsx +1 -1
- package/test/polar/RadialBar.animation.spec.tsx +1 -1
- package/test/polar/RadialBar.render.spec.tsx +1 -1
- package/test/polar/RadialBar.stacked.spec.tsx +1 -1
- package/test/setup.ts +1 -1
- package/test/shape/ActiveShape.spec.tsx +1 -1
- package/test/shape/Cross.spec.tsx +1 -1
- package/test/shape/Curve.spec.tsx +2 -2
- package/test/shape/Curve.typed.spec.tsx +1 -1
- package/test/shape/Dot.spec.tsx +1 -1
- package/test/shape/Polygon.spec.tsx +1 -1
- package/test/shape/Rectangle.animation.spec.tsx +1 -1
- package/test/shape/Rectangle.spec.tsx +1 -1
- package/test/shape/Sector.spec.tsx +1 -1
- package/test/shape/Symbols.spec.tsx +1 -1
- package/test/shape/Trapezoid.spec.tsx +1 -1
- package/test/state/createCollectionActions.spec.ts +87 -0
- package/test/state/createSelector.spec.ts +158 -0
- package/test/state/hooks.spec.tsx +1 -1
- package/test/state/registerInStore.spec.tsx +101 -0
- package/test/state/selectors/axisSelectors.spec.tsx +1 -1
- package/test/state/selectors/combiners/combineConfiguredScale.spec.ts +1 -1
- package/test/state/selectors/combiners/combineRealScaleType.spec.ts +1 -1
- package/test/state/selectors/dataSelectors.spec.tsx +1 -1
- package/test/state/selectors/legendSelectors.spec.tsx +1 -1
- package/test/state/selectors/radarSelectors.spec.tsx +1 -1
- package/test/state/selectors/selectActiveTooltipIndex.spec.tsx +1 -1
- package/test/state/selectors/selectDisplayedData.spec.tsx +1 -1
- package/test/state/selectors/selectStackGroups.spec.tsx +1 -1
- package/test/state/selectors/selectorMemoization.spec.tsx +136 -0
- package/test/state/selectors/selectors.spec.tsx +1 -1
- package/test/util/CartesianUtils/CartesianUtils.spec.ts +1 -1
- package/test/util/ChartUtils/ChartUtils.spec.ts +1 -1
- package/test/util/ChartUtils/getCateCoordinateOfLine.spec.ts +14 -0
- package/test/util/ChartUtils/getStackedData.spec.ts +1 -1
- package/test/util/ChartUtils/truncateByDomain.spec.ts +1 -1
- package/test/util/DomUtils.spec.tsx +1 -1
- package/test/util/FunnelUtils.spec.tsx +1 -1
- package/test/util/scale/createCategoricalInverse.spec.ts +1 -1
- package/test/util/useElementOffset.spec.tsx +1 -1
- package/test/util/usePrefersReducedMotion.spec.ts +1 -1
- package/test/util/useUniqueId.spec.ts +1 -1
- package/test/zIndex/AllZIndexPortals.spec.tsx +1 -1
- package/test/zIndex/DynamicZIndex.spec.tsx +1 -1
- package/test/zIndex/ZIndexLayer.portalOwner.spec.tsx +1 -1
- package/test/zIndex/componentZIndex.spec.tsx +1 -1
- package/test/zIndex/multiChartZIndexIsolation.spec.tsx +1 -1
- package/test-results/.last-run.json +4 -0
- package/NEXT_SESSION_PROMPT.md +0 -114
- package/src/state/reduxDevtoolsJsonStringifyReplacer.ts +0 -15
- package/src/util/axisPropsAreEqual.ts +0 -42
- package/src/util/resolveDefaultProps.tsx +0 -8
- package/src/util/typedDataKey.ts +0 -8
- package/test/helper/render.ts +0 -7
- package/test/state/reduxDevtoolsJsonStringifyReplacer.spec.ts +0 -25
- package/test/util/axisPropsAreEqual.spec.ts +0 -93
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// - PERMANENT-N/A (by design, NOT deferred): the custom-element `shape` branch
|
|
17
17
|
// (React.cloneElement — use the render-function form). <Label>
|
|
18
18
|
// CHILDREN are not rendered (the `label` prop is).
|
|
19
|
-
import {
|
|
19
|
+
import { createMemo, merge, Show } from "solid-js";
|
|
20
20
|
import type { JSX } from "@solidjs/web";
|
|
21
21
|
import { Layer } from "../container/Layer";
|
|
22
22
|
import {
|
|
@@ -41,7 +41,7 @@ import { CartesianScaleHelperImpl } from "../util/scale/CartesianScaleHelper";
|
|
|
41
41
|
import type { AxisId } from "../state/cartesianAxisSlice";
|
|
42
42
|
import { DefaultZIndexes } from "../zIndex/DefaultZIndexes";
|
|
43
43
|
import { ZIndexLayer } from "../zIndex/ZIndexLayer";
|
|
44
|
-
import {
|
|
44
|
+
import { registerInStore } from "../state/registerInStore";
|
|
45
45
|
|
|
46
46
|
type ReferenceCoordinateValue = number | string;
|
|
47
47
|
|
|
@@ -124,39 +124,29 @@ const renderRect = (option: ReferenceAreaProps["shape"], props: RectangleProps):
|
|
|
124
124
|
|
|
125
125
|
function ReportReferenceArea(props: ReferenceAreaSettings): JSX.Element {
|
|
126
126
|
const store = useAppStore();
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
prev = settings;
|
|
151
|
-
},
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
unregisterOnCleanup(() => {
|
|
155
|
-
if (prev && store != null) {
|
|
156
|
-
store.actions.referenceElements.removeArea(prev);
|
|
157
|
-
prev = null;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
127
|
+
if (store != null) {
|
|
128
|
+
registerInStore<ReferenceAreaSettings>(
|
|
129
|
+
() => ({
|
|
130
|
+
id: props.id,
|
|
131
|
+
xAxisId: props.xAxisId,
|
|
132
|
+
yAxisId: props.yAxisId,
|
|
133
|
+
ifOverflow: props.ifOverflow,
|
|
134
|
+
x1: props.x1,
|
|
135
|
+
x2: props.x2,
|
|
136
|
+
y1: props.y1,
|
|
137
|
+
y2: props.y2,
|
|
138
|
+
}),
|
|
139
|
+
{
|
|
140
|
+
add: (next) => store.actions.referenceElements.addArea(next),
|
|
141
|
+
// No replace action on the slice; a change is remove-then-add (recharts idiom).
|
|
142
|
+
replace: (prev, next) => {
|
|
143
|
+
store.actions.referenceElements.removeArea(prev);
|
|
144
|
+
store.actions.referenceElements.addArea(next);
|
|
145
|
+
},
|
|
146
|
+
remove: (prev) => store.actions.referenceElements.removeArea(prev),
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
}
|
|
160
150
|
|
|
161
151
|
return null;
|
|
162
152
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// - PERMANENT-N/A (by design, NOT deferred): the custom-element `shape` branch
|
|
13
13
|
// (React.cloneElement — use the render-function form);
|
|
14
14
|
// `children` is not rendered (CartesianLabelContext).
|
|
15
|
-
import {
|
|
15
|
+
import { createMemo, merge, Show } from "solid-js";
|
|
16
16
|
import type { JSX } from "@solidjs/web";
|
|
17
17
|
import { Layer } from "../container/Layer";
|
|
18
18
|
import { Dot, type DotProps } from "../shape/Dot";
|
|
@@ -36,7 +36,7 @@ import { DefaultZIndexes } from "../zIndex/DefaultZIndexes";
|
|
|
36
36
|
import { ZIndexLayer } from "../zIndex/ZIndexLayer";
|
|
37
37
|
import { Coordinate } from "../util/types";
|
|
38
38
|
import { CartesianScaleHelperImpl } from "../util/scale/CartesianScaleHelper";
|
|
39
|
-
import {
|
|
39
|
+
import { registerInStore } from "../state/registerInStore";
|
|
40
40
|
|
|
41
41
|
type ReferenceCoordinateValue = number | string;
|
|
42
42
|
|
|
@@ -130,38 +130,28 @@ export type Props<
|
|
|
130
130
|
|
|
131
131
|
function ReportReferenceDot(props: ReferenceDotSettings): JSX.Element {
|
|
132
132
|
const store = useAppStore();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
prev = settings;
|
|
156
|
-
},
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
unregisterOnCleanup(() => {
|
|
160
|
-
if (prev && store != null) {
|
|
161
|
-
store.actions.referenceElements.removeDot(prev);
|
|
162
|
-
prev = null;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
133
|
+
if (store != null) {
|
|
134
|
+
registerInStore<ReferenceDotSettings>(
|
|
135
|
+
() => ({
|
|
136
|
+
id: props.id,
|
|
137
|
+
xAxisId: props.xAxisId,
|
|
138
|
+
yAxisId: props.yAxisId,
|
|
139
|
+
ifOverflow: props.ifOverflow,
|
|
140
|
+
x: props.x,
|
|
141
|
+
y: props.y,
|
|
142
|
+
r: props.r,
|
|
143
|
+
}),
|
|
144
|
+
{
|
|
145
|
+
add: (next) => store.actions.referenceElements.addDot(next),
|
|
146
|
+
// No replace action on the slice; a change is remove-then-add (recharts idiom).
|
|
147
|
+
replace: (prev, next) => {
|
|
148
|
+
store.actions.referenceElements.removeDot(prev);
|
|
149
|
+
store.actions.referenceElements.addDot(next);
|
|
150
|
+
},
|
|
151
|
+
remove: (prev) => store.actions.referenceElements.removeDot(prev),
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
}
|
|
165
155
|
|
|
166
156
|
return null;
|
|
167
157
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// render-function form; the default-`<line>` branch is kept). <Label> CHILDREN
|
|
17
17
|
// are not rendered (the `label` prop is).
|
|
18
18
|
import { type CamelSvgProps } from "../util/svgPropertiesNoEvents";
|
|
19
|
-
import {
|
|
19
|
+
import { createMemo, merge, Show } from "solid-js";
|
|
20
20
|
import type { JSX } from "@solidjs/web";
|
|
21
21
|
import { Layer } from "../container/Layer";
|
|
22
22
|
import {
|
|
@@ -46,7 +46,7 @@ import { CartesianScaleHelper, CartesianScaleHelperImpl } from "../util/scale/Ca
|
|
|
46
46
|
import type { AxisId } from "../state/cartesianAxisSlice";
|
|
47
47
|
import { DefaultZIndexes } from "../zIndex/DefaultZIndexes";
|
|
48
48
|
import { ZIndexLayer } from "../zIndex/ZIndexLayer";
|
|
49
|
-
import {
|
|
49
|
+
import { registerInStore } from "../state/registerInStore";
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Single point that defines one end of a segment, in data space.
|
|
@@ -242,38 +242,29 @@ const renderLine = (
|
|
|
242
242
|
|
|
243
243
|
function ReportReferenceLine(props: ReferenceLineSettings): JSX.Element {
|
|
244
244
|
const store = useAppStore();
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
store.actions.referenceElements.removeLine(prev)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
},
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
unregisterOnCleanup(() => {
|
|
272
|
-
if (prev && store != null) {
|
|
273
|
-
store.actions.referenceElements.removeLine(prev);
|
|
274
|
-
prev = null;
|
|
275
|
-
}
|
|
276
|
-
});
|
|
245
|
+
if (store != null) {
|
|
246
|
+
registerInStore<ReferenceLineSettings>(
|
|
247
|
+
() => ({
|
|
248
|
+
id: props.id,
|
|
249
|
+
xAxisId: props.xAxisId,
|
|
250
|
+
yAxisId: props.yAxisId,
|
|
251
|
+
ifOverflow: props.ifOverflow,
|
|
252
|
+
x: props.x,
|
|
253
|
+
y: props.y,
|
|
254
|
+
segment: props.segment,
|
|
255
|
+
}),
|
|
256
|
+
{
|
|
257
|
+
add: (next) => store.actions.referenceElements.addLine(next),
|
|
258
|
+
// The referenceElements slice has no replace action; the change is a
|
|
259
|
+
// remove of the old settings followed by an add of the new (recharts idiom).
|
|
260
|
+
replace: (prev, next) => {
|
|
261
|
+
store.actions.referenceElements.removeLine(prev);
|
|
262
|
+
store.actions.referenceElements.addLine(next);
|
|
263
|
+
},
|
|
264
|
+
remove: (prev) => store.actions.referenceElements.removeLine(prev),
|
|
265
|
+
},
|
|
266
|
+
);
|
|
267
|
+
}
|
|
277
268
|
|
|
278
269
|
return null;
|
|
279
270
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// joint/fitting line) are wired.) Solid deviations:
|
|
11
11
|
// resolveDefaultProps→merge; effect-dispatch registration → createEffect/onCleanup;
|
|
12
12
|
// the `@ts-expect-error`-laden value plumbing is replaced with typed coercion.
|
|
13
|
-
import {
|
|
13
|
+
import { createMemo, For, merge, Show } from "solid-js";
|
|
14
14
|
import type { JSX } from "@solidjs/web";
|
|
15
15
|
import { useAppSelector, useAppStore } from "../state/hooks";
|
|
16
16
|
import { useIsPanorama } from "../context/PanoramaContext";
|
|
@@ -79,7 +79,7 @@ import { getCateCoordinateOfLine, getTooltipNameProp, getValueByDataKey } from "
|
|
|
79
79
|
import { getLinearRegression, interpolate, isNullish, isNumOrStr } from "../util/DataUtils";
|
|
80
80
|
import { BaseAxisWithScale, implicitZAxis, ZAxisWithScale } from "../state/selectors/axisSelectors";
|
|
81
81
|
import type { Formatter, ValueType } from "../component/DefaultTooltipContent";
|
|
82
|
-
import {
|
|
82
|
+
import { registerInStore } from "../state/registerInStore";
|
|
83
83
|
|
|
84
84
|
export interface ScatterPointNode {
|
|
85
85
|
x?: number | string;
|
|
@@ -402,41 +402,29 @@ export const Scatter = (props: ScatterProps): JSX.Element => {
|
|
|
402
402
|
// The default shape a (possibly partial-object) activeShape falls back to.
|
|
403
403
|
const defaultSymbolShape = (p: ScatterShapeProps): JSX.Element => <Symbols {...p} />;
|
|
404
404
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
store.actions.graphicalItems.replaceCartesianGraphicalItem({ prev, next: settings });
|
|
429
|
-
}
|
|
430
|
-
prev = settings;
|
|
431
|
-
},
|
|
432
|
-
);
|
|
433
|
-
|
|
434
|
-
unregisterOnCleanup(() => {
|
|
435
|
-
if (prev && store != null) {
|
|
436
|
-
store.actions.graphicalItems.removeCartesianGraphicalItem(prev);
|
|
437
|
-
prev = null;
|
|
438
|
-
}
|
|
439
|
-
});
|
|
405
|
+
if (store != null) {
|
|
406
|
+
registerInStore<ScatterSettings>(
|
|
407
|
+
() => ({
|
|
408
|
+
id,
|
|
409
|
+
type: "scatter",
|
|
410
|
+
isPanorama,
|
|
411
|
+
data: merged.data,
|
|
412
|
+
dataKey: merged.dataKey,
|
|
413
|
+
xAxisId: merged.xAxisId,
|
|
414
|
+
yAxisId: merged.yAxisId,
|
|
415
|
+
zAxisId: merged.zAxisId,
|
|
416
|
+
hide: merged.hide,
|
|
417
|
+
tooltipType: merged.tooltipType,
|
|
418
|
+
name: merged.name,
|
|
419
|
+
}),
|
|
420
|
+
{
|
|
421
|
+
add: (next) => store.actions.graphicalItems.addCartesianGraphicalItem(next),
|
|
422
|
+
replace: (prev, next) =>
|
|
423
|
+
store.actions.graphicalItems.replaceCartesianGraphicalItem({ prev, next }),
|
|
424
|
+
remove: (prev) => store.actions.graphicalItems.removeCartesianGraphicalItem(prev),
|
|
425
|
+
},
|
|
426
|
+
);
|
|
427
|
+
}
|
|
440
428
|
|
|
441
429
|
// Per-point <Cell> overrides (collected from children, in data order).
|
|
442
430
|
const cells = collectCells(() => props.children);
|
package/src/cartesian/XAxis.tsx
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// plus `onCleanup` for removal. Defaults are resolved field-by-field to match
|
|
11
11
|
// recharts' `resolveDefaultProps`: explicit `undefined` falls back to defaults.
|
|
12
12
|
import { type CamelSvgProps } from "../util/svgPropertiesNoEvents";
|
|
13
|
-
import {
|
|
13
|
+
import { createMemo, Show } from "solid-js";
|
|
14
14
|
import type { JSX } from "@solidjs/web";
|
|
15
15
|
import { useAppSelector, useAppStore } from "../state/hooks";
|
|
16
16
|
import {
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
TickProp,
|
|
44
44
|
} from "../util/types";
|
|
45
45
|
import { CustomScaleDefinition } from "../util/scale/CustomScaleDefinition";
|
|
46
|
-
import {
|
|
46
|
+
import { registerInStore } from "../state/registerInStore";
|
|
47
47
|
|
|
48
48
|
export interface XAxisProps<DataPointType = unknown, DataValueType = unknown> {
|
|
49
49
|
xAxisId?: string | number;
|
|
@@ -155,71 +155,58 @@ export function XAxis<DataPointType = unknown, DataValueType = unknown>(
|
|
|
155
155
|
const unit = createMemo(() => props.unit);
|
|
156
156
|
const mirror = createMemo(() => withDefault(props.mirror, xAxisDefaultProps.mirror));
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
} else if (prev !== settings) {
|
|
211
|
-
store.actions.cartesianAxis.replaceXAxis({ prev, next: settings });
|
|
212
|
-
}
|
|
213
|
-
prev = settings;
|
|
214
|
-
},
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
unregisterOnCleanup(() => {
|
|
218
|
-
if (prev && store != null) {
|
|
219
|
-
store.actions.cartesianAxis.removeXAxis(prev);
|
|
220
|
-
prev = null;
|
|
221
|
-
}
|
|
222
|
-
});
|
|
158
|
+
if (store != null) {
|
|
159
|
+
registerInStore<XAxisSettings>(
|
|
160
|
+
(): XAxisSettings | undefined => {
|
|
161
|
+
const evaluatedType = getAxisTypeBasedOnLayout(
|
|
162
|
+
layout(),
|
|
163
|
+
"xAxis",
|
|
164
|
+
withDefault(props.type, xAxisDefaultProps.type),
|
|
165
|
+
);
|
|
166
|
+
if (evaluatedType == null) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
id: xAxisId(),
|
|
171
|
+
scale: withDefault(props.scale, xAxisDefaultProps.scale),
|
|
172
|
+
type: evaluatedType,
|
|
173
|
+
dataKey: props.dataKey,
|
|
174
|
+
unit: unit(),
|
|
175
|
+
name: props.name,
|
|
176
|
+
allowDuplicatedCategory: withDefault(
|
|
177
|
+
props.allowDuplicatedCategory,
|
|
178
|
+
xAxisDefaultProps.allowDuplicatedCategory,
|
|
179
|
+
),
|
|
180
|
+
allowDataOverflow: withDefault(
|
|
181
|
+
props.allowDataOverflow,
|
|
182
|
+
xAxisDefaultProps.allowDataOverflow,
|
|
183
|
+
),
|
|
184
|
+
reversed: withDefault(props.reversed, xAxisDefaultProps.reversed),
|
|
185
|
+
includeHidden: withDefault(props.includeHidden, xAxisDefaultProps.includeHidden),
|
|
186
|
+
domain: props.domain,
|
|
187
|
+
allowDecimals: withDefault(props.allowDecimals, xAxisDefaultProps.allowDecimals),
|
|
188
|
+
tickCount: withDefault(props.tickCount, xAxisDefaultProps.tickCount),
|
|
189
|
+
ticks: props.ticks,
|
|
190
|
+
tick: tick(),
|
|
191
|
+
niceTicks: withDefault(props.niceTicks, xAxisDefaultProps.niceTicks),
|
|
192
|
+
interval: withDefault(props.interval, xAxisDefaultProps.interval),
|
|
193
|
+
mirror: mirror(),
|
|
194
|
+
minTickGap: withDefault(props.minTickGap, xAxisDefaultProps.minTickGap),
|
|
195
|
+
angle: withDefault(props.angle, xAxisDefaultProps.angle),
|
|
196
|
+
hide: hide(),
|
|
197
|
+
tickFormatter: tickFormatter(),
|
|
198
|
+
padding: withDefault(props.padding, xAxisDefaultProps.padding),
|
|
199
|
+
height: withDefault(props.height, xAxisDefaultProps.height),
|
|
200
|
+
orientation: orientation(),
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
add: (next) => store.actions.cartesianAxis.addXAxis(next),
|
|
205
|
+
replace: (prev, next) => store.actions.cartesianAxis.replaceXAxis({ prev, next }),
|
|
206
|
+
remove: (prev) => store.actions.cartesianAxis.removeXAxis(prev),
|
|
207
|
+
},
|
|
208
|
+
);
|
|
209
|
+
}
|
|
223
210
|
|
|
224
211
|
// Visual: render the <CartesianAxis> (ticks + labels + axis line). Never inside
|
|
225
212
|
// a Brush panorama.
|
package/src/cartesian/YAxis.tsx
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
TickProp,
|
|
41
41
|
} from "../util/types";
|
|
42
42
|
import { CustomScaleDefinition } from "../util/scale/CustomScaleDefinition";
|
|
43
|
-
import {
|
|
43
|
+
import { registerInStore } from "../state/registerInStore";
|
|
44
44
|
|
|
45
45
|
export interface YAxisProps<DataPointType = unknown, DataValueType = unknown> {
|
|
46
46
|
yAxisId?: string | number;
|
|
@@ -152,71 +152,58 @@ export function YAxis<DataPointType = unknown, DataValueType = unknown>(
|
|
|
152
152
|
const unit = createMemo(() => props.unit);
|
|
153
153
|
const mirror = createMemo(() => withDefault(props.mirror, yAxisDefaultProps.mirror));
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
} else if (prev !== settings) {
|
|
208
|
-
store.actions.cartesianAxis.replaceYAxis({ prev, next: settings });
|
|
209
|
-
}
|
|
210
|
-
prev = settings;
|
|
211
|
-
},
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
unregisterOnCleanup(() => {
|
|
215
|
-
if (prev && store != null) {
|
|
216
|
-
store.actions.cartesianAxis.removeYAxis(prev);
|
|
217
|
-
prev = null;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
155
|
+
if (store != null) {
|
|
156
|
+
registerInStore<YAxisSettings>(
|
|
157
|
+
(): YAxisSettings | undefined => {
|
|
158
|
+
const evaluatedType = getAxisTypeBasedOnLayout(
|
|
159
|
+
layout(),
|
|
160
|
+
"yAxis",
|
|
161
|
+
withDefault(props.type, yAxisDefaultProps.type),
|
|
162
|
+
);
|
|
163
|
+
if (evaluatedType == null) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
id: yAxisId(),
|
|
168
|
+
scale: withDefault(props.scale, yAxisDefaultProps.scale),
|
|
169
|
+
type: evaluatedType,
|
|
170
|
+
dataKey: props.dataKey,
|
|
171
|
+
unit: unit(),
|
|
172
|
+
name: props.name,
|
|
173
|
+
allowDuplicatedCategory: withDefault(
|
|
174
|
+
props.allowDuplicatedCategory,
|
|
175
|
+
yAxisDefaultProps.allowDuplicatedCategory,
|
|
176
|
+
),
|
|
177
|
+
allowDataOverflow: withDefault(
|
|
178
|
+
props.allowDataOverflow,
|
|
179
|
+
yAxisDefaultProps.allowDataOverflow,
|
|
180
|
+
),
|
|
181
|
+
reversed: withDefault(props.reversed, yAxisDefaultProps.reversed),
|
|
182
|
+
includeHidden: withDefault(props.includeHidden, yAxisDefaultProps.includeHidden),
|
|
183
|
+
domain: props.domain,
|
|
184
|
+
allowDecimals: withDefault(props.allowDecimals, yAxisDefaultProps.allowDecimals),
|
|
185
|
+
tickCount: withDefault(props.tickCount, yAxisDefaultProps.tickCount),
|
|
186
|
+
ticks: props.ticks,
|
|
187
|
+
tick: tick(),
|
|
188
|
+
niceTicks: withDefault(props.niceTicks, yAxisDefaultProps.niceTicks),
|
|
189
|
+
interval: withDefault(props.interval, yAxisDefaultProps.interval),
|
|
190
|
+
mirror: mirror(),
|
|
191
|
+
minTickGap: withDefault(props.minTickGap, yAxisDefaultProps.minTickGap),
|
|
192
|
+
angle: withDefault(props.angle, yAxisDefaultProps.angle),
|
|
193
|
+
hide: hide(),
|
|
194
|
+
tickFormatter: tickFormatter(),
|
|
195
|
+
padding: withDefault(props.padding, yAxisDefaultProps.padding),
|
|
196
|
+
width: withDefault(props.width, yAxisDefaultProps.width),
|
|
197
|
+
orientation: orientation(),
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
add: (next) => store.actions.cartesianAxis.addYAxis(next),
|
|
202
|
+
replace: (prev, next) => store.actions.cartesianAxis.replaceYAxis({ prev, next }),
|
|
203
|
+
remove: (prev) => store.actions.cartesianAxis.removeYAxis(prev),
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
}
|
|
220
207
|
|
|
221
208
|
// Visual: render the <CartesianAxis>. Never inside a Brush panorama.
|
|
222
209
|
const isPanorama = useIsPanorama();
|