@mui/x-charts 9.3.0 → 9.5.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/BarChart/BarElement.d.mts +3 -2
- package/BarChart/BarElement.d.ts +3 -2
- package/BarChart/BarLabel/BarLabelItem.d.mts +3 -2
- package/BarChart/BarLabel/BarLabelItem.d.ts +3 -2
- package/BarChart/seriesConfig/bar/extremums.js +7 -2
- package/BarChart/seriesConfig/bar/extremums.mjs +7 -2
- package/CHANGELOG.md +296 -0
- package/ChartsContainer/ChartsContainer.js +21 -0
- package/ChartsContainer/ChartsContainer.mjs +21 -0
- package/ChartsLabel/ChartsLabelMark.js +1 -21
- package/ChartsLabel/ChartsLabelMark.mjs +0 -20
- package/ChartsLegend/chartsLegend.types.d.mts +3 -2
- package/ChartsLegend/chartsLegend.types.d.ts +3 -2
- package/ChartsLegend/piecewiseColorLegendClasses.js +8 -2
- package/ChartsLegend/piecewiseColorLegendClasses.mjs +8 -2
- package/ChartsOverlay/ChartsOverlay.d.mts +5 -4
- package/ChartsOverlay/ChartsOverlay.d.ts +5 -4
- package/ChartsRadialAxisHighlight/index.d.mts +6 -1
- package/ChartsRadialAxisHighlight/index.d.ts +6 -1
- package/ChartsRadialAxisHighlight/index.js +9 -2
- package/ChartsRadialAxisHighlight/index.mjs +8 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +1 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +1 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +1 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +1 -1
- package/ChartsRadialDataProvider/index.d.mts +5 -0
- package/ChartsRadialDataProvider/index.d.ts +5 -0
- package/ChartsRadialDataProvider/index.js +12 -1
- package/ChartsRadialDataProvider/index.mjs +7 -0
- package/ChartsRadialGrid/index.d.mts +6 -1
- package/ChartsRadialGrid/index.d.ts +6 -1
- package/ChartsRadialGrid/index.js +8 -2
- package/ChartsRadialGrid/index.mjs +8 -1
- package/ChartsRadiusAxis/index.d.mts +6 -1
- package/ChartsRadiusAxis/index.d.ts +6 -1
- package/ChartsRadiusAxis/index.js +10 -2
- package/ChartsRadiusAxis/index.mjs +7 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +6 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.mjs +6 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +5 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.mjs +5 -0
- package/ChartsRotationAxis/index.d.mts +6 -1
- package/ChartsRotationAxis/index.d.ts +6 -1
- package/ChartsRotationAxis/index.js +10 -2
- package/ChartsRotationAxis/index.mjs +7 -1
- package/ChartsTooltip/ChartTooltip.types.d.mts +3 -2
- package/ChartsTooltip/ChartTooltip.types.d.ts +3 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +11 -4
- package/ChartsTooltip/ChartsTooltipContainer.mjs +11 -4
- package/ChartsTooltip/useAxesTooltip.js +2 -2
- package/ChartsTooltip/useAxesTooltip.mjs +2 -2
- package/ChartsTooltip/useItemTooltip.js +2 -2
- package/ChartsTooltip/useItemTooltip.mjs +2 -2
- package/ChartsXAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsXAxis/useAxisTicksProps.d.ts +84 -3
- package/ChartsYAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +84 -3
- package/LineChart/AreaElement.d.mts +3 -2
- package/LineChart/AreaElement.d.ts +3 -2
- package/LineChart/AreaElement.js +1 -1
- package/LineChart/AreaElement.mjs +1 -1
- package/LineChart/CircleMarkElement.js +1 -1
- package/LineChart/CircleMarkElement.mjs +1 -1
- package/LineChart/LineElement.d.mts +3 -2
- package/LineChart/LineElement.d.ts +3 -2
- package/LineChart/LineElement.js +1 -1
- package/LineChart/LineElement.mjs +1 -1
- package/LineChart/LineHighlightPlot.d.mts +3 -2
- package/LineChart/LineHighlightPlot.d.ts +3 -2
- package/LineChart/LineHighlightPlot.js +65 -45
- package/LineChart/LineHighlightPlot.mjs +65 -45
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkElement.mjs +1 -1
- package/LineChart/MarkPlot.d.mts +3 -2
- package/LineChart/MarkPlot.d.ts +3 -2
- package/LineChart/seriesConfig/curveEvaluation.js +28 -14
- package/LineChart/seriesConfig/curveEvaluation.mjs +27 -14
- package/LineChart/seriesConfig/extremums.js +5 -1
- package/LineChart/seriesConfig/extremums.mjs +5 -1
- package/LineChart/useMarkPlotData.js +3 -1
- package/LineChart/useMarkPlotData.mjs +3 -1
- package/PieChart/PieArcLabelPlot.d.mts +3 -2
- package/PieChart/PieArcLabelPlot.d.ts +3 -2
- package/PieChart/PieArcPlot.d.mts +3 -2
- package/PieChart/PieArcPlot.d.ts +3 -2
- package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +2 -2
- package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +2 -2
- package/ScatterChart/BatchScatter.d.mts +2 -8
- package/ScatterChart/BatchScatter.d.ts +2 -8
- package/ScatterChart/BatchScatter.js +17 -12
- package/ScatterChart/BatchScatter.mjs +17 -12
- package/ScatterChart/FocusedScatterMark.js +2 -2
- package/ScatterChart/FocusedScatterMark.mjs +2 -2
- package/ScatterChart/HighlightedScatterMark.js +3 -3
- package/ScatterChart/HighlightedScatterMark.mjs +3 -3
- package/ScatterChart/Scatter.d.mts +5 -0
- package/ScatterChart/Scatter.d.ts +5 -0
- package/ScatterChart/Scatter.js +7 -2
- package/ScatterChart/Scatter.mjs +7 -2
- package/ScatterChart/ScatterChart.d.mts +2 -1
- package/ScatterChart/ScatterChart.d.ts +2 -1
- package/ScatterChart/ScatterChart.js +28 -3
- package/ScatterChart/ScatterChart.mjs +28 -3
- package/ScatterChart/ScatterChart.plugins.d.mts +2 -1
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/ScatterChart.plugins.mjs +2 -1
- package/ScatterChart/ScatterMarker.types.d.mts +3 -2
- package/ScatterChart/ScatterMarker.types.d.ts +3 -2
- package/ScatterChart/ScatterPlot.d.mts +7 -4
- package/ScatterChart/ScatterPlot.d.ts +7 -4
- package/ScatterChart/ScatterPlot.js +31 -4
- package/ScatterChart/ScatterPlot.mjs +31 -4
- package/ScatterChart/async/ScatterAsync.d.mts +9 -0
- package/ScatterChart/async/ScatterAsync.d.ts +9 -0
- package/ScatterChart/async/ScatterAsync.js +71 -0
- package/ScatterChart/async/ScatterAsync.mjs +67 -0
- package/ScatterChart/async/ScatterAsyncBatch.d.mts +24 -0
- package/ScatterChart/async/ScatterAsyncBatch.d.ts +24 -0
- package/ScatterChart/async/ScatterAsyncBatch.js +112 -0
- package/ScatterChart/async/ScatterAsyncBatch.mjs +106 -0
- package/ScatterChart/async/scatterRenderData.selectors.d.mts +38 -0
- package/ScatterChart/async/scatterRenderData.selectors.d.ts +38 -0
- package/ScatterChart/async/scatterRenderData.selectors.js +93 -0
- package/ScatterChart/async/scatterRenderData.selectors.mjs +87 -0
- package/ScatterChart/seriesConfig/extremums.js +6 -0
- package/ScatterChart/seriesConfig/extremums.mjs +6 -0
- package/ScatterChart/seriesConfig/getColor.js +1 -1
- package/ScatterChart/seriesConfig/getColor.mjs +1 -1
- package/ScatterChart/seriesConfig/getMarkerSize.d.mts +18 -0
- package/ScatterChart/seriesConfig/getMarkerSize.d.ts +18 -0
- package/ScatterChart/seriesConfig/getMarkerSize.js +43 -0
- package/ScatterChart/seriesConfig/getMarkerSize.mjs +37 -0
- package/ScatterChart/seriesConfig/seriesProcessor.js +23 -8
- package/ScatterChart/seriesConfig/seriesProcessor.mjs +23 -8
- package/ScatterChart/useScatterItemPosition.d.mts +4 -0
- package/ScatterChart/useScatterItemPosition.d.ts +4 -0
- package/ScatterChart/useScatterItemPosition.js +9 -0
- package/ScatterChart/useScatterItemPosition.mjs +8 -0
- package/SparkLineChart/SparkLineChart.js +2 -1
- package/SparkLineChart/SparkLineChart.mjs +2 -1
- package/Toolbar/Toolbar.types.d.mts +3 -2
- package/Toolbar/Toolbar.types.d.ts +3 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/animation/animation.d.mts +1 -2
- package/internals/animation/animation.d.ts +1 -2
- package/internals/commonNextFocusItem.d.mts +10 -2
- package/internals/commonNextFocusItem.d.ts +10 -2
- package/internals/commonNextFocusItem.js +12 -4
- package/internals/commonNextFocusItem.mjs +12 -4
- package/internals/createCommonKeyboardFocusHandler.d.mts +1 -1
- package/internals/createCommonKeyboardFocusHandler.d.ts +1 -1
- package/internals/createCommonKeyboardFocusHandler.js +3 -3
- package/internals/createCommonKeyboardFocusHandler.mjs +3 -3
- package/internals/getSeriesColorFn.d.mts +5 -5
- package/internals/getSeriesColorFn.d.ts +5 -5
- package/internals/incompleteDatasetKeysError.d.mts +1 -0
- package/internals/incompleteDatasetKeysError.d.ts +1 -0
- package/internals/incompleteDatasetKeysError.js +11 -0
- package/internals/incompleteDatasetKeysError.mjs +4 -0
- package/internals/index.d.mts +3 -0
- package/internals/index.d.ts +3 -0
- package/internals/index.js +36 -0
- package/internals/index.mjs +3 -0
- package/internals/plugins/allPlugins.d.mts +4 -3
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/allPlugins.mjs +2 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.mts +12 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +12 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.mjs +10 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.mts +15 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +15 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.mjs +4 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.mts +10 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +10 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +18 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.mjs +16 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +27 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.mjs +27 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.mjs +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +24 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +24 -5
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.mts +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +46 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.mjs +47 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +46 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +46 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +2 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +3 -2
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.mjs +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.mts +4 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +3 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.mjs +1 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +5 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +7 -5
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +17 -3
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +17 -3
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.d.mts +3 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.js +27 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.mjs +2 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.d.mts +13 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.d.ts +13 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.js +136 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.mjs +128 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.d.mts +42 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.d.ts +42 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.js +166 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.mjs +159 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.d.mts +34 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.d.ts +34 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.js +5 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.mjs +1 -0
- package/internals/scales/scaleBand.js +70 -43
- package/internals/scales/scaleBand.mjs +71 -44
- package/internals/sizeScale.d.mts +6 -0
- package/internals/sizeScale.d.ts +6 -0
- package/internals/sizeScale.js +46 -0
- package/internals/sizeScale.mjs +38 -0
- package/models/axis.d.mts +18 -12
- package/models/axis.d.ts +18 -12
- package/models/chartsSlotsComponentsProps.d.mts +25 -0
- package/models/chartsSlotsComponentsProps.d.ts +25 -0
- package/models/chartsSlotsComponentsProps.js +5 -0
- package/models/chartsSlotsComponentsProps.mjs +1 -0
- package/models/index.d.mts +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/index.mjs +1 -0
- package/models/seriesType/bar.d.mts +1 -1
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.mts +4 -4
- package/models/seriesType/common.d.ts +4 -4
- package/models/seriesType/config.d.mts +3 -3
- package/models/seriesType/config.d.ts +3 -3
- package/models/seriesType/line.d.mts +6 -3
- package/models/seriesType/line.d.ts +6 -3
- package/models/seriesType/pie.d.mts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/radar.d.mts +1 -1
- package/models/seriesType/radar.d.ts +1 -1
- package/models/seriesType/scatter.d.mts +35 -3
- package/models/seriesType/scatter.d.ts +35 -3
- package/models/sizeMapping.d.mts +64 -0
- package/models/sizeMapping.d.ts +64 -0
- package/models/sizeMapping.js +5 -0
- package/models/sizeMapping.mjs +1 -0
- package/models/slots/chartsBaseSlots.d.mts +6 -5
- package/models/slots/chartsBaseSlots.d.ts +6 -5
- package/models/z-axis.d.mts +10 -1
- package/models/z-axis.d.ts +10 -1
- package/package.json +5 -5
|
@@ -3,6 +3,7 @@ import { type SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
|
3
3
|
import { type AnimatedAreaProps } from "./AnimatedArea.js";
|
|
4
4
|
import { type SeriesId } from "../models/seriesType/common.js";
|
|
5
5
|
import { type LineClasses } from "./lineClasses.js";
|
|
6
|
+
import type { AreaPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
6
7
|
export interface AreaElementOwnerState {
|
|
7
8
|
seriesId: SeriesId;
|
|
8
9
|
color: string;
|
|
@@ -16,10 +17,10 @@ export interface AreaElementSlots {
|
|
|
16
17
|
* The component that renders the area.
|
|
17
18
|
* @default AnimatedArea
|
|
18
19
|
*/
|
|
19
|
-
area?: React.JSXElementConstructor<AnimatedAreaProps>;
|
|
20
|
+
area?: React.JSXElementConstructor<AnimatedAreaProps & AreaPropsOverrides>;
|
|
20
21
|
}
|
|
21
22
|
export interface AreaElementSlotProps {
|
|
22
|
-
area?: SlotComponentPropsFromProps<AnimatedAreaProps,
|
|
23
|
+
area?: SlotComponentPropsFromProps<AnimatedAreaProps, AreaPropsOverrides, AreaElementOwnerState>;
|
|
23
24
|
}
|
|
24
25
|
export interface AreaElementProps extends Omit<AreaElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedAreaProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color'> {
|
|
25
26
|
d: string;
|
package/LineChart/AreaElement.js
CHANGED
|
@@ -42,7 +42,7 @@ function AreaElement(props) {
|
|
|
42
42
|
} = props,
|
|
43
43
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
44
44
|
const store = (0, _useStore.useStore)();
|
|
45
|
-
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState)
|
|
45
|
+
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
46
46
|
const identifier = React.useMemo(() => ({
|
|
47
47
|
type: 'line',
|
|
48
48
|
seriesId
|
|
@@ -35,7 +35,7 @@ function AreaElement(props) {
|
|
|
35
35
|
} = props,
|
|
36
36
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
37
37
|
const store = useStore();
|
|
38
|
-
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState)
|
|
38
|
+
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
39
39
|
const identifier = React.useMemo(() => ({
|
|
40
40
|
type: 'line',
|
|
41
41
|
seriesId
|
|
@@ -61,7 +61,7 @@ function CircleMarkElement(props) {
|
|
|
61
61
|
} = props,
|
|
62
62
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
63
63
|
const store = (0, _useStore.useStore)();
|
|
64
|
-
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState)
|
|
64
|
+
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
65
65
|
const interactionProps = (0, _useInteractionItemProps.useInteractionItemProps)({
|
|
66
66
|
type: 'line',
|
|
67
67
|
seriesId,
|
|
@@ -54,7 +54,7 @@ function CircleMarkElement(props) {
|
|
|
54
54
|
} = props,
|
|
55
55
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
56
56
|
const store = useStore();
|
|
57
|
-
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState)
|
|
57
|
+
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
58
58
|
const interactionProps = useInteractionItemProps({
|
|
59
59
|
type: 'line',
|
|
60
60
|
seriesId,
|
|
@@ -3,6 +3,7 @@ import { type SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
|
3
3
|
import { type AnimatedLineProps } from "./AnimatedLine.mjs";
|
|
4
4
|
import { type SeriesId } from "../models/seriesType/common.mjs";
|
|
5
5
|
import { type LineClasses } from "./lineClasses.mjs";
|
|
6
|
+
import type { LinePropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
|
|
6
7
|
export interface LineElementOwnerState {
|
|
7
8
|
seriesId: SeriesId;
|
|
8
9
|
color: string;
|
|
@@ -18,10 +19,10 @@ export interface LineElementSlots {
|
|
|
18
19
|
* The component that renders the line.
|
|
19
20
|
* @default LineElementPath
|
|
20
21
|
*/
|
|
21
|
-
line?: React.JSXElementConstructor<AnimatedLineProps>;
|
|
22
|
+
line?: React.JSXElementConstructor<AnimatedLineProps & LinePropsOverrides>;
|
|
22
23
|
}
|
|
23
24
|
export interface LineElementSlotProps {
|
|
24
|
-
line?: SlotComponentPropsFromProps<AnimatedLineProps,
|
|
25
|
+
line?: SlotComponentPropsFromProps<AnimatedLineProps, LinePropsOverrides, LineElementOwnerState>;
|
|
25
26
|
}
|
|
26
27
|
export interface LineElementProps extends Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedLineProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color'> {
|
|
27
28
|
d: string;
|
|
@@ -3,6 +3,7 @@ import { type SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
|
3
3
|
import { type AnimatedLineProps } from "./AnimatedLine.js";
|
|
4
4
|
import { type SeriesId } from "../models/seriesType/common.js";
|
|
5
5
|
import { type LineClasses } from "./lineClasses.js";
|
|
6
|
+
import type { LinePropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
6
7
|
export interface LineElementOwnerState {
|
|
7
8
|
seriesId: SeriesId;
|
|
8
9
|
color: string;
|
|
@@ -18,10 +19,10 @@ export interface LineElementSlots {
|
|
|
18
19
|
* The component that renders the line.
|
|
19
20
|
* @default LineElementPath
|
|
20
21
|
*/
|
|
21
|
-
line?: React.JSXElementConstructor<AnimatedLineProps>;
|
|
22
|
+
line?: React.JSXElementConstructor<AnimatedLineProps & LinePropsOverrides>;
|
|
22
23
|
}
|
|
23
24
|
export interface LineElementSlotProps {
|
|
24
|
-
line?: SlotComponentPropsFromProps<AnimatedLineProps,
|
|
25
|
+
line?: SlotComponentPropsFromProps<AnimatedLineProps, LinePropsOverrides, LineElementOwnerState>;
|
|
25
26
|
}
|
|
26
27
|
export interface LineElementProps extends Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedLineProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color'> {
|
|
27
28
|
d: string;
|
package/LineChart/LineElement.js
CHANGED
|
@@ -43,7 +43,7 @@ function LineElement(props) {
|
|
|
43
43
|
} = props,
|
|
44
44
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
45
45
|
const store = (0, _useStore.useStore)();
|
|
46
|
-
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState)
|
|
46
|
+
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
47
47
|
const identifier = React.useMemo(() => ({
|
|
48
48
|
type: 'line',
|
|
49
49
|
seriesId
|
|
@@ -36,7 +36,7 @@ function LineElement(props) {
|
|
|
36
36
|
} = props,
|
|
37
37
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
38
|
const store = useStore();
|
|
39
|
-
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState)
|
|
39
|
+
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
40
40
|
const identifier = React.useMemo(() => ({
|
|
41
41
|
type: 'line',
|
|
42
42
|
seriesId
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { type LineHighlightElementProps } from "./LineHighlightElement.mjs";
|
|
4
|
+
import type { LineHighlightPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
|
|
4
5
|
export interface LineHighlightPlotSlots {
|
|
5
|
-
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
6
|
+
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps & LineHighlightPropsOverrides>;
|
|
6
7
|
}
|
|
7
8
|
export interface LineHighlightPlotSlotProps {
|
|
8
|
-
lineHighlight?: SlotComponentPropsFromProps<LineHighlightElementProps,
|
|
9
|
+
lineHighlight?: SlotComponentPropsFromProps<LineHighlightElementProps, LineHighlightPropsOverrides, {}>;
|
|
9
10
|
}
|
|
10
11
|
export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
11
12
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { type LineHighlightElementProps } from "./LineHighlightElement.js";
|
|
4
|
+
import type { LineHighlightPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
4
5
|
export interface LineHighlightPlotSlots {
|
|
5
|
-
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
6
|
+
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps & LineHighlightPropsOverrides>;
|
|
6
7
|
}
|
|
7
8
|
export interface LineHighlightPlotSlotProps {
|
|
8
|
-
lineHighlight?: SlotComponentPropsFromProps<LineHighlightElementProps,
|
|
9
|
+
lineHighlight?: SlotComponentPropsFromProps<LineHighlightElementProps, LineHighlightPropsOverrides, {}>;
|
|
9
10
|
}
|
|
10
11
|
export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
11
12
|
/**
|
|
@@ -53,9 +53,6 @@ function LineHighlightPlot(props) {
|
|
|
53
53
|
} = (0, _ChartsProvider.useChartsContext)();
|
|
54
54
|
const store = (0, _useStore.useStore)();
|
|
55
55
|
const highlightedIndexes = store.use(_useChartCartesianAxis.selectorChartsHighlightXAxisIndex);
|
|
56
|
-
if (highlightedIndexes.length === 0) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
56
|
if (seriesData === undefined) {
|
|
60
57
|
return null;
|
|
61
58
|
}
|
|
@@ -65,54 +62,77 @@ function LineHighlightPlot(props) {
|
|
|
65
62
|
} = seriesData;
|
|
66
63
|
const defaultXAxisId = xAxisIds[0];
|
|
67
64
|
const defaultYAxisId = yAxisIds[0];
|
|
65
|
+
const hasStartEndMark = stackingGroups.some(({
|
|
66
|
+
ids
|
|
67
|
+
}) => ids.some(seriesId => series[seriesId].showMark === 'start' || series[seriesId].showMark === 'end'));
|
|
68
|
+
if (highlightedIndexes.length === 0 && !hasStartEndMark) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const getHighlightedIndex = new Map();
|
|
72
|
+
highlightedIndexes.forEach(({
|
|
73
|
+
axisId,
|
|
74
|
+
dataIndex
|
|
75
|
+
}) => {
|
|
76
|
+
getHighlightedIndex.set(axisId, dataIndex);
|
|
77
|
+
});
|
|
68
78
|
const Element = slots?.lineHighlight ?? _LineHighlightElement.LineHighlightElement;
|
|
69
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
|
|
70
|
-
children:
|
|
71
|
-
dataIndex: highlightedIndex,
|
|
72
|
-
axisId: highlightedAxisId
|
|
73
|
-
}) => stackingGroups.flatMap(({
|
|
80
|
+
children: stackingGroups.flatMap(({
|
|
74
81
|
ids: groupIds
|
|
75
|
-
}) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
82
|
+
}) => groupIds.flatMap(seriesId => {
|
|
83
|
+
const {
|
|
84
|
+
xAxisId = defaultXAxisId,
|
|
85
|
+
yAxisId = defaultYAxisId,
|
|
86
|
+
visibleStackedData,
|
|
87
|
+
data,
|
|
88
|
+
disableHighlight,
|
|
89
|
+
showMark,
|
|
90
|
+
shape = 'circle',
|
|
91
|
+
hidden
|
|
92
|
+
} = series[seriesId];
|
|
93
|
+
if (hidden) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const axisIndex = disableHighlight ? undefined : getHighlightedIndex.get(xAxisId);
|
|
97
|
+
const showMarkIndex = showMark === 'start' || showMark === 'end' ? getStartEndMarkIndex(data, showMark) : undefined;
|
|
98
|
+
const highlightedIndex = axisIndex ?? showMarkIndex;
|
|
99
|
+
if (highlightedIndex === undefined || data[highlightedIndex] == null) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const xScale = (0, _getValueToPositionMapper.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
103
|
+
const yScale = yAxis[yAxisId].scale;
|
|
104
|
+
const xData = xAxis[xAxisId].data;
|
|
105
|
+
if (xData === undefined) {
|
|
106
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have a data property to be able to display a line plot. ` + 'The x-axis data defines the positions for each point in the line. ' + 'Provide a data array to the x-axis configuration.' : (0, _formatErrorMessage2.default)(10, xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`));
|
|
107
|
+
}
|
|
108
|
+
const x = xScale(xData[highlightedIndex]);
|
|
109
|
+
const y = yScale(visibleStackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
110
|
+
if (!instance.isPointInside(x, y)) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
|
|
115
|
+
seriesId: seriesId,
|
|
116
|
+
color: colorGetter(highlightedIndex),
|
|
117
|
+
x: x,
|
|
118
|
+
y: y,
|
|
119
|
+
shape: shape
|
|
120
|
+
}, slotProps?.lineHighlight), `${seriesId}`);
|
|
113
121
|
}))
|
|
114
122
|
}));
|
|
115
123
|
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Returns the index of the first (`'start'`) or last (`'end'`) non-null item, or `-1` if none.
|
|
127
|
+
*/
|
|
128
|
+
function getStartEndMarkIndex(data, type) {
|
|
129
|
+
if (type === 'start') {
|
|
130
|
+
const index = data.findIndex(value => value != null);
|
|
131
|
+
return index < 0 ? undefined : index;
|
|
132
|
+
}
|
|
133
|
+
const index = data.findLastIndex(value => value != null);
|
|
134
|
+
return index < 0 ? undefined : index;
|
|
135
|
+
}
|
|
116
136
|
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
|
117
137
|
// ----------------------------- Warning --------------------------------
|
|
118
138
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -46,9 +46,6 @@ function LineHighlightPlot(props) {
|
|
|
46
46
|
} = useChartsContext();
|
|
47
47
|
const store = useStore();
|
|
48
48
|
const highlightedIndexes = store.use(selectorChartsHighlightXAxisIndex);
|
|
49
|
-
if (highlightedIndexes.length === 0) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
49
|
if (seriesData === undefined) {
|
|
53
50
|
return null;
|
|
54
51
|
}
|
|
@@ -58,54 +55,77 @@ function LineHighlightPlot(props) {
|
|
|
58
55
|
} = seriesData;
|
|
59
56
|
const defaultXAxisId = xAxisIds[0];
|
|
60
57
|
const defaultYAxisId = yAxisIds[0];
|
|
58
|
+
const hasStartEndMark = stackingGroups.some(({
|
|
59
|
+
ids
|
|
60
|
+
}) => ids.some(seriesId => series[seriesId].showMark === 'start' || series[seriesId].showMark === 'end'));
|
|
61
|
+
if (highlightedIndexes.length === 0 && !hasStartEndMark) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const getHighlightedIndex = new Map();
|
|
65
|
+
highlightedIndexes.forEach(({
|
|
66
|
+
axisId,
|
|
67
|
+
dataIndex
|
|
68
|
+
}) => {
|
|
69
|
+
getHighlightedIndex.set(axisId, dataIndex);
|
|
70
|
+
});
|
|
61
71
|
const Element = slots?.lineHighlight ?? LineHighlightElement;
|
|
62
72
|
return /*#__PURE__*/_jsx("g", _extends({}, other, {
|
|
63
|
-
children:
|
|
64
|
-
dataIndex: highlightedIndex,
|
|
65
|
-
axisId: highlightedAxisId
|
|
66
|
-
}) => stackingGroups.flatMap(({
|
|
73
|
+
children: stackingGroups.flatMap(({
|
|
67
74
|
ids: groupIds
|
|
68
|
-
}) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
75
|
+
}) => groupIds.flatMap(seriesId => {
|
|
76
|
+
const {
|
|
77
|
+
xAxisId = defaultXAxisId,
|
|
78
|
+
yAxisId = defaultYAxisId,
|
|
79
|
+
visibleStackedData,
|
|
80
|
+
data,
|
|
81
|
+
disableHighlight,
|
|
82
|
+
showMark,
|
|
83
|
+
shape = 'circle',
|
|
84
|
+
hidden
|
|
85
|
+
} = series[seriesId];
|
|
86
|
+
if (hidden) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const axisIndex = disableHighlight ? undefined : getHighlightedIndex.get(xAxisId);
|
|
90
|
+
const showMarkIndex = showMark === 'start' || showMark === 'end' ? getStartEndMarkIndex(data, showMark) : undefined;
|
|
91
|
+
const highlightedIndex = axisIndex ?? showMarkIndex;
|
|
92
|
+
if (highlightedIndex === undefined || data[highlightedIndex] == null) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
96
|
+
const yScale = yAxis[yAxisId].scale;
|
|
97
|
+
const xData = xAxis[xAxisId].data;
|
|
98
|
+
if (xData === undefined) {
|
|
99
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have a data property to be able to display a line plot. ` + 'The x-axis data defines the positions for each point in the line. ' + 'Provide a data array to the x-axis configuration.' : _formatErrorMessage(10, xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`));
|
|
100
|
+
}
|
|
101
|
+
const x = xScale(xData[highlightedIndex]);
|
|
102
|
+
const y = yScale(visibleStackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
103
|
+
if (!instance.isPointInside(x, y)) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
107
|
+
return /*#__PURE__*/_jsx(Element, _extends({
|
|
108
|
+
seriesId: seriesId,
|
|
109
|
+
color: colorGetter(highlightedIndex),
|
|
110
|
+
x: x,
|
|
111
|
+
y: y,
|
|
112
|
+
shape: shape
|
|
113
|
+
}, slotProps?.lineHighlight), `${seriesId}`);
|
|
106
114
|
}))
|
|
107
115
|
}));
|
|
108
116
|
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns the index of the first (`'start'`) or last (`'end'`) non-null item, or `-1` if none.
|
|
120
|
+
*/
|
|
121
|
+
function getStartEndMarkIndex(data, type) {
|
|
122
|
+
if (type === 'start') {
|
|
123
|
+
const index = data.findIndex(value => value != null);
|
|
124
|
+
return index < 0 ? undefined : index;
|
|
125
|
+
}
|
|
126
|
+
const index = data.findLastIndex(value => value != null);
|
|
127
|
+
return index < 0 ? undefined : index;
|
|
128
|
+
}
|
|
109
129
|
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
|
110
130
|
// ----------------------------- Warning --------------------------------
|
|
111
131
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -62,7 +62,7 @@ function MarkElement(props) {
|
|
|
62
62
|
} = props,
|
|
63
63
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
64
64
|
const store = (0, _useStore.useStore)();
|
|
65
|
-
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState)
|
|
65
|
+
const enablePositionBasedPointerInteraction = store.use(_useChartExperimentalFeature.selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
66
66
|
const interactionProps = (0, _useInteractionItemProps.useInteractionItemProps)({
|
|
67
67
|
type: 'line',
|
|
68
68
|
seriesId,
|
|
@@ -55,7 +55,7 @@ function MarkElement(props) {
|
|
|
55
55
|
} = props,
|
|
56
56
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
57
57
|
const store = useStore();
|
|
58
|
-
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState)
|
|
58
|
+
const enablePositionBasedPointerInteraction = store.use(selectorChartExperimentalFeaturesState, 'enablePositionBasedPointerInteraction');
|
|
59
59
|
const interactionProps = useInteractionItemProps({
|
|
60
60
|
type: 'line',
|
|
61
61
|
seriesId,
|
package/LineChart/MarkPlot.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type LineItemIdentifier } from "../models/seriesType/line.mjs";
|
|
3
3
|
import { type MarkElementProps } from "./MarkElement.mjs";
|
|
4
|
+
import type { MarkPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
|
|
4
5
|
export interface MarkPlotSlots {
|
|
5
|
-
mark?: React.JSXElementConstructor<MarkElementProps>;
|
|
6
|
+
mark?: React.JSXElementConstructor<MarkElementProps & MarkPropsOverrides>;
|
|
6
7
|
}
|
|
7
8
|
export interface MarkPlotSlotProps {
|
|
8
|
-
mark?: Partial<MarkElementProps
|
|
9
|
+
mark?: Partial<MarkElementProps> & MarkPropsOverrides;
|
|
9
10
|
}
|
|
10
11
|
export interface MarkPlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<MarkElementProps, 'skipAnimation'> {
|
|
11
12
|
/**
|
package/LineChart/MarkPlot.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type LineItemIdentifier } from "../models/seriesType/line.js";
|
|
3
3
|
import { type MarkElementProps } from "./MarkElement.js";
|
|
4
|
+
import type { MarkPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
4
5
|
export interface MarkPlotSlots {
|
|
5
|
-
mark?: React.JSXElementConstructor<MarkElementProps>;
|
|
6
|
+
mark?: React.JSXElementConstructor<MarkElementProps & MarkPropsOverrides>;
|
|
6
7
|
}
|
|
7
8
|
export interface MarkPlotSlotProps {
|
|
8
|
-
mark?: Partial<MarkElementProps
|
|
9
|
+
mark?: Partial<MarkElementProps> & MarkPropsOverrides;
|
|
9
10
|
}
|
|
10
11
|
export interface MarkPlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<MarkElementProps, 'skipAnimation'> {
|
|
11
12
|
/**
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.evaluateCurveAtAngle = evaluateCurveAtAngle;
|
|
7
8
|
exports.evaluateCurveY = evaluateCurveY;
|
|
9
|
+
var _bezierEasing = _interopRequireDefault(require("bezier-easing"));
|
|
10
|
+
var _warning = require("@mui/x-internals/warning");
|
|
8
11
|
var _epsilon = require("../../utils/epsilon");
|
|
9
12
|
var _getCurve = require("../../internals/getCurve");
|
|
10
13
|
var _clampAngle = require("../../internals/clampAngle");
|
|
@@ -75,22 +78,34 @@ function cubicBezierCoeffs(p0, p1, p2, p3) {
|
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
|
78
|
-
*
|
|
81
|
+
* Evaluate y on a segment at the given x.
|
|
82
|
+
*
|
|
83
|
+
* Line segments are interpolated linearly. Bezier segments are normalized so
|
|
84
|
+
* their endpoints become (0, 0) and (1, 1), passed to `bezier-easing`, and
|
|
85
|
+
* the result is mapped back to pixel space.
|
|
86
|
+
*
|
|
87
|
+
* Warns once if a curve produces control points outside the segment's x
|
|
88
|
+
* range.
|
|
79
89
|
*/
|
|
80
|
-
function
|
|
90
|
+
function evaluateSegmentYAtX(segment, targetX) {
|
|
91
|
+
const dx = segment.x1 - segment.x0;
|
|
92
|
+
if (dx === 0) {
|
|
93
|
+
return segment.y0;
|
|
94
|
+
}
|
|
95
|
+
const dy = segment.y1 - segment.y0;
|
|
81
96
|
if (!isBezierSegment(segment)) {
|
|
82
|
-
|
|
83
|
-
const dx = segment.x1 - segment.x0;
|
|
84
|
-
return dx === 0 ? 0 : (targetX - segment.x0) / dx;
|
|
97
|
+
return segment.y0 + dy * (targetX - segment.x0) / dx;
|
|
85
98
|
}
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (roots.length > 0) {
|
|
91
|
-
return roots[0];
|
|
99
|
+
const nx1 = (segment.cpx1 - segment.x0) / dx;
|
|
100
|
+
const nx2 = (segment.cpx2 - segment.x0) / dx;
|
|
101
|
+
if (process.env.NODE_ENV !== 'production' && (nx1 < 0 || nx1 > 1 || nx2 < 0 || nx2 > 1)) {
|
|
102
|
+
(0, _warning.warnOnce)(`MUI X Charts: a curve segment has control points outside its x range. ` + `Please report the curve type and data at https://github.com/mui/mui-x/issues ` + `so we can support it natively.`);
|
|
92
103
|
}
|
|
93
|
-
|
|
104
|
+
const ny1 = dy === 0 ? 0 : (segment.cpy1 - segment.y0) / dy;
|
|
105
|
+
const ny2 = dy === 0 ? 0 : (segment.cpy2 - segment.y0) / dy;
|
|
106
|
+
const ease = (0, _bezierEasing.default)(nx1, ny1, nx2, ny2);
|
|
107
|
+
const nt = (targetX - segment.x0) / dx;
|
|
108
|
+
return segment.y0 + dy * ease(nt);
|
|
94
109
|
}
|
|
95
110
|
|
|
96
111
|
/**
|
|
@@ -189,8 +204,7 @@ function evaluateCurveY(points, targetX, curveType) {
|
|
|
189
204
|
const xMin = Math.min(segment.x0, segment.x1);
|
|
190
205
|
const xMax = Math.max(segment.x0, segment.x1);
|
|
191
206
|
if (targetX >= xMin && targetX <= xMax) {
|
|
192
|
-
|
|
193
|
-
return evaluateSegmentY(segment, t);
|
|
207
|
+
return evaluateSegmentYAtX(segment, targetX);
|
|
194
208
|
}
|
|
195
209
|
}
|
|
196
210
|
return null;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import BezierEasing from 'bezier-easing';
|
|
2
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
1
3
|
import { EPSILON } from "../../utils/epsilon.mjs";
|
|
2
4
|
import { getCurveFactory } from "../../internals/getCurve.mjs";
|
|
3
5
|
import { clampAngleRad } from "../../internals/clampAngle.mjs";
|
|
@@ -69,22 +71,34 @@ function cubicBezierCoeffs(p0, p1, p2, p3) {
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
/**
|
|
72
|
-
*
|
|
74
|
+
* Evaluate y on a segment at the given x.
|
|
75
|
+
*
|
|
76
|
+
* Line segments are interpolated linearly. Bezier segments are normalized so
|
|
77
|
+
* their endpoints become (0, 0) and (1, 1), passed to `bezier-easing`, and
|
|
78
|
+
* the result is mapped back to pixel space.
|
|
79
|
+
*
|
|
80
|
+
* Warns once if a curve produces control points outside the segment's x
|
|
81
|
+
* range.
|
|
73
82
|
*/
|
|
74
|
-
function
|
|
83
|
+
function evaluateSegmentYAtX(segment, targetX) {
|
|
84
|
+
const dx = segment.x1 - segment.x0;
|
|
85
|
+
if (dx === 0) {
|
|
86
|
+
return segment.y0;
|
|
87
|
+
}
|
|
88
|
+
const dy = segment.y1 - segment.y0;
|
|
75
89
|
if (!isBezierSegment(segment)) {
|
|
76
|
-
|
|
77
|
-
const dx = segment.x1 - segment.x0;
|
|
78
|
-
return dx === 0 ? 0 : (targetX - segment.x0) / dx;
|
|
90
|
+
return segment.y0 + dy * (targetX - segment.x0) / dx;
|
|
79
91
|
}
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (roots.length > 0) {
|
|
85
|
-
return roots[0];
|
|
92
|
+
const nx1 = (segment.cpx1 - segment.x0) / dx;
|
|
93
|
+
const nx2 = (segment.cpx2 - segment.x0) / dx;
|
|
94
|
+
if (process.env.NODE_ENV !== 'production' && (nx1 < 0 || nx1 > 1 || nx2 < 0 || nx2 > 1)) {
|
|
95
|
+
warnOnce(`MUI X Charts: a curve segment has control points outside its x range. ` + `Please report the curve type and data at https://github.com/mui/mui-x/issues ` + `so we can support it natively.`);
|
|
86
96
|
}
|
|
87
|
-
|
|
97
|
+
const ny1 = dy === 0 ? 0 : (segment.cpy1 - segment.y0) / dy;
|
|
98
|
+
const ny2 = dy === 0 ? 0 : (segment.cpy2 - segment.y0) / dy;
|
|
99
|
+
const ease = BezierEasing(nx1, ny1, nx2, ny2);
|
|
100
|
+
const nt = (targetX - segment.x0) / dx;
|
|
101
|
+
return segment.y0 + dy * ease(nt);
|
|
88
102
|
}
|
|
89
103
|
|
|
90
104
|
/**
|
|
@@ -183,8 +197,7 @@ export function evaluateCurveY(points, targetX, curveType) {
|
|
|
183
197
|
const xMin = Math.min(segment.x0, segment.x1);
|
|
184
198
|
const xMax = Math.max(segment.x0, segment.x1);
|
|
185
199
|
if (targetX >= xMin && targetX <= xMax) {
|
|
186
|
-
|
|
187
|
-
return evaluateSegmentY(segment, t);
|
|
200
|
+
return evaluateSegmentYAtX(segment, targetX);
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
203
|
return null;
|
|
@@ -38,12 +38,16 @@ const getExtremumY = params => {
|
|
|
38
38
|
getFilters
|
|
39
39
|
} = params;
|
|
40
40
|
return Object.keys(series).filter(seriesId => {
|
|
41
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
41
44
|
const yAxisId = series[seriesId].yAxisId;
|
|
42
45
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
43
46
|
}).reduce((acc, seriesId) => {
|
|
44
47
|
const {
|
|
45
48
|
area,
|
|
46
49
|
stackedData,
|
|
50
|
+
visibleStackedData,
|
|
47
51
|
data
|
|
48
52
|
} = series[seriesId];
|
|
49
53
|
const isArea = area !== undefined;
|
|
@@ -56,7 +60,7 @@ const getExtremumY = params => {
|
|
|
56
60
|
|
|
57
61
|
// Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
58
62
|
const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
|
|
59
|
-
const seriesExtremums = getSeriesExtremums(getValues, data, stackedData, filter);
|
|
63
|
+
const seriesExtremums = getSeriesExtremums(getValues, data, axis.domainSeries === 'visible' ? visibleStackedData : stackedData, filter);
|
|
60
64
|
const [seriesMin, seriesMax] = seriesExtremums;
|
|
61
65
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
62
66
|
}, [Infinity, -Infinity]);
|