@mui/x-charts 9.2.0 → 9.4.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/BarChart.js +10 -10
- package/BarChart/BarChart.mjs +10 -10
- 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/BarChart/seriesConfig/bar/getColor.js +7 -53
- package/BarChart/seriesConfig/bar/getColor.mjs +7 -53
- package/BarChart/seriesConfig/bar/seriesProcessor.js +3 -1
- package/BarChart/seriesConfig/bar/seriesProcessor.mjs +3 -1
- package/BarChart/seriesConfig/bar/tooltip.js +4 -27
- package/BarChart/seriesConfig/bar/tooltip.mjs +4 -27
- package/CHANGELOG.md +314 -0
- package/ChartsContainer/ChartsContainer.js +30 -9
- package/ChartsContainer/ChartsContainer.mjs +30 -9
- package/ChartsLabel/ChartsLabelMark.js +1 -23
- package/ChartsLabel/ChartsLabelMark.mjs +0 -22
- package/ChartsLabel/labelMarkClasses.d.mts +0 -1
- package/ChartsLabel/labelMarkClasses.d.ts +0 -1
- package/ChartsLabel/labelMarkClasses.js +1 -2
- package/ChartsLabel/labelMarkClasses.mjs +2 -2
- package/ChartsLayerContainer/ChartsLayerContainer.js +36 -30
- package/ChartsLayerContainer/ChartsLayerContainer.mjs +36 -30
- 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/ChartsReferenceLine/ChartsXReferenceLine.js +6 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.mjs +6 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +5 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.mjs +5 -0
- package/ChartsTooltip/ChartTooltip.types.d.mts +3 -2
- package/ChartsTooltip/ChartTooltip.types.d.ts +3 -2
- 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/ChartsXAxis.js +3 -1
- package/ChartsXAxis/ChartsXAxis.mjs +3 -1
- package/ChartsXAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsXAxis/useAxisTicksProps.d.ts +84 -3
- package/ChartsYAxis/ChartsYAxis.js +3 -1
- package/ChartsYAxis/ChartsYAxis.mjs +3 -1
- 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/LineChart.js +6 -6
- package/LineChart/LineChart.mjs +6 -6
- package/LineChart/LineElement.d.mts +3 -2
- package/LineChart/LineElement.d.ts +3 -2
- 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/MarkPlot.d.mts +3 -2
- package/LineChart/MarkPlot.d.ts +3 -2
- package/LineChart/seriesConfig/curveEvaluation.js +40 -15
- package/LineChart/seriesConfig/curveEvaluation.mjs +39 -15
- package/LineChart/seriesConfig/extremums.js +5 -1
- package/LineChart/seriesConfig/extremums.mjs +5 -1
- package/LineChart/seriesConfig/getColor.js +7 -54
- package/LineChart/seriesConfig/getColor.mjs +7 -54
- package/LineChart/seriesConfig/seriesProcessor.d.mts +2 -4
- package/LineChart/seriesConfig/seriesProcessor.d.ts +2 -4
- package/LineChart/seriesConfig/seriesProcessor.js +2 -139
- package/LineChart/seriesConfig/seriesProcessor.mjs +2 -138
- package/LineChart/seriesConfig/tooltip.js +4 -25
- package/LineChart/seriesConfig/tooltip.mjs +4 -25
- 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/PieChart/PieChart.js +6 -6
- package/PieChart/PieChart.mjs +6 -6
- package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +2 -2
- package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +2 -2
- package/RadarChart/RadarAxis/useRadarAxis.js +1 -1
- package/RadarChart/RadarAxis/useRadarAxis.mjs +1 -1
- package/RadarChart/RadarChart.js +8 -8
- package/RadarChart/RadarChart.mjs +8 -8
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +1 -0
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +1 -0
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +1 -0
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.mjs +1 -0
- 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 +32 -11
- package/ScatterChart/ScatterChart.mjs +32 -11
- package/ScatterChart/ScatterMarker.types.d.mts +3 -2
- package/ScatterChart/ScatterMarker.types.d.ts +3 -2
- package/ScatterChart/ScatterPlot.d.mts +3 -2
- package/ScatterChart/ScatterPlot.d.ts +3 -2
- package/ScatterChart/ScatterPlot.js +6 -1
- package/ScatterChart/ScatterPlot.mjs +6 -1
- 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/seriesConfig/tooltip.js +2 -24
- package/ScatterChart/seriesConfig/tooltip.mjs +2 -24
- 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 +27 -27
- package/SparkLineChart/SparkLineChart.mjs +27 -27
- 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/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.js +1 -1
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.mjs +1 -1
- 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/getLineLikeTooltip.d.mts +9 -0
- package/internals/getLineLikeTooltip.d.ts +9 -0
- package/internals/getLineLikeTooltip.js +38 -0
- package/internals/getLineLikeTooltip.mjs +31 -0
- 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 +5 -0
- package/internals/index.d.ts +5 -0
- package/internals/index.js +48 -0
- package/internals/index.mjs +5 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.mts +4 -2
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.ts +4 -2
- 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/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 +6 -2
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.mjs +6 -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/processLineLikeSeries.d.mts +6 -0
- package/internals/processLineLikeSeries.d.ts +6 -0
- package/internals/processLineLikeSeries.js +145 -0
- package/internals/processLineLikeSeries.mjs +138 -0
- package/internals/resolveColorProcessor.d.mts +11 -0
- package/internals/resolveColorProcessor.d.ts +11 -0
- package/internals/resolveColorProcessor.js +62 -0
- package/internals/resolveColorProcessor.mjs +56 -0
- 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/line.d.mts +5 -2
- package/models/seriesType/line.d.ts +5 -2
- package/models/seriesType/scatter.d.mts +34 -2
- package/models/seriesType/scatter.d.ts +34 -2
- 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 +6 -6
package/PieChart/PieChart.js
CHANGED
|
@@ -184,11 +184,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
184
184
|
*/
|
|
185
185
|
highlightedItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
186
186
|
dataIndex: _propTypes.default.number,
|
|
187
|
-
seriesId: _propTypes.default.string.isRequired
|
|
188
|
-
type: _propTypes.default.oneOf(['pie']).isRequired
|
|
187
|
+
seriesId: _propTypes.default.string.isRequired
|
|
189
188
|
}), _propTypes.default.shape({
|
|
190
189
|
dataIndex: _propTypes.default.number,
|
|
191
|
-
seriesId: _propTypes.default.string.isRequired
|
|
190
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
191
|
+
type: _propTypes.default.oneOf(['pie']).isRequired
|
|
192
192
|
})]),
|
|
193
193
|
/**
|
|
194
194
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -305,11 +305,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
305
305
|
*/
|
|
306
306
|
tooltipItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
307
307
|
dataIndex: _propTypes.default.number.isRequired,
|
|
308
|
-
seriesId: _propTypes.default.string.isRequired
|
|
309
|
-
type: _propTypes.default.oneOf(['pie']).isRequired
|
|
308
|
+
seriesId: _propTypes.default.string.isRequired
|
|
310
309
|
}), _propTypes.default.shape({
|
|
311
310
|
dataIndex: _propTypes.default.number.isRequired,
|
|
312
|
-
seriesId: _propTypes.default.string.isRequired
|
|
311
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
312
|
+
type: _propTypes.default.oneOf(['pie']).isRequired
|
|
313
313
|
})]),
|
|
314
314
|
/**
|
|
315
315
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
package/PieChart/PieChart.mjs
CHANGED
|
@@ -177,11 +177,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
177
177
|
*/
|
|
178
178
|
highlightedItem: PropTypes.oneOfType([PropTypes.shape({
|
|
179
179
|
dataIndex: PropTypes.number,
|
|
180
|
-
seriesId: PropTypes.string.isRequired
|
|
181
|
-
type: PropTypes.oneOf(['pie']).isRequired
|
|
180
|
+
seriesId: PropTypes.string.isRequired
|
|
182
181
|
}), PropTypes.shape({
|
|
183
182
|
dataIndex: PropTypes.number,
|
|
184
|
-
seriesId: PropTypes.string.isRequired
|
|
183
|
+
seriesId: PropTypes.string.isRequired,
|
|
184
|
+
type: PropTypes.oneOf(['pie']).isRequired
|
|
185
185
|
})]),
|
|
186
186
|
/**
|
|
187
187
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -298,11 +298,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
298
298
|
*/
|
|
299
299
|
tooltipItem: PropTypes.oneOfType([PropTypes.shape({
|
|
300
300
|
dataIndex: PropTypes.number.isRequired,
|
|
301
|
-
seriesId: PropTypes.string.isRequired
|
|
302
|
-
type: PropTypes.oneOf(['pie']).isRequired
|
|
301
|
+
seriesId: PropTypes.string.isRequired
|
|
303
302
|
}), PropTypes.shape({
|
|
304
303
|
dataIndex: PropTypes.number.isRequired,
|
|
305
|
-
seriesId: PropTypes.string.isRequired
|
|
304
|
+
seriesId: PropTypes.string.isRequired,
|
|
305
|
+
type: PropTypes.oneOf(['pie']).isRequired
|
|
306
306
|
})]),
|
|
307
307
|
/**
|
|
308
308
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -7,13 +7,13 @@ interface GetLabelAttributesParams extends Required<Pick<RadarAxisProps, 'labelO
|
|
|
7
7
|
export declare function getLabelAttributes(params: GetLabelAttributesParams): {
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
10
|
-
textAnchor: "
|
|
10
|
+
textAnchor: "start" | "end" | "inherit" | "middle" | undefined;
|
|
11
11
|
dominantBaseline: "inherit" | "auto" | "text-before-edge" | "middle" | "central" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "use-script" | "no-change" | "reset-size" | undefined;
|
|
12
12
|
transform?: undefined;
|
|
13
13
|
} | {
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
|
-
textAnchor: "
|
|
16
|
+
textAnchor: "start" | "end" | "inherit" | "middle" | undefined;
|
|
17
17
|
dominantBaseline: "inherit" | "auto" | "text-before-edge" | "middle" | "central" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "use-script" | "no-change" | "reset-size" | undefined;
|
|
18
18
|
transform: string;
|
|
19
19
|
};
|
|
@@ -7,13 +7,13 @@ interface GetLabelAttributesParams extends Required<Pick<RadarAxisProps, 'labelO
|
|
|
7
7
|
export declare function getLabelAttributes(params: GetLabelAttributesParams): {
|
|
8
8
|
x: number;
|
|
9
9
|
y: number;
|
|
10
|
-
textAnchor: "
|
|
10
|
+
textAnchor: "start" | "end" | "inherit" | "middle" | undefined;
|
|
11
11
|
dominantBaseline: "inherit" | "auto" | "text-before-edge" | "middle" | "central" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "use-script" | "no-change" | "reset-size" | undefined;
|
|
12
12
|
transform?: undefined;
|
|
13
13
|
} | {
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
|
-
textAnchor: "
|
|
16
|
+
textAnchor: "start" | "end" | "inherit" | "middle" | undefined;
|
|
17
17
|
dominantBaseline: "inherit" | "auto" | "text-before-edge" | "middle" | "central" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "use-script" | "no-change" | "reset-size" | undefined;
|
|
18
18
|
transform: string;
|
|
19
19
|
};
|
|
@@ -38,7 +38,7 @@ function useRadarAxis(params) {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
const existingMetrics = rotationScale.domain();
|
|
41
|
-
if (!existingMetrics.includes(metric)) {
|
|
41
|
+
if (process.env.NODE_ENV !== 'production' && !existingMetrics.includes(metric)) {
|
|
42
42
|
(0, _warning.warnOnce)([`MUI X Charts: Your radar axis tries to display values for the metric "${metric}" which does not exist.`, `Either add this metric to your radar, or pick one from the existing metrics: ${existingMetrics.join(', ')}`]);
|
|
43
43
|
}
|
|
44
44
|
const anglesWithDefault = angle !== undefined ? (0, _degToRad.degToRad)(angle) : rotationScale(metric) ?? 0;
|
|
@@ -32,7 +32,7 @@ export function useRadarAxis(params) {
|
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
const existingMetrics = rotationScale.domain();
|
|
35
|
-
if (!existingMetrics.includes(metric)) {
|
|
35
|
+
if (process.env.NODE_ENV !== 'production' && !existingMetrics.includes(metric)) {
|
|
36
36
|
warnOnce([`MUI X Charts: Your radar axis tries to display values for the metric "${metric}" which does not exist.`, `Either add this metric to your radar, or pick one from the existing metrics: ${existingMetrics.join(', ')}`]);
|
|
37
37
|
}
|
|
38
38
|
const anglesWithDefault = angle !== undefined ? degToRad(angle) : rotationScale(metric) ?? 0;
|
package/RadarChart/RadarChart.js
CHANGED
|
@@ -151,11 +151,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
151
151
|
*/
|
|
152
152
|
highlightedItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
153
153
|
dataIndex: _propTypes.default.number,
|
|
154
|
-
seriesId: _propTypes.default.string.isRequired
|
|
155
|
-
type: _propTypes.default.oneOf(['radar']).isRequired
|
|
154
|
+
seriesId: _propTypes.default.string.isRequired
|
|
156
155
|
}), _propTypes.default.shape({
|
|
157
156
|
dataIndex: _propTypes.default.number,
|
|
158
|
-
seriesId: _propTypes.default.string.isRequired
|
|
157
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
158
|
+
type: _propTypes.default.oneOf(['radar']).isRequired
|
|
159
159
|
})]),
|
|
160
160
|
/**
|
|
161
161
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -256,11 +256,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
256
256
|
labelFormatter: _propTypes.default.func,
|
|
257
257
|
labelGap: _propTypes.default.number,
|
|
258
258
|
max: _propTypes.default.number,
|
|
259
|
-
metrics: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.
|
|
259
|
+
metrics: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.shape({
|
|
260
260
|
max: _propTypes.default.number,
|
|
261
261
|
min: _propTypes.default.number,
|
|
262
262
|
name: _propTypes.default.string.isRequired
|
|
263
|
-
}))]).isRequired,
|
|
263
|
+
})), _propTypes.default.arrayOf(_propTypes.default.string)]).isRequired,
|
|
264
264
|
startAngle: _propTypes.default.number
|
|
265
265
|
}).isRequired,
|
|
266
266
|
/**
|
|
@@ -313,11 +313,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
313
313
|
*/
|
|
314
314
|
tooltipItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
315
315
|
dataIndex: _propTypes.default.number,
|
|
316
|
-
seriesId: _propTypes.default.string.isRequired
|
|
317
|
-
type: _propTypes.default.oneOf(['radar']).isRequired
|
|
316
|
+
seriesId: _propTypes.default.string.isRequired
|
|
318
317
|
}), _propTypes.default.shape({
|
|
319
318
|
dataIndex: _propTypes.default.number,
|
|
320
|
-
seriesId: _propTypes.default.string.isRequired
|
|
319
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
320
|
+
type: _propTypes.default.oneOf(['radar']).isRequired
|
|
321
321
|
})]),
|
|
322
322
|
/**
|
|
323
323
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -144,11 +144,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
144
144
|
*/
|
|
145
145
|
highlightedItem: PropTypes.oneOfType([PropTypes.shape({
|
|
146
146
|
dataIndex: PropTypes.number,
|
|
147
|
-
seriesId: PropTypes.string.isRequired
|
|
148
|
-
type: PropTypes.oneOf(['radar']).isRequired
|
|
147
|
+
seriesId: PropTypes.string.isRequired
|
|
149
148
|
}), PropTypes.shape({
|
|
150
149
|
dataIndex: PropTypes.number,
|
|
151
|
-
seriesId: PropTypes.string.isRequired
|
|
150
|
+
seriesId: PropTypes.string.isRequired,
|
|
151
|
+
type: PropTypes.oneOf(['radar']).isRequired
|
|
152
152
|
})]),
|
|
153
153
|
/**
|
|
154
154
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -249,11 +249,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
249
249
|
labelFormatter: PropTypes.func,
|
|
250
250
|
labelGap: PropTypes.number,
|
|
251
251
|
max: PropTypes.number,
|
|
252
|
-
metrics: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.
|
|
252
|
+
metrics: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
|
|
253
253
|
max: PropTypes.number,
|
|
254
254
|
min: PropTypes.number,
|
|
255
255
|
name: PropTypes.string.isRequired
|
|
256
|
-
}))]).isRequired,
|
|
256
|
+
})), PropTypes.arrayOf(PropTypes.string)]).isRequired,
|
|
257
257
|
startAngle: PropTypes.number
|
|
258
258
|
}).isRequired,
|
|
259
259
|
/**
|
|
@@ -306,11 +306,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
306
306
|
*/
|
|
307
307
|
tooltipItem: PropTypes.oneOfType([PropTypes.shape({
|
|
308
308
|
dataIndex: PropTypes.number,
|
|
309
|
-
seriesId: PropTypes.string.isRequired
|
|
310
|
-
type: PropTypes.oneOf(['radar']).isRequired
|
|
309
|
+
seriesId: PropTypes.string.isRequired
|
|
311
310
|
}), PropTypes.shape({
|
|
312
311
|
dataIndex: PropTypes.number,
|
|
313
|
-
seriesId: PropTypes.string.isRequired
|
|
312
|
+
seriesId: PropTypes.string.isRequired,
|
|
313
|
+
type: PropTypes.oneOf(['radar']).isRequired
|
|
314
314
|
})]),
|
|
315
315
|
/**
|
|
316
316
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -69,7 +69,9 @@ function RadarSeriesArea(props) {
|
|
|
69
69
|
if (hidden) {
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
|
|
73
|
+
"data-series": id
|
|
74
|
+
}, getPathProps({
|
|
73
75
|
seriesId: id,
|
|
74
76
|
points,
|
|
75
77
|
color,
|
|
@@ -60,7 +60,9 @@ function RadarSeriesArea(props) {
|
|
|
60
60
|
if (hidden) {
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
|
-
return /*#__PURE__*/_jsx("path", _extends({
|
|
63
|
+
return /*#__PURE__*/_jsx("path", _extends({
|
|
64
|
+
"data-series": id
|
|
65
|
+
}, getPathProps({
|
|
64
66
|
seriesId: id,
|
|
65
67
|
points,
|
|
66
68
|
color,
|
|
@@ -64,6 +64,7 @@ function RadarSeriesMarks(props) {
|
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
67
|
+
"data-series": id,
|
|
67
68
|
children: points.map((point, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({}, getCircleProps({
|
|
68
69
|
seriesId: id,
|
|
69
70
|
point,
|
|
@@ -43,6 +43,7 @@ function RadarSeriesPlot(props) {
|
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
46
|
+
"data-series": seriesId,
|
|
46
47
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({}, (0, _RadarSeriesArea.getPathProps)({
|
|
47
48
|
seriesId,
|
|
48
49
|
points,
|
|
@@ -2,23 +2,17 @@ import { type DefaultizedScatterSeriesType } from "../models/seriesType/scatter.
|
|
|
2
2
|
import { type D3Scale } from "../models/axis.mjs";
|
|
3
3
|
import type { ScatterClasses } from "./scatterClasses.mjs";
|
|
4
4
|
import { type ColorGetter } from "../internals/plugins/corePlugins/useChartSeriesConfig/index.mjs";
|
|
5
|
+
import type { ScatterSizeGetter } from "./seriesConfig/getMarkerSize.mjs";
|
|
5
6
|
export interface BatchScatterProps {
|
|
6
7
|
series: DefaultizedScatterSeriesType;
|
|
7
8
|
xScale: D3Scale;
|
|
8
9
|
yScale: D3Scale;
|
|
9
10
|
color: string;
|
|
10
11
|
colorGetter?: ColorGetter<'scatter'>;
|
|
12
|
+
sizeGetter?: ScatterSizeGetter;
|
|
11
13
|
classes?: Partial<ScatterClasses>;
|
|
12
14
|
className?: string;
|
|
13
15
|
}
|
|
14
|
-
export interface BatchScatterPathsProps {
|
|
15
|
-
series: DefaultizedScatterSeriesType;
|
|
16
|
-
xScale: D3Scale;
|
|
17
|
-
yScale: D3Scale;
|
|
18
|
-
color: string;
|
|
19
|
-
colorGetter?: ColorGetter<'scatter'>;
|
|
20
|
-
markerSize: number;
|
|
21
|
-
}
|
|
22
16
|
/**
|
|
23
17
|
* @internal
|
|
24
18
|
* A batch version of the Scatter component that uses SVG paths to render points.
|
|
@@ -2,23 +2,17 @@ import { type DefaultizedScatterSeriesType } from "../models/seriesType/scatter.
|
|
|
2
2
|
import { type D3Scale } from "../models/axis.js";
|
|
3
3
|
import type { ScatterClasses } from "./scatterClasses.js";
|
|
4
4
|
import { type ColorGetter } from "../internals/plugins/corePlugins/useChartSeriesConfig/index.js";
|
|
5
|
+
import type { ScatterSizeGetter } from "./seriesConfig/getMarkerSize.js";
|
|
5
6
|
export interface BatchScatterProps {
|
|
6
7
|
series: DefaultizedScatterSeriesType;
|
|
7
8
|
xScale: D3Scale;
|
|
8
9
|
yScale: D3Scale;
|
|
9
10
|
color: string;
|
|
10
11
|
colorGetter?: ColorGetter<'scatter'>;
|
|
12
|
+
sizeGetter?: ScatterSizeGetter;
|
|
11
13
|
classes?: Partial<ScatterClasses>;
|
|
12
14
|
className?: string;
|
|
13
15
|
}
|
|
14
|
-
export interface BatchScatterPathsProps {
|
|
15
|
-
series: DefaultizedScatterSeriesType;
|
|
16
|
-
xScale: D3Scale;
|
|
17
|
-
yScale: D3Scale;
|
|
18
|
-
color: string;
|
|
19
|
-
colorGetter?: ColorGetter<'scatter'>;
|
|
20
|
-
markerSize: number;
|
|
21
|
-
}
|
|
22
16
|
/**
|
|
23
17
|
* @internal
|
|
24
18
|
* A batch version of the Scatter component that uses SVG paths to render points.
|
|
@@ -23,7 +23,7 @@ const ALMOST_ZERO = 0.01;
|
|
|
23
23
|
function createPath(x, y, markerSize) {
|
|
24
24
|
return `M${x - markerSize} ${y} a${markerSize} ${markerSize} 0 1 1 0 ${ALMOST_ZERO}`;
|
|
25
25
|
}
|
|
26
|
-
function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGetter) {
|
|
26
|
+
function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGetter, sizeGetter) {
|
|
27
27
|
const {
|
|
28
28
|
instance
|
|
29
29
|
} = (0, _ChartsProvider.useChartsContext)();
|
|
@@ -38,7 +38,8 @@ function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGett
|
|
|
38
38
|
if (!instance.isPointInside(x, y)) {
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const radius = sizeGetter ? sizeGetter(i) : markerSize;
|
|
42
|
+
const path = createPath(x, y, radius);
|
|
42
43
|
const fill = colorGetter ? colorGetter(i) : color;
|
|
43
44
|
const tempPath = (0, _appendAtKey.appendAtKey)(temporaryPaths, fill, path);
|
|
44
45
|
if (tempPath.length >= MAX_POINTS_PER_PATH) {
|
|
@@ -60,9 +61,10 @@ function BatchScatterPaths(props) {
|
|
|
60
61
|
yScale,
|
|
61
62
|
color,
|
|
62
63
|
colorGetter,
|
|
63
|
-
markerSize
|
|
64
|
+
markerSize,
|
|
65
|
+
sizeGetter
|
|
64
66
|
} = props;
|
|
65
|
-
const paths = useCreatePaths(series.data, markerSize, xScale, yScale, color, colorGetter);
|
|
67
|
+
const paths = useCreatePaths(series.data, markerSize, xScale, yScale, color, colorGetter, sizeGetter);
|
|
66
68
|
const children = [];
|
|
67
69
|
let i = 0;
|
|
68
70
|
for (const [fill, dArray] of paths.entries()) {
|
|
@@ -115,6 +117,7 @@ function BatchScatter(props) {
|
|
|
115
117
|
yScale,
|
|
116
118
|
color,
|
|
117
119
|
colorGetter,
|
|
120
|
+
sizeGetter,
|
|
118
121
|
className
|
|
119
122
|
} = props;
|
|
120
123
|
const {
|
|
@@ -122,20 +125,21 @@ function BatchScatter(props) {
|
|
|
122
125
|
} = (0, _ChartsProvider.useChartsContext)();
|
|
123
126
|
const isSeriesHighlighted = store.use(_useChartHighlight.selectorChartIsSeriesHighlighted, series.id);
|
|
124
127
|
const isSeriesFaded = store.use(_useChartHighlight.selectorChartIsSeriesFaded, series.id);
|
|
125
|
-
const
|
|
128
|
+
const seriesHighlightedItemDataIndex = store.use(_useChartHighlight.selectorChartSeriesHighlightedItem, series.id);
|
|
126
129
|
const seriesUnfadedItem = store.use(_useChartHighlight.selectorChartSeriesUnfadedItem, series.id);
|
|
127
130
|
const highlightedModifier = 1.2;
|
|
128
|
-
const
|
|
131
|
+
const highlightMultiplier = isSeriesHighlighted ? highlightedModifier : 1;
|
|
132
|
+
const getMarkerRadius = index => (sizeGetter ? sizeGetter(index) : series.markerSize) * highlightMultiplier;
|
|
129
133
|
const classes = (0, _scatterClasses.useUtilityClasses)(props);
|
|
130
134
|
const siblings = [];
|
|
131
|
-
if (
|
|
132
|
-
const datum = series.data[
|
|
135
|
+
if (seriesHighlightedItemDataIndex != null) {
|
|
136
|
+
const datum = series.data[seriesHighlightedItemDataIndex];
|
|
133
137
|
const getXPosition = (0, _getValueToPositionMapper.getValueToPositionMapper)(xScale);
|
|
134
138
|
const getYPosition = (0, _getValueToPositionMapper.getValueToPositionMapper)(yScale);
|
|
135
139
|
siblings.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
136
|
-
fill: colorGetter ? colorGetter(
|
|
140
|
+
fill: colorGetter ? colorGetter(seriesHighlightedItemDataIndex) : color,
|
|
137
141
|
"data-highlighted": true,
|
|
138
|
-
d: createPath(getXPosition(datum.x), getYPosition(datum.y),
|
|
142
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), getMarkerRadius(seriesHighlightedItemDataIndex) * highlightedModifier)
|
|
139
143
|
}, `highlighted-${series.id}`));
|
|
140
144
|
}
|
|
141
145
|
if (seriesUnfadedItem != null) {
|
|
@@ -144,7 +148,7 @@ function BatchScatter(props) {
|
|
|
144
148
|
const getYPosition = (0, _getValueToPositionMapper.getValueToPositionMapper)(yScale);
|
|
145
149
|
siblings.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
146
150
|
fill: colorGetter ? colorGetter(seriesUnfadedItem) : color,
|
|
147
|
-
d: createPath(getXPosition(datum.x), getYPosition(datum.y),
|
|
151
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), getMarkerRadius(seriesUnfadedItem))
|
|
148
152
|
}, `unfaded-${series.id}`));
|
|
149
153
|
}
|
|
150
154
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
@@ -159,7 +163,8 @@ function BatchScatter(props) {
|
|
|
159
163
|
yScale: yScale,
|
|
160
164
|
color: color,
|
|
161
165
|
colorGetter: colorGetter,
|
|
162
|
-
|
|
166
|
+
sizeGetter: getMarkerRadius,
|
|
167
|
+
markerSize: series.markerSize
|
|
163
168
|
})
|
|
164
169
|
}), siblings]
|
|
165
170
|
});
|
|
@@ -16,7 +16,7 @@ const ALMOST_ZERO = 0.01;
|
|
|
16
16
|
function createPath(x, y, markerSize) {
|
|
17
17
|
return `M${x - markerSize} ${y} a${markerSize} ${markerSize} 0 1 1 0 ${ALMOST_ZERO}`;
|
|
18
18
|
}
|
|
19
|
-
function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGetter) {
|
|
19
|
+
function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGetter, sizeGetter) {
|
|
20
20
|
const {
|
|
21
21
|
instance
|
|
22
22
|
} = useChartsContext();
|
|
@@ -31,7 +31,8 @@ function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGett
|
|
|
31
31
|
if (!instance.isPointInside(x, y)) {
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const radius = sizeGetter ? sizeGetter(i) : markerSize;
|
|
35
|
+
const path = createPath(x, y, radius);
|
|
35
36
|
const fill = colorGetter ? colorGetter(i) : color;
|
|
36
37
|
const tempPath = appendAtKey(temporaryPaths, fill, path);
|
|
37
38
|
if (tempPath.length >= MAX_POINTS_PER_PATH) {
|
|
@@ -53,9 +54,10 @@ function BatchScatterPaths(props) {
|
|
|
53
54
|
yScale,
|
|
54
55
|
color,
|
|
55
56
|
colorGetter,
|
|
56
|
-
markerSize
|
|
57
|
+
markerSize,
|
|
58
|
+
sizeGetter
|
|
57
59
|
} = props;
|
|
58
|
-
const paths = useCreatePaths(series.data, markerSize, xScale, yScale, color, colorGetter);
|
|
60
|
+
const paths = useCreatePaths(series.data, markerSize, xScale, yScale, color, colorGetter, sizeGetter);
|
|
59
61
|
const children = [];
|
|
60
62
|
let i = 0;
|
|
61
63
|
for (const [fill, dArray] of paths.entries()) {
|
|
@@ -108,6 +110,7 @@ export function BatchScatter(props) {
|
|
|
108
110
|
yScale,
|
|
109
111
|
color,
|
|
110
112
|
colorGetter,
|
|
113
|
+
sizeGetter,
|
|
111
114
|
className
|
|
112
115
|
} = props;
|
|
113
116
|
const {
|
|
@@ -115,20 +118,21 @@ export function BatchScatter(props) {
|
|
|
115
118
|
} = useChartsContext();
|
|
116
119
|
const isSeriesHighlighted = store.use(selectorChartIsSeriesHighlighted, series.id);
|
|
117
120
|
const isSeriesFaded = store.use(selectorChartIsSeriesFaded, series.id);
|
|
118
|
-
const
|
|
121
|
+
const seriesHighlightedItemDataIndex = store.use(selectorChartSeriesHighlightedItem, series.id);
|
|
119
122
|
const seriesUnfadedItem = store.use(selectorChartSeriesUnfadedItem, series.id);
|
|
120
123
|
const highlightedModifier = 1.2;
|
|
121
|
-
const
|
|
124
|
+
const highlightMultiplier = isSeriesHighlighted ? highlightedModifier : 1;
|
|
125
|
+
const getMarkerRadius = index => (sizeGetter ? sizeGetter(index) : series.markerSize) * highlightMultiplier;
|
|
122
126
|
const classes = useUtilityClasses(props);
|
|
123
127
|
const siblings = [];
|
|
124
|
-
if (
|
|
125
|
-
const datum = series.data[
|
|
128
|
+
if (seriesHighlightedItemDataIndex != null) {
|
|
129
|
+
const datum = series.data[seriesHighlightedItemDataIndex];
|
|
126
130
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
127
131
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
128
132
|
siblings.push(/*#__PURE__*/_jsx("path", {
|
|
129
|
-
fill: colorGetter ? colorGetter(
|
|
133
|
+
fill: colorGetter ? colorGetter(seriesHighlightedItemDataIndex) : color,
|
|
130
134
|
"data-highlighted": true,
|
|
131
|
-
d: createPath(getXPosition(datum.x), getYPosition(datum.y),
|
|
135
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), getMarkerRadius(seriesHighlightedItemDataIndex) * highlightedModifier)
|
|
132
136
|
}, `highlighted-${series.id}`));
|
|
133
137
|
}
|
|
134
138
|
if (seriesUnfadedItem != null) {
|
|
@@ -137,7 +141,7 @@ export function BatchScatter(props) {
|
|
|
137
141
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
138
142
|
siblings.push(/*#__PURE__*/_jsx("path", {
|
|
139
143
|
fill: colorGetter ? colorGetter(seriesUnfadedItem) : color,
|
|
140
|
-
d: createPath(getXPosition(datum.x), getYPosition(datum.y),
|
|
144
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), getMarkerRadius(seriesUnfadedItem))
|
|
141
145
|
}, `unfaded-${series.id}`));
|
|
142
146
|
}
|
|
143
147
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -152,7 +156,8 @@ export function BatchScatter(props) {
|
|
|
152
156
|
yScale: yScale,
|
|
153
157
|
color: color,
|
|
154
158
|
colorGetter: colorGetter,
|
|
155
|
-
|
|
159
|
+
sizeGetter: getMarkerRadius,
|
|
160
|
+
markerSize: series.markerSize
|
|
156
161
|
})
|
|
157
162
|
}), siblings]
|
|
158
163
|
});
|
|
@@ -32,9 +32,9 @@ function FocusedScatterMark(_ref) {
|
|
|
32
32
|
const {
|
|
33
33
|
cx,
|
|
34
34
|
cy,
|
|
35
|
-
|
|
35
|
+
markerSize
|
|
36
36
|
} = resolved;
|
|
37
|
-
const size =
|
|
37
|
+
const size = markerSize + 3;
|
|
38
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", (0, _extends2.default)({
|
|
39
39
|
className: (0, _clsx.default)(classes.focusedMark, className),
|
|
40
40
|
fill: "none",
|
|
@@ -25,9 +25,9 @@ export function FocusedScatterMark(_ref) {
|
|
|
25
25
|
const {
|
|
26
26
|
cx,
|
|
27
27
|
cy,
|
|
28
|
-
|
|
28
|
+
markerSize
|
|
29
29
|
} = resolved;
|
|
30
|
-
const size =
|
|
30
|
+
const size = markerSize + 3;
|
|
31
31
|
return /*#__PURE__*/_jsx("rect", _extends({
|
|
32
32
|
className: clsx(classes.focusedMark, className),
|
|
33
33
|
fill: "none",
|
|
@@ -46,12 +46,12 @@ function HighlightedScatterMark(_ref) {
|
|
|
46
46
|
const {
|
|
47
47
|
cx,
|
|
48
48
|
cy,
|
|
49
|
-
|
|
49
|
+
markerSize
|
|
50
50
|
} = resolved;
|
|
51
51
|
|
|
52
52
|
// Allow a markerSize margin around the drawing area so the highlight ring stays
|
|
53
53
|
// visible at the edges (e.g. during keyboard navigation) without needing a clip-path.
|
|
54
|
-
const margin =
|
|
54
|
+
const margin = markerSize;
|
|
55
55
|
if (cx < drawingArea.left - margin || cx > drawingArea.left + drawingArea.width + margin || cy < drawingArea.top - margin || cy > drawingArea.top + drawingArea.height + margin) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
@@ -62,7 +62,7 @@ function HighlightedScatterMark(_ref) {
|
|
|
62
62
|
strokeWidth: 1,
|
|
63
63
|
cx: cx,
|
|
64
64
|
cy: cy,
|
|
65
|
-
r:
|
|
65
|
+
r: markerSize,
|
|
66
66
|
pointerEvents: "none"
|
|
67
67
|
}, props));
|
|
68
68
|
}
|
|
@@ -40,12 +40,12 @@ export function HighlightedScatterMark(_ref) {
|
|
|
40
40
|
const {
|
|
41
41
|
cx,
|
|
42
42
|
cy,
|
|
43
|
-
|
|
43
|
+
markerSize
|
|
44
44
|
} = resolved;
|
|
45
45
|
|
|
46
46
|
// Allow a markerSize margin around the drawing area so the highlight ring stays
|
|
47
47
|
// visible at the edges (e.g. during keyboard navigation) without needing a clip-path.
|
|
48
|
-
const margin =
|
|
48
|
+
const margin = markerSize;
|
|
49
49
|
if (cx < drawingArea.left - margin || cx > drawingArea.left + drawingArea.width + margin || cy < drawingArea.top - margin || cy > drawingArea.top + drawingArea.height + margin) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
@@ -56,7 +56,7 @@ export function HighlightedScatterMark(_ref) {
|
|
|
56
56
|
strokeWidth: 1,
|
|
57
57
|
cx: cx,
|
|
58
58
|
cy: cy,
|
|
59
|
-
r:
|
|
59
|
+
r: markerSize,
|
|
60
60
|
pointerEvents: "none"
|
|
61
61
|
}, props));
|
|
62
62
|
}
|
|
@@ -3,6 +3,7 @@ import { type ScatterMarkerSlotProps, type ScatterMarkerSlots } from "./ScatterM
|
|
|
3
3
|
import { type DefaultizedScatterSeriesType, type ScatterItemIdentifier } from "../models/seriesType/scatter.mjs";
|
|
4
4
|
import { type D3Scale } from "../models/axis.mjs";
|
|
5
5
|
import { type ColorGetter } from "../internals/plugins/corePlugins/useChartSeriesConfig/index.mjs";
|
|
6
|
+
import type { ScatterSizeGetter } from "./seriesConfig/getMarkerSize.mjs";
|
|
6
7
|
import type { ScatterClasses } from "./scatterClasses.mjs";
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated The `Scatter` component is an internal implementation detail of `ScatterPlot` and will be removed from the public API in v10. Use `ScatterPlot` instead.
|
|
@@ -18,6 +19,10 @@ export interface ScatterProps {
|
|
|
18
19
|
* If provided, the color for the specific scatter item is returned.
|
|
19
20
|
*/
|
|
20
21
|
colorGetter: ColorGetter<'scatter'>;
|
|
22
|
+
/**
|
|
23
|
+
* Function to get the marker size of a scatter item given its data index.
|
|
24
|
+
*/
|
|
25
|
+
sizeGetter: ScatterSizeGetter;
|
|
21
26
|
/**
|
|
22
27
|
* Callback fired when clicking on a scatter item.
|
|
23
28
|
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
|
@@ -3,6 +3,7 @@ import { type ScatterMarkerSlotProps, type ScatterMarkerSlots } from "./ScatterM
|
|
|
3
3
|
import { type DefaultizedScatterSeriesType, type ScatterItemIdentifier } from "../models/seriesType/scatter.js";
|
|
4
4
|
import { type D3Scale } from "../models/axis.js";
|
|
5
5
|
import { type ColorGetter } from "../internals/plugins/corePlugins/useChartSeriesConfig/index.js";
|
|
6
|
+
import type { ScatterSizeGetter } from "./seriesConfig/getMarkerSize.js";
|
|
6
7
|
import type { ScatterClasses } from "./scatterClasses.js";
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated The `Scatter` component is an internal implementation detail of `ScatterPlot` and will be removed from the public API in v10. Use `ScatterPlot` instead.
|
|
@@ -18,6 +19,10 @@ export interface ScatterProps {
|
|
|
18
19
|
* If provided, the color for the specific scatter item is returned.
|
|
19
20
|
*/
|
|
20
21
|
colorGetter: ColorGetter<'scatter'>;
|
|
22
|
+
/**
|
|
23
|
+
* Function to get the marker size of a scatter item given its data index.
|
|
24
|
+
*/
|
|
25
|
+
sizeGetter: ScatterSizeGetter;
|
|
21
26
|
/**
|
|
22
27
|
* Callback fired when clicking on a scatter item.
|
|
23
28
|
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -50,6 +50,7 @@ function Scatter(props) {
|
|
|
50
50
|
xScale,
|
|
51
51
|
yScale,
|
|
52
52
|
colorGetter,
|
|
53
|
+
sizeGetter,
|
|
53
54
|
onItemClick,
|
|
54
55
|
classes: inClasses,
|
|
55
56
|
slots,
|
|
@@ -68,8 +69,7 @@ function Scatter(props) {
|
|
|
68
69
|
elementType: Marker,
|
|
69
70
|
externalSlotProps: slotProps?.marker,
|
|
70
71
|
additionalProps: {
|
|
71
|
-
seriesId: series.id
|
|
72
|
-
size: series.markerSize
|
|
72
|
+
seriesId: series.id
|
|
73
73
|
},
|
|
74
74
|
ownerState: {}
|
|
75
75
|
}),
|
|
@@ -88,6 +88,7 @@ function Scatter(props) {
|
|
|
88
88
|
className: (0, _clsx.default)(classes.marker, markerProps.className),
|
|
89
89
|
dataIndex: dataPoint.dataIndex,
|
|
90
90
|
color: colorGetter(dataPoint.dataIndex),
|
|
91
|
+
size: sizeGetter(dataPoint.dataIndex),
|
|
91
92
|
isHighlighted: isItemHighlighted,
|
|
92
93
|
isFaded: isItemFaded,
|
|
93
94
|
x: dataPoint.x,
|
|
@@ -123,6 +124,10 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
123
124
|
*/
|
|
124
125
|
onItemClick: _propTypes.default.func,
|
|
125
126
|
series: _propTypes.default.object.isRequired,
|
|
127
|
+
/**
|
|
128
|
+
* Function to get the marker size of a scatter item given its data index.
|
|
129
|
+
*/
|
|
130
|
+
sizeGetter: _propTypes.default.func.isRequired,
|
|
126
131
|
slotProps: _propTypes.default.object,
|
|
127
132
|
slots: _propTypes.default.object,
|
|
128
133
|
xScale: _propTypes.default.func.isRequired,
|