@mui/x-charts 8.14.1 → 8.16.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 +8 -0
- package/BarChart/BarChart.plugins.d.ts +2 -1
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/BarChart/seriesConfig/index.js +2 -0
- package/BarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/BarChart/seriesConfig/tooltipPosition.js +67 -0
- package/BarChart/useBarChartProps.js +4 -2
- package/BarChart/useBarPlotData.d.ts +17 -2
- package/BarChart/useBarPlotData.js +59 -34
- package/CHANGELOG.md +207 -0
- package/ChartContainer/ChartContainer.js +8 -0
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +9 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +102 -0
- package/ChartsBrushOverlay/index.d.ts +4 -0
- package/ChartsBrushOverlay/index.js +19 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +13 -8
- package/ChartsReferenceLine/ChartsYReferenceLine.js +13 -8
- package/ChartsReferenceLine/common.d.ts +3 -1
- package/ChartsReferenceLine/common.js +3 -1
- package/ChartsTooltip/ChartsTooltip.js +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +67 -23
- package/ChartsTooltip/useItemTooltip.js +7 -14
- package/ChartsWrapper/ChartsWrapper.js +2 -1
- package/ChartsXAxis/getVisibleLabels.js +45 -25
- package/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/LineChart/LineChart.js +8 -0
- package/LineChart/LineChart.plugins.d.ts +2 -1
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/LineChart/seriesConfig/index.js +2 -0
- package/LineChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/LineChart/seriesConfig/tooltipPosition.js +33 -0
- package/LineChart/useLineChartProps.js +4 -2
- package/PieChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/PieChart/seriesConfig/index.js +2 -0
- package/PieChart/seriesConfig/seriesProcessor.js +2 -1
- package/PieChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/PieChart/seriesConfig/tooltipPosition.js +75 -0
- package/RadarChart/RadarChart.plugins.d.ts +2 -2
- package/RadarChart/RadarChart.plugins.js +1 -1
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +1 -1
- package/RadarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/ScatterChart/ScatterChart.js +8 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/ScatterChart/seriesConfig/index.js +2 -0
- package/ScatterChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/ScatterChart/seriesConfig/tooltipPosition.js +33 -0
- package/ScatterChart/useScatterChartProps.js +5 -3
- package/SparkLineChart/SparkLineChart.js +8 -0
- package/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/BarChart/BarChart.js +8 -0
- package/esm/BarChart/BarChart.plugins.d.ts +2 -1
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/BarChart/seriesConfig/index.js +2 -0
- package/esm/BarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/BarChart/seriesConfig/tooltipPosition.js +61 -0
- package/esm/BarChart/useBarChartProps.js +4 -2
- package/esm/BarChart/useBarPlotData.d.ts +17 -2
- package/esm/BarChart/useBarPlotData.js +58 -34
- package/esm/ChartContainer/ChartContainer.js +8 -0
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -2
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -2
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +2 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +95 -0
- package/esm/ChartsBrushOverlay/index.d.ts +4 -0
- package/esm/ChartsBrushOverlay/index.js +2 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/common.d.ts +3 -1
- package/esm/ChartsReferenceLine/common.js +2 -0
- package/esm/ChartsTooltip/ChartsTooltip.js +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +68 -24
- package/esm/ChartsTooltip/useItemTooltip.js +9 -16
- package/esm/ChartsWrapper/ChartsWrapper.js +2 -1
- package/esm/ChartsXAxis/getVisibleLabels.js +45 -25
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/LineChart/LineChart.js +8 -0
- package/esm/LineChart/LineChart.plugins.d.ts +2 -1
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/LineChart/seriesConfig/index.js +2 -0
- package/esm/LineChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/LineChart/seriesConfig/tooltipPosition.js +27 -0
- package/esm/LineChart/useLineChartProps.js +4 -2
- package/esm/PieChart/seriesConfig/getSeriesWithDefaultValues.js +5 -6
- package/esm/PieChart/seriesConfig/index.js +2 -0
- package/esm/PieChart/seriesConfig/seriesProcessor.js +2 -1
- package/esm/PieChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/PieChart/seriesConfig/tooltipPosition.js +69 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +2 -2
- package/esm/RadarChart/RadarChart.plugins.js +1 -1
- package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +1 -1
- package/esm/RadarChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/ScatterChart/ScatterChart.js +8 -0
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
- package/esm/ScatterChart/seriesConfig/getSeriesWithDefaultValues.js +3 -3
- package/esm/ScatterChart/seriesConfig/index.js +2 -0
- package/esm/ScatterChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/tooltipPosition.js +27 -0
- package/esm/ScatterChart/useScatterChartProps.js +5 -3
- package/esm/SparkLineChart/SparkLineChart.js +8 -0
- package/esm/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useBrush.d.ts +18 -0
- package/esm/hooks/useBrush.js +16 -0
- package/esm/hooks/useFocusedItem.d.ts +1 -1
- package/esm/hooks/useInteractionItemProps.js +6 -2
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/configInit.d.ts +1 -1
- package/esm/internals/domUtils.d.ts +9 -4
- package/esm/internals/domUtils.js +115 -52
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.d.ts +3 -1
- package/esm/internals/index.js +3 -1
- package/esm/internals/isCartesian.d.ts +3 -2
- package/esm/internals/isCartesian.js +3 -0
- package/esm/internals/plugins/allPlugins.d.ts +4 -3
- package/esm/internals/plugins/allPlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +19 -10
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +6 -4
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +126 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +75 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +81 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +2 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +5 -1
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +40 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +4 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +5 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +8 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +21 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -6
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +4 -3
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -1
- package/esm/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/esm/internals/plugins/models/seriesConfig/index.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +24 -0
- package/esm/internals/plugins/utils/selectors.d.ts +1 -1
- package/esm/internals/scales/index.d.ts +3 -0
- package/esm/internals/scales/index.js +3 -0
- package/esm/internals/scales/scaleBand.d.ts +25 -0
- package/esm/internals/scales/scaleBand.js +159 -0
- package/esm/internals/scales/scalePoint.d.ts +25 -0
- package/esm/internals/scales/scalePoint.js +41 -0
- package/esm/internals/scales/scaleSymlog.d.ts +38 -0
- package/esm/internals/{symlogScale.js → scales/scaleSymlog.js} +40 -2
- package/esm/locales/elGR.js +97 -99
- package/esm/models/seriesType/common.d.ts +3 -2
- package/esm/tests/constants.js +1 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +12 -0
- package/hooks/useBrush.d.ts +18 -0
- package/hooks/useBrush.js +21 -0
- package/hooks/useFocusedItem.d.ts +1 -1
- package/hooks/useInteractionItemProps.js +6 -2
- package/index.d.ts +2 -1
- package/index.js +13 -1
- package/internals/configInit.d.ts +1 -1
- package/internals/domUtils.d.ts +9 -4
- package/internals/domUtils.js +119 -54
- package/internals/getScale.js +2 -2
- package/internals/index.d.ts +3 -1
- package/internals/index.js +24 -0
- package/internals/isCartesian.d.ts +3 -2
- package/internals/isCartesian.js +4 -0
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +19 -10
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +6 -4
- package/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/index.js +38 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +134 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +81 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +2 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +46 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +10 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +5 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +7 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +21 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +14 -7
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +4 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +3 -3
- package/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/internals/plugins/models/seriesConfig/index.js +11 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +24 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.js +5 -0
- package/internals/plugins/utils/selectors.d.ts +1 -1
- package/internals/scales/index.d.ts +3 -0
- package/internals/scales/index.js +38 -0
- package/internals/scales/scaleBand.d.ts +25 -0
- package/internals/scales/scaleBand.js +167 -0
- package/internals/scales/scalePoint.d.ts +25 -0
- package/internals/scales/scalePoint.js +46 -0
- package/internals/scales/scaleSymlog.d.ts +38 -0
- package/internals/{symlogScale.js → scales/scaleSymlog.js} +39 -2
- package/locales/elGR.js +97 -99
- package/models/seriesType/common.d.ts +3 -2
- package/package.json +4 -4
- package/tests/constants.js +7 -0
- package/esm/internals/Flatbush.bench.js +0 -42
- package/esm/internals/symlogScale.d.ts +0 -2
- package/internals/Flatbush.bench.js +0 -44
- package/internals/symlogScale.d.ts +0 -2
- /package/esm/internals/{Flatbush.bench.d.ts → plugins/featurePlugins/useChartBrush/useChartBrush.types.js} +0 -0
- /package/{internals/Flatbush.bench.d.ts → esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.js} +0 -0
|
@@ -90,6 +90,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
90
90
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
91
91
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
92
92
|
}),
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for the brush interaction.
|
|
95
|
+
*/
|
|
96
|
+
brushConfig: PropTypes.shape({
|
|
97
|
+
enabled: PropTypes.bool,
|
|
98
|
+
preventHighlight: PropTypes.bool,
|
|
99
|
+
preventTooltip: PropTypes.bool
|
|
100
|
+
}),
|
|
93
101
|
children: PropTypes.node,
|
|
94
102
|
className: PropTypes.string,
|
|
95
103
|
/**
|
|
@@ -4,5 +4,6 @@ import { UseChartInteractionSignature } from "../internals/plugins/featurePlugin
|
|
|
4
4
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
7
|
-
|
|
7
|
+
import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
8
|
+
export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'line'>, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
8
9
|
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;
|
|
@@ -3,4 +3,5 @@ import { useChartCartesianAxis } from "../internals/plugins/featurePlugins/useCh
|
|
|
3
3
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
|
-
|
|
6
|
+
import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
7
|
+
export const LINE_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartKeyboardNavigation];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
3
|
-
return _extends({
|
|
3
|
+
return _extends({}, seriesData, {
|
|
4
4
|
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
5
|
-
color: colors[seriesIndex % colors.length]
|
|
6
|
-
}
|
|
5
|
+
color: seriesData.color ?? colors[seriesIndex % colors.length]
|
|
6
|
+
});
|
|
7
7
|
};
|
|
8
8
|
export default getSeriesWithDefaultValues;
|
|
@@ -4,11 +4,13 @@ import getColor from "./getColor.js";
|
|
|
4
4
|
import legendGetter from "./legend.js";
|
|
5
5
|
import tooltipGetter, { axisTooltipGetter } from "./tooltip.js";
|
|
6
6
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
|
|
7
|
+
import tooltipItemPositionGetter from "./tooltipPosition.js";
|
|
7
8
|
export const seriesConfig = {
|
|
8
9
|
colorProcessor: getColor,
|
|
9
10
|
seriesProcessor,
|
|
10
11
|
legendGetter,
|
|
11
12
|
tooltipGetter,
|
|
13
|
+
tooltipItemPositionGetter,
|
|
12
14
|
axisTooltipGetter,
|
|
13
15
|
xExtremumGetter: getExtremumX,
|
|
14
16
|
yExtremumGetter: getExtremumY,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const tooltipItemPositionGetter = params => {
|
|
2
|
+
const {
|
|
3
|
+
series,
|
|
4
|
+
identifier,
|
|
5
|
+
axesConfig
|
|
6
|
+
} = params;
|
|
7
|
+
if (!identifier || identifier.dataIndex === undefined) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const itemSeries = series.line?.series[identifier.seriesId];
|
|
11
|
+
if (itemSeries == null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (axesConfig.x === undefined || axesConfig.y === undefined) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const xValue = axesConfig.x.data?.[identifier.dataIndex];
|
|
18
|
+
const yValue = itemSeries.data[identifier.dataIndex];
|
|
19
|
+
if (xValue == null || yValue == null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
x: axesConfig.x.scale(xValue),
|
|
24
|
+
y: axesConfig.y.scale(yValue)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default tooltipItemPositionGetter;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar", "brushConfig"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -39,7 +39,8 @@ export const useLineChartProps = props => {
|
|
|
39
39
|
loading,
|
|
40
40
|
highlightedItem,
|
|
41
41
|
onHighlightChange,
|
|
42
|
-
className
|
|
42
|
+
className,
|
|
43
|
+
brushConfig
|
|
43
44
|
} = props,
|
|
44
45
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
45
46
|
const id = useId();
|
|
@@ -68,6 +69,7 @@ export const useLineChartProps = props => {
|
|
|
68
69
|
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
69
70
|
className,
|
|
70
71
|
skipAnimation,
|
|
72
|
+
brushConfig,
|
|
71
73
|
plugins: LINE_CHART_PLUGINS
|
|
72
74
|
});
|
|
73
75
|
const gridProps = {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
3
|
-
return _extends({
|
|
4
|
-
id: seriesData.id ?? `auto-generated-id-${seriesIndex}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}, d))
|
|
3
|
+
return _extends({}, seriesData, {
|
|
4
|
+
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
5
|
+
data: seriesData.data.map((d, index) => _extends({}, d, {
|
|
6
|
+
color: d.color ?? colors[index % colors.length]
|
|
7
|
+
}))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
10
|
export default getSeriesWithDefaultValues;
|
|
@@ -3,10 +3,12 @@ import getColor from "./getColor.js";
|
|
|
3
3
|
import legendGetter from "./legend.js";
|
|
4
4
|
import tooltipGetter from "./tooltip.js";
|
|
5
5
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
|
|
6
|
+
import tooltipItemPositionGetter from "./tooltipPosition.js";
|
|
6
7
|
export const seriesConfig = {
|
|
7
8
|
colorProcessor: getColor,
|
|
8
9
|
seriesProcessor,
|
|
9
10
|
legendGetter,
|
|
10
11
|
tooltipGetter,
|
|
12
|
+
tooltipItemPositionGetter,
|
|
11
13
|
getSeriesWithDefaultValues
|
|
12
14
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { pie as d3Pie } from '@mui/x-charts-vendor/d3-shape';
|
|
3
3
|
import { getLabel } from "../../internals/getLabel.js";
|
|
4
|
+
import { deg2rad } from "../../internals/angleConversion.js";
|
|
4
5
|
const getSortingComparator = (comparator = 'none') => {
|
|
5
6
|
if (typeof comparator === 'function') {
|
|
6
7
|
return comparator;
|
|
@@ -23,7 +24,7 @@ const seriesProcessor = params => {
|
|
|
23
24
|
} = params;
|
|
24
25
|
const defaultizedSeries = {};
|
|
25
26
|
seriesOrder.forEach(seriesId => {
|
|
26
|
-
const arcs = d3Pie().startAngle(
|
|
27
|
+
const arcs = d3Pie().startAngle(deg2rad(series[seriesId].startAngle ?? 0)).endAngle(deg2rad(series[seriesId].endAngle ?? 360)).padAngle(deg2rad(series[seriesId].paddingAngle ?? 0)).sortValues(getSortingComparator(series[seriesId].sortingValues ?? 'none'))(series[seriesId].data.map(piePoint => piePoint.value));
|
|
27
28
|
defaultizedSeries[seriesId] = _extends({
|
|
28
29
|
labelMarkType: 'circle',
|
|
29
30
|
valueFormatter: item => item.value.toLocaleString()
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { findMinMax } from "../../internals/findMinMax.js";
|
|
2
|
+
import { getPercentageValue } from "../../internals/getPercentageValue.js";
|
|
3
|
+
import { getPieCoordinates } from "../getPieCoordinates.js";
|
|
4
|
+
const tooltipItemPositionGetter = params => {
|
|
5
|
+
const {
|
|
6
|
+
series,
|
|
7
|
+
drawingArea,
|
|
8
|
+
identifier,
|
|
9
|
+
placement
|
|
10
|
+
} = params;
|
|
11
|
+
if (!identifier || identifier.dataIndex === undefined) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const itemSeries = series.pie?.series[identifier.seriesId];
|
|
15
|
+
if (itemSeries == null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const {
|
|
19
|
+
cx,
|
|
20
|
+
cy,
|
|
21
|
+
availableRadius
|
|
22
|
+
} = getPieCoordinates({
|
|
23
|
+
cx: itemSeries.cx,
|
|
24
|
+
cy: itemSeries.cy
|
|
25
|
+
}, drawingArea);
|
|
26
|
+
const {
|
|
27
|
+
data,
|
|
28
|
+
innerRadius: baseInnerRadius = 0,
|
|
29
|
+
outerRadius: baseOuterRadius
|
|
30
|
+
} = itemSeries;
|
|
31
|
+
const innerRadius = Math.max(0, getPercentageValue(baseInnerRadius ?? 0, availableRadius));
|
|
32
|
+
const outerRadius = Math.max(0, getPercentageValue(baseOuterRadius ?? availableRadius, availableRadius));
|
|
33
|
+
const dataItem = data[identifier.dataIndex];
|
|
34
|
+
if (!dataItem) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Compute the 4 corner points of the arc to get the bounding box.
|
|
39
|
+
const points = [[innerRadius, dataItem.startAngle], [innerRadius, dataItem.endAngle], [outerRadius, dataItem.startAngle], [outerRadius, dataItem.endAngle]].map(([radius, angle]) => ({
|
|
40
|
+
x: cx + radius * Math.sin(angle),
|
|
41
|
+
y: cy - radius * Math.cos(angle)
|
|
42
|
+
}));
|
|
43
|
+
const [x0, x1] = findMinMax(points.map(p => p.x));
|
|
44
|
+
const [y0, y1] = findMinMax(points.map(p => p.y));
|
|
45
|
+
switch (placement) {
|
|
46
|
+
case 'bottom':
|
|
47
|
+
return {
|
|
48
|
+
x: (x1 + x0) / 2,
|
|
49
|
+
y: y1
|
|
50
|
+
};
|
|
51
|
+
case 'left':
|
|
52
|
+
return {
|
|
53
|
+
x: x0,
|
|
54
|
+
y: (y1 + y0) / 2
|
|
55
|
+
};
|
|
56
|
+
case 'right':
|
|
57
|
+
return {
|
|
58
|
+
x: x1,
|
|
59
|
+
y: (y1 + y0) / 2
|
|
60
|
+
};
|
|
61
|
+
case 'top':
|
|
62
|
+
default:
|
|
63
|
+
return {
|
|
64
|
+
x: (x1 + x0) / 2,
|
|
65
|
+
y: y0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export default tooltipItemPositionGetter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
2
2
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
3
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
|
-
export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<
|
|
5
|
-
export type RadarChartPluginSignatures = [
|
|
4
|
+
export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<UseChartInteractionSignature>, import("../internals/index.js").ChartPlugin<UseChartPolarAxisSignature<any>>, import("../internals/index.js").ChartPlugin<UseChartHighlightSignature>];
|
|
5
|
+
export type RadarChartPluginSignatures = [UseChartInteractionSignature, UseChartPolarAxisSignature, UseChartHighlightSignature];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { useChartPolarAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
2
2
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
3
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
|
-
export const RADAR_PLUGINS = [
|
|
4
|
+
export const RADAR_PLUGINS = [useChartInteraction, useChartPolarAxis, useChartHighlight];
|
|
@@ -17,8 +17,8 @@ export declare function useRadarSeriesData(querySeriesId?: SeriesId): {
|
|
|
17
17
|
}[];
|
|
18
18
|
type: "radar";
|
|
19
19
|
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
20
|
-
highlightScope?: import("../../index.js").HighlightScope | undefined;
|
|
21
20
|
labelMarkType?: import("../../internals/index.js").ChartsLabelMarkType | undefined;
|
|
21
|
+
highlightScope?: import("../../index.js").HighlightScope | undefined;
|
|
22
22
|
hideMark?: boolean | undefined;
|
|
23
23
|
fillArea?: boolean | undefined;
|
|
24
24
|
data: number[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
3
|
-
return _extends({
|
|
3
|
+
return _extends({}, seriesData, {
|
|
4
4
|
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
5
|
-
color: colors[seriesIndex % colors.length]
|
|
6
|
-
}
|
|
5
|
+
color: seriesData.color ?? colors[seriesIndex % colors.length]
|
|
6
|
+
});
|
|
7
7
|
};
|
|
8
8
|
export default getSeriesWithDefaultValues;
|
|
@@ -80,6 +80,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
80
80
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
81
81
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
82
82
|
}),
|
|
83
|
+
/**
|
|
84
|
+
* Configuration for the brush interaction.
|
|
85
|
+
*/
|
|
86
|
+
brushConfig: PropTypes.shape({
|
|
87
|
+
enabled: PropTypes.bool,
|
|
88
|
+
preventHighlight: PropTypes.bool,
|
|
89
|
+
preventTooltip: PropTypes.bool
|
|
90
|
+
}),
|
|
83
91
|
children: PropTypes.node,
|
|
84
92
|
className: PropTypes.string,
|
|
85
93
|
/**
|
|
@@ -5,5 +5,6 @@ import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/
|
|
|
5
5
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
6
6
|
import { UseChartClosestPointSignature } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
7
7
|
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
8
|
-
|
|
8
|
+
import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
9
|
+
export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
9
10
|
export declare const SCATTER_CHART_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartPluginSignatures>;
|
|
@@ -4,4 +4,5 @@ import { useChartInteraction } from "../internals/plugins/featurePlugins/useChar
|
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { useChartClosestPoint } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
6
6
|
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
7
|
-
|
|
7
|
+
import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
8
|
+
export const SCATTER_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
3
|
-
return _extends({
|
|
3
|
+
return _extends({}, seriesData, {
|
|
4
4
|
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
5
|
-
color: colors[seriesIndex % colors.length]
|
|
6
|
-
}
|
|
5
|
+
color: seriesData.color ?? colors[seriesIndex % colors.length]
|
|
6
|
+
});
|
|
7
7
|
};
|
|
8
8
|
export default getSeriesWithDefaultValues;
|
|
@@ -4,11 +4,13 @@ import getColor from "./getColor.js";
|
|
|
4
4
|
import legendGetter from "./legend.js";
|
|
5
5
|
import tooltipGetter from "./tooltip.js";
|
|
6
6
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
|
|
7
|
+
import tooltipItemPositionGetter from "./tooltipPosition.js";
|
|
7
8
|
export const seriesConfig = {
|
|
8
9
|
seriesProcessor,
|
|
9
10
|
colorProcessor: getColor,
|
|
10
11
|
legendGetter,
|
|
11
12
|
tooltipGetter,
|
|
13
|
+
tooltipItemPositionGetter,
|
|
12
14
|
xExtremumGetter: getExtremumX,
|
|
13
15
|
yExtremumGetter: getExtremumY,
|
|
14
16
|
getSeriesWithDefaultValues
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const tooltipItemPositionGetter = params => {
|
|
2
|
+
const {
|
|
3
|
+
series,
|
|
4
|
+
identifier,
|
|
5
|
+
axesConfig
|
|
6
|
+
} = params;
|
|
7
|
+
if (!identifier || identifier.dataIndex === undefined) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const itemSeries = series.scatter?.series[identifier.seriesId];
|
|
11
|
+
if (itemSeries == null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (axesConfig.x === undefined || axesConfig.y === undefined) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const xValue = itemSeries.data?.[identifier.dataIndex].x;
|
|
18
|
+
const yValue = itemSeries.data?.[identifier.dataIndex].y;
|
|
19
|
+
if (xValue == null || yValue == null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
x: axesConfig.x.scale(xValue),
|
|
24
|
+
y: axesConfig.y.scale(yValue)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default tooltipItemPositionGetter;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar", "renderer"];
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar", "renderer", "brushConfig"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { SCATTER_CHART_PLUGINS } from "./ScatterChart.plugins.js";
|
|
8
8
|
/**
|
|
@@ -35,7 +35,8 @@ export const useScatterChartProps = props => {
|
|
|
35
35
|
highlightedItem,
|
|
36
36
|
onHighlightChange,
|
|
37
37
|
className,
|
|
38
|
-
renderer
|
|
38
|
+
renderer,
|
|
39
|
+
brushConfig
|
|
39
40
|
} = props,
|
|
40
41
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
41
42
|
const seriesWithDefault = React.useMemo(() => series.map(s => _extends({
|
|
@@ -59,7 +60,8 @@ export const useScatterChartProps = props => {
|
|
|
59
60
|
className,
|
|
60
61
|
plugins: SCATTER_CHART_PLUGINS,
|
|
61
62
|
slots,
|
|
62
|
-
slotProps
|
|
63
|
+
slotProps,
|
|
64
|
+
brushConfig
|
|
63
65
|
});
|
|
64
66
|
const chartsAxisProps = {
|
|
65
67
|
slots,
|
|
@@ -179,6 +179,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
179
179
|
* @default 0
|
|
180
180
|
*/
|
|
181
181
|
baseline: PropTypes.oneOfType([PropTypes.oneOf(['max', 'min']), PropTypes.number]),
|
|
182
|
+
/**
|
|
183
|
+
* Configuration for the brush interaction.
|
|
184
|
+
*/
|
|
185
|
+
brushConfig: PropTypes.shape({
|
|
186
|
+
enabled: PropTypes.bool,
|
|
187
|
+
preventHighlight: PropTypes.bool,
|
|
188
|
+
preventTooltip: PropTypes.bool
|
|
189
|
+
}),
|
|
182
190
|
children: PropTypes.node,
|
|
183
191
|
className: PropTypes.string,
|
|
184
192
|
/**
|
|
@@ -21,7 +21,7 @@ export const defaultSeriesConfig = {
|
|
|
21
21
|
|
|
22
22
|
// For consistency with the v7, the cartesian axes are set by default.
|
|
23
23
|
// To remove them, you can provide a `plugins` props.
|
|
24
|
-
const defaultPlugins = [useChartZAxis,
|
|
24
|
+
const defaultPlugins = [useChartZAxis, useChartInteraction, useChartCartesianAxis, useChartHighlight];
|
|
25
25
|
function ChartProvider(props) {
|
|
26
26
|
const {
|
|
27
27
|
children,
|
package/esm/hooks/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@ export * from "./useLegend.js";
|
|
|
17
17
|
export { useChartGradientId, useChartGradientIdObjectBound } from "./useChartGradientId.js";
|
|
18
18
|
export * from "./animation/index.js";
|
|
19
19
|
export * from "./useChartRootRef.js";
|
|
20
|
-
export * from "./useChartsLocalization.js";
|
|
20
|
+
export * from "./useChartsLocalization.js";
|
|
21
|
+
export * from "./useBrush.js";
|
package/esm/hooks/index.js
CHANGED
|
@@ -17,4 +17,5 @@ export * from "./useLegend.js";
|
|
|
17
17
|
export { useChartGradientId, useChartGradientIdObjectBound } from "./useChartGradientId.js";
|
|
18
18
|
export * from "./animation/index.js";
|
|
19
19
|
export * from "./useChartRootRef.js";
|
|
20
|
-
export * from "./useChartsLocalization.js";
|
|
20
|
+
export * from "./useChartsLocalization.js";
|
|
21
|
+
export * from "./useBrush.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current brush state.
|
|
3
|
+
*
|
|
4
|
+
* - `start` is the starting point of the brush selection.
|
|
5
|
+
* - `current` is the current point of the brush selection.
|
|
6
|
+
*
|
|
7
|
+
* @returns `{ start, current }` - The brush state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useBrush(): {
|
|
10
|
+
start: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
current: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
} | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { selectorBrushState } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
2
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
3
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the current brush state.
|
|
7
|
+
*
|
|
8
|
+
* - `start` is the starting point of the brush selection.
|
|
9
|
+
* - `current` is the current point of the brush selection.
|
|
10
|
+
*
|
|
11
|
+
* @returns `{ start, current }` - The brush state.
|
|
12
|
+
*/
|
|
13
|
+
export function useBrush() {
|
|
14
|
+
const store = useStore();
|
|
15
|
+
return useSelector(store, selectorBrushState);
|
|
16
|
+
}
|
|
@@ -9,7 +9,7 @@ export type FocusedItemData = {
|
|
|
9
9
|
* Get the focused item from keyboard navigation.
|
|
10
10
|
*/
|
|
11
11
|
export declare function useFocusedItem(): {
|
|
12
|
-
seriesType:
|
|
12
|
+
seriesType: "line" | "bar" | "scatter" | "pie";
|
|
13
13
|
seriesId: SeriesId;
|
|
14
14
|
dataIndex: number;
|
|
15
15
|
} | null;
|
|
@@ -15,7 +15,9 @@ export const useInteractionItemProps = (data, skip) => {
|
|
|
15
15
|
const interactionActive = React.useRef(false);
|
|
16
16
|
const onPointerEnter = useEventCallback(() => {
|
|
17
17
|
interactionActive.current = true;
|
|
18
|
-
instance.setItemInteraction(data
|
|
18
|
+
instance.setItemInteraction(data, {
|
|
19
|
+
interaction: 'pointer'
|
|
20
|
+
});
|
|
19
21
|
instance.setHighlight(data);
|
|
20
22
|
});
|
|
21
23
|
const onPointerLeave = useEventCallback(() => {
|
|
@@ -56,7 +58,9 @@ export function getInteractionItemProps(instance, item) {
|
|
|
56
58
|
if (!item) {
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
59
|
-
instance.setItemInteraction(item
|
|
61
|
+
instance.setItemInteraction(item, {
|
|
62
|
+
interaction: 'pointer'
|
|
63
|
+
});
|
|
60
64
|
instance.setHighlight(item);
|
|
61
65
|
}
|
|
62
66
|
function onPointerLeave() {
|
package/esm/index.d.ts
CHANGED
|
@@ -28,4 +28,5 @@ export { ChartContainer } from "./ChartContainer/index.js";
|
|
|
28
28
|
export type { ChartContainerProps } from "./ChartContainer/index.js";
|
|
29
29
|
export * from "./ChartDataProvider/index.js";
|
|
30
30
|
export * from "./Toolbar/index.js";
|
|
31
|
-
export * from "./ChartsWrapper/index.js";
|
|
31
|
+
export * from "./ChartsWrapper/index.js";
|
|
32
|
+
export * from "./ChartsBrushOverlay/index.js";
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.
|
|
2
|
+
* @mui/x-charts v8.16.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -35,6 +35,7 @@ export { ChartContainer } from "./ChartContainer/index.js";
|
|
|
35
35
|
export * from "./ChartDataProvider/index.js";
|
|
36
36
|
export * from "./Toolbar/index.js";
|
|
37
37
|
export * from "./ChartsWrapper/index.js";
|
|
38
|
+
export * from "./ChartsBrushOverlay/index.js";
|
|
38
39
|
|
|
39
40
|
// Locales should be imported from `@mui/x-charts/locales`
|
|
40
41
|
// export * from './locales';
|
|
@@ -3,7 +3,7 @@ declare class CartesianSeriesTypes {
|
|
|
3
3
|
types: Set<CartesianChartSeriesType>;
|
|
4
4
|
constructor();
|
|
5
5
|
addType(value: CartesianChartSeriesType): void;
|
|
6
|
-
getTypes(): Set<"line" | "
|
|
6
|
+
getTypes(): Set<"line" | "bar" | "scatter">;
|
|
7
7
|
}
|
|
8
8
|
declare class PolarSeriesTypes {
|
|
9
9
|
types: Set<PolarChartSeriesType>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function clearStringMeasurementCache(): void;
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Converts a style object into a string to be used as a cache key
|
|
4
5
|
* @param style React style object
|
|
5
6
|
* @returns CSS styling string
|
|
6
7
|
*/
|
|
7
|
-
export declare
|
|
8
|
+
export declare function getStyleString(style: React.CSSProperties): string;
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
10
11
|
* @param text The string to estimate
|
|
@@ -14,4 +15,8 @@ export declare const getStyleString: (style: React.CSSProperties) => string;
|
|
|
14
15
|
export declare const getStringSize: (text: string | number, style?: React.CSSProperties) => {
|
|
15
16
|
width: number;
|
|
16
17
|
height: number;
|
|
17
|
-
};
|
|
18
|
+
};
|
|
19
|
+
export declare function batchMeasureStrings(texts: Iterable<string | number>, style?: React.CSSProperties): Map<string | number, {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}>;
|