@mui/x-charts 8.7.0 → 8.8.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.d.ts +1 -1
- package/BarChart/BarChart.js +16 -0
- package/CHANGELOG.md +98 -0
- package/ChartContainer/ChartContainer.js +22 -0
- package/ChartContainer/useChartContainerProps.js +8 -2
- package/ChartDataProvider/ChartDataProvider.js +6 -0
- package/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
- package/ChartDataProvider/useChartDataProviderProps.js +6 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +34 -24
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +34 -24
- package/Gauge/GaugeContainer.d.ts +1 -1
- package/LineChart/LineChart.js +22 -0
- package/LineChart/LineHighlightPlot.js +10 -4
- package/LineChart/MarkPlot.js +17 -3
- package/LineChart/useAreaPlotData.js +3 -2
- package/PieChart/PieChart.d.ts +1 -1
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +1 -1
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/BarChart/BarChart.d.ts +1 -1
- package/esm/BarChart/BarChart.js +16 -0
- package/esm/ChartContainer/ChartContainer.js +22 -0
- package/esm/ChartContainer/useChartContainerProps.js +8 -2
- package/esm/ChartDataProvider/ChartDataProvider.js +6 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -2
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +36 -26
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +36 -26
- package/esm/Gauge/GaugeContainer.d.ts +1 -1
- package/esm/LineChart/LineChart.js +22 -0
- package/esm/LineChart/LineHighlightPlot.js +11 -5
- package/esm/LineChart/MarkPlot.js +17 -3
- package/esm/LineChart/useAreaPlotData.js +3 -2
- package/esm/PieChart/PieChart.d.ts +1 -1
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +1 -1
- package/esm/ScatterChart/ScatterChart.d.ts +1 -1
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/hooks/useAxis.d.ts +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +3 -0
- package/esm/internals/constants.js +4 -0
- package/esm/internals/getLabel.d.ts +1 -1
- package/esm/internals/index.d.ts +1 -0
- package/esm/internals/index.js +1 -0
- package/esm/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
- package/esm/internals/plugins/corePlugins/corePlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +2 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +27 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +46 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +76 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +48 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +16 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/esm/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
- package/esm/internals/plugins/utils/useLazySelectorEffect.js +70 -0
- package/esm/internals/store/useCharts.d.ts +1 -1
- package/esm/models/axis.d.ts +15 -0
- package/esm/models/axis.js +4 -0
- package/esm/models/index.d.ts +1 -1
- package/esm/models/seriesType/scatter.d.ts +11 -2
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/props.d.ts +2 -0
- package/hooks/useAxis.d.ts +2 -2
- package/index.js +1 -1
- package/internals/constants.d.ts +3 -0
- package/internals/constants.js +5 -1
- package/internals/getLabel.d.ts +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +8 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
- package/internals/plugins/corePlugins/corePlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +27 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +34 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +5 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +21 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +24 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +46 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +55 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +18 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
- package/internals/plugins/utils/useLazySelectorEffect.js +77 -0
- package/internals/store/useCharts.d.ts +1 -1
- package/models/axis.d.ts +15 -0
- package/models/axis.js +4 -0
- package/models/index.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +11 -2
- package/package.json +4 -4
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
|
@@ -13,7 +13,7 @@ import { BarPlotSlots, BarPlotSlotProps } from "../BarChart/BarPlot.js";
|
|
|
13
13
|
import { ChartMargin } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js";
|
|
14
14
|
export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, Omit<BarPlotSlots, 'barLabel'>, ChartsTooltipSlots {}
|
|
15
15
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {}
|
|
16
|
-
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors' | 'slots' | 'slotProps'> {
|
|
16
|
+
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors' | 'slots' | 'slotProps' | 'experimentalFeatures'> {
|
|
17
17
|
/**
|
|
18
18
|
* The xAxis configuration.
|
|
19
19
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
@@ -206,6 +206,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
206
206
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
207
207
|
*/
|
|
208
208
|
height: PropTypes.number,
|
|
209
|
+
/**
|
|
210
|
+
* The controlled axis highlight.
|
|
211
|
+
* Identified by the axis id, and data index.
|
|
212
|
+
*/
|
|
213
|
+
highlightedAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
214
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
215
|
+
dataIndex: PropTypes.number.isRequired
|
|
216
|
+
})),
|
|
209
217
|
/**
|
|
210
218
|
* The highlighted item.
|
|
211
219
|
* Used when the highlight is controlled.
|
|
@@ -249,6 +257,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
249
257
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
250
258
|
*/
|
|
251
259
|
onHighlightChange: PropTypes.func,
|
|
260
|
+
/**
|
|
261
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
262
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
263
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
264
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
265
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
266
|
+
*/
|
|
267
|
+
onHighlightedAxisChange: PropTypes.func,
|
|
252
268
|
/**
|
|
253
269
|
* Callback fired when clicking close to an item.
|
|
254
270
|
* This is only available for scatter plot for now.
|
package/esm/hooks/useAxis.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { AxisId, ChartsRadiusAxisProps, ChartsRotationAxisProps, PolarAxisDefaul
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function useXAxes(): {
|
|
13
13
|
xAxis: import("../internals/index.js").ComputedAxisConfig<import("../index.js").ChartsXAxisProps>;
|
|
14
|
-
xAxisIds:
|
|
14
|
+
xAxisIds: AxisId[];
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Get all the y-axes.
|
|
@@ -25,7 +25,7 @@ export declare function useXAxes(): {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function useYAxes(): {
|
|
27
27
|
yAxis: import("../internals/index.js").ComputedAxisConfig<import("../index.js").ChartsYAxisProps>;
|
|
28
|
-
yAxisIds:
|
|
28
|
+
yAxisIds: AxisId[];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Get the X axis.
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ZoomSliderShowTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/zoom.types.js";
|
|
2
2
|
/** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
|
|
3
3
|
export declare const ZOOM_SLIDER_MARGIN = 4;
|
|
4
|
+
/** Size of the zoom slider preview. */
|
|
5
|
+
export declare const ZOOM_SLIDER_PREVIEW_SIZE = 40;
|
|
4
6
|
/** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
|
|
5
7
|
export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
|
|
8
|
+
export declare const DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE: number;
|
|
6
9
|
export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
|
|
7
10
|
/** Default margin for pie charts. */
|
|
8
11
|
export declare const DEFAULT_PIE_CHART_MARGIN: {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
|
|
2
2
|
export const ZOOM_SLIDER_MARGIN = 4;
|
|
3
3
|
|
|
4
|
+
/** Size of the zoom slider preview. */
|
|
5
|
+
export const ZOOM_SLIDER_PREVIEW_SIZE = 40;
|
|
6
|
+
|
|
4
7
|
/** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
|
|
5
8
|
export const DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
|
|
9
|
+
export const DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE = 40 + 2 * ZOOM_SLIDER_MARGIN;
|
|
6
10
|
export const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
|
|
7
11
|
|
|
8
12
|
/** Default margin for pie charts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getLabel<Location extends string>(value: string | ((location: Location) => string) | undefined, location: Location): string | undefined;
|
|
1
|
+
export declare function getLabel<Location extends string>(value: string | ((location: Location) => string | undefined) | undefined, location: Location): string | undefined;
|
package/esm/internals/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
|
7
7
|
export { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
8
8
|
export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
|
|
9
9
|
export { useScatterPlotData } from "../ScatterChart/useScatterPlotData.js";
|
|
10
|
+
export { seriesConfig as scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
|
|
10
11
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
11
12
|
export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
|
|
12
13
|
export { useLinePlotData } from "../LineChart/useLinePlotData.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
|
10
10
|
export { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
11
11
|
export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
|
|
12
12
|
export { useScatterPlotData } from "../ScatterChart/useScatterPlotData.js";
|
|
13
|
+
export { seriesConfig as scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
|
|
13
14
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
14
15
|
export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
|
|
15
16
|
export { useLinePlotData } from "../LineChart/useLinePlotData.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type UseChartAnimationSignature } from "./useChartAnimation/index.js";
|
|
2
2
|
import { type UseChartDimensionsSignature } from "./useChartDimensions/index.js";
|
|
3
|
+
import { type UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature/index.js";
|
|
3
4
|
import { type UseChartIdSignature, UseChartIdParameters } from "./useChartId/index.js";
|
|
4
5
|
import { type UseChartSeriesSignature } from "./useChartSeries/index.js";
|
|
5
6
|
import { type UseChartInteractionListenerSignature } from "./useChartInteractionListener/index.js";
|
|
@@ -7,6 +8,6 @@ import { type UseChartInteractionListenerSignature } from "./useChartInteraction
|
|
|
7
8
|
* Internal plugins that create the tools used by the other plugins.
|
|
8
9
|
* These plugins are used by the Charts components.
|
|
9
10
|
*/
|
|
10
|
-
export declare const CHART_CORE_PLUGINS: readonly [import("../models/index.js").ChartPlugin<UseChartIdSignature>, import("../models/index.js").ChartPlugin<UseChartDimensionsSignature>, import("../models/index.js").ChartPlugin<UseChartSeriesSignature>, import("../models/index.js").ChartPlugin<UseChartInteractionListenerSignature>, import("../models/index.js").ChartPlugin<UseChartAnimationSignature>];
|
|
11
|
-
export type ChartCorePluginSignatures = [UseChartIdSignature, UseChartDimensionsSignature, UseChartSeriesSignature, UseChartAnimationSignature, UseChartInteractionListenerSignature];
|
|
11
|
+
export declare const CHART_CORE_PLUGINS: readonly [import("../models/index.js").ChartPlugin<UseChartIdSignature>, import("../models/index.js").ChartPlugin<UseChartExperimentalFeaturesSignature>, import("../models/index.js").ChartPlugin<UseChartDimensionsSignature>, import("../models/index.js").ChartPlugin<UseChartSeriesSignature>, import("../models/index.js").ChartPlugin<UseChartInteractionListenerSignature>, import("../models/index.js").ChartPlugin<UseChartAnimationSignature>];
|
|
12
|
+
export type ChartCorePluginSignatures = [UseChartIdSignature, UseChartExperimentalFeaturesSignature, UseChartDimensionsSignature, UseChartSeriesSignature, UseChartAnimationSignature, UseChartInteractionListenerSignature];
|
|
12
13
|
export interface ChartCorePluginParameters extends UseChartIdParameters {}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useChartAnimation } from "./useChartAnimation/index.js";
|
|
2
2
|
import { useChartDimensions } from "./useChartDimensions/index.js";
|
|
3
|
+
import { useChartExperimentalFeatures } from "./useChartExperimentalFeature/index.js";
|
|
3
4
|
import { useChartId } from "./useChartId/index.js";
|
|
4
5
|
import { useChartSeries } from "./useChartSeries/index.js";
|
|
5
6
|
import { useChartInteractionListener } from "./useChartInteractionListener/index.js";
|
|
@@ -8,4 +9,4 @@ import { useChartInteractionListener } from "./useChartInteractionListener/index
|
|
|
8
9
|
* Internal plugins that create the tools used by the other plugins.
|
|
9
10
|
* These plugins are used by the Charts components.
|
|
10
11
|
*/
|
|
11
|
-
export const CHART_CORE_PLUGINS = [useChartId, useChartDimensions, useChartSeries, useChartInteractionListener, useChartAnimation];
|
|
12
|
+
export const CHART_CORE_PLUGINS = [useChartId, useChartExperimentalFeatures, useChartDimensions, useChartSeries, useChartInteractionListener, useChartAnimation];
|
package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const selectorChartSkipAnimation: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("./useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
1
|
+
export declare const selectorChartSkipAnimation: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("./useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
2
2
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3
3
|
} & {
|
|
4
4
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { UseChartDimensionsSignature } from "./useChartDimensions.types.js"
|
|
|
3
3
|
import { ChartState } from "../../models/chart.js";
|
|
4
4
|
export declare const selectorChartDimensionsState: ChartRootSelector<UseChartDimensionsSignature>;
|
|
5
5
|
export declare const selectorChartMargin: (state: ChartState<[UseChartDimensionsSignature]>) => import("./useChartDimensions.types.js").ChartMargin;
|
|
6
|
-
export declare const selectorChartDrawingArea: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
6
|
+
export declare const selectorChartDrawingArea: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
7
7
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
8
|
} & Partial<import("../../../index.js").UseChartCartesianAxisState> & {
|
|
9
9
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -15,7 +15,7 @@ export declare const selectorChartDrawingArea: import("reselect").Selector<impor
|
|
|
15
15
|
top: number;
|
|
16
16
|
bottom: number;
|
|
17
17
|
}, []>;
|
|
18
|
-
export declare const selectorChartPropsSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
18
|
+
export declare const selectorChartPropsSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
19
19
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
20
20
|
} & {
|
|
21
21
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -23,7 +23,7 @@ export declare const selectorChartPropsSize: import("reselect").Selector<import(
|
|
|
23
23
|
width: number | undefined;
|
|
24
24
|
height: number | undefined;
|
|
25
25
|
}, any[]>;
|
|
26
|
-
export declare const selectorChartContainerSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
26
|
+
export declare const selectorChartContainerSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
27
27
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
28
|
} & {
|
|
29
29
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useChartExperimentalFeatures } from "./useChartExperimentalFeature.js";
|
|
2
|
+
export type { UseChartExperimentalFeaturesSignature, UseChartExperimentalFeaturesParameters } from "./useChartExperimentalFeature.types.js";
|
|
3
|
+
export * from "./useChartExperimentalFeature.selectors.js";
|
package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
|
+
export const useChartExperimentalFeatures = ({
|
|
6
|
+
params,
|
|
7
|
+
store
|
|
8
|
+
}) => {
|
|
9
|
+
useEnhancedEffect(() => {
|
|
10
|
+
store.update(prevState => {
|
|
11
|
+
return _extends({}, prevState, {
|
|
12
|
+
experimentalFeatures: params.experimentalFeatures
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}, [store, params.experimentalFeatures]);
|
|
16
|
+
return {};
|
|
17
|
+
};
|
|
18
|
+
useChartExperimentalFeatures.params = {
|
|
19
|
+
experimentalFeatures: true
|
|
20
|
+
};
|
|
21
|
+
useChartExperimentalFeatures.getInitialState = ({
|
|
22
|
+
experimentalFeatures
|
|
23
|
+
}) => {
|
|
24
|
+
return {
|
|
25
|
+
experimentalFeatures
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartRootSelector } from "../../utils/selectors.js";
|
|
2
|
+
import type { UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.js";
|
|
3
|
+
export declare const selectorChartExperimentalFeaturesState: ChartRootSelector<UseChartExperimentalFeaturesSignature>;
|
|
4
|
+
export declare const selectorPreferStrictDomainInLineCharts: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
5
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
6
|
+
} & {
|
|
7
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
|
+
}, boolean, any[]>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createSelector } from "../../utils/selectors.js";
|
|
2
|
+
export const selectorChartExperimentalFeaturesState = state => state.experimentalFeatures;
|
|
3
|
+
export const selectorPreferStrictDomainInLineCharts = createSelector([selectorChartExperimentalFeaturesState], features => Boolean(features?.preferStrictDomainInLineCharts));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChartPluginSignature } from "../../models/index.js";
|
|
2
|
+
export interface ChartExperimentalFeatures {
|
|
3
|
+
/**
|
|
4
|
+
* Default domainLimit to strict for line chart x-axis.
|
|
5
|
+
*/
|
|
6
|
+
preferStrictDomainInLineCharts?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseChartExperimentalFeaturesParameters {
|
|
9
|
+
/**
|
|
10
|
+
* Options to enable features planned for the next major.
|
|
11
|
+
*/
|
|
12
|
+
experimentalFeatures?: ChartExperimentalFeatures;
|
|
13
|
+
}
|
|
14
|
+
export interface UseChartExperimentalFeaturesState {
|
|
15
|
+
experimentalFeatures?: ChartExperimentalFeatures;
|
|
16
|
+
}
|
|
17
|
+
export type UseChartExperimentalFeaturesSignature = ChartPluginSignature<{
|
|
18
|
+
params: UseChartExperimentalFeaturesParameters;
|
|
19
|
+
defaultizedParams: UseChartExperimentalFeaturesParameters;
|
|
20
|
+
state: UseChartExperimentalFeaturesState;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
4
4
|
* @returns {string} The id attribute of the chart.
|
|
5
5
|
*/
|
|
6
|
-
export declare const selectorChartId: import("reselect").Selector<import("./useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
6
|
+
export declare const selectorChartId: import("reselect").Selector<import("./useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
7
7
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
8
|
} & {
|
|
9
9
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ChartRootSelector } from "../../utils/selectors.js";
|
|
2
2
|
import { UseChartSeriesSignature } from "./useChartSeries.types.js";
|
|
3
3
|
export declare const selectorChartSeriesState: ChartRootSelector<UseChartSeriesSignature>;
|
|
4
|
-
export declare const selectorChartSeriesProcessed: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
4
|
+
export declare const selectorChartSeriesProcessed: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
5
5
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
6
6
|
} & {
|
|
7
7
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
8
|
}, import("./useChartSeries.types.js").ProcessedSeries<keyof import("../../../index.js").ChartsSeriesConfig>, any[]>;
|
|
9
|
-
export declare const selectorChartSeriesConfig: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
9
|
+
export declare const selectorChartSeriesConfig: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
10
10
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
11
11
|
} & {
|
|
12
12
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -7,7 +7,7 @@ import { ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries
|
|
|
7
7
|
import { GetZoomAxisFilters, ZoomData } from "./zoom.types.js";
|
|
8
8
|
export type ComputeResult<T extends ChartsAxisProps> = {
|
|
9
9
|
axis: ComputedAxisConfig<T>;
|
|
10
|
-
axisIds:
|
|
10
|
+
axisIds: AxisId[];
|
|
11
11
|
};
|
|
12
12
|
type ComputeCommonParams<T extends ChartSeriesType = ChartSeriesType> = {
|
|
13
13
|
drawingArea: ChartDrawingArea;
|
|
@@ -16,6 +16,10 @@ type ComputeCommonParams<T extends ChartSeriesType = ChartSeriesType> = {
|
|
|
16
16
|
zoomMap?: Map<AxisId, ZoomData>;
|
|
17
17
|
zoomOptions?: Record<AxisId, DefaultizedZoomOptions>;
|
|
18
18
|
getFilters?: GetZoomAxisFilters;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated To remove in v9. This is an experimental feature to avoid breaking change.
|
|
21
|
+
*/
|
|
22
|
+
preferStrictDomainInLineCharts?: boolean;
|
|
19
23
|
};
|
|
20
24
|
export declare function computeAxisValue<T extends ChartSeriesType>(options: ComputeCommonParams<T> & {
|
|
21
25
|
axis?: DefaultedYAxis[];
|
|
@@ -9,6 +9,7 @@ import { isDateData, createDateFormatter } from "../../../dateHelpers.js";
|
|
|
9
9
|
import { zoomScaleRange } from "./zoom.js";
|
|
10
10
|
import { getAxisExtremum } from "./getAxisExtremum.js";
|
|
11
11
|
import { getAxisTriggerTooltip } from "./getAxisTriggerTooltip.js";
|
|
12
|
+
import { getAxisDomainLimit } from "./getAxisDomainLimit.js";
|
|
12
13
|
function getRange(drawingArea, axisDirection,
|
|
13
14
|
// | 'rotation' | 'radius',
|
|
14
15
|
axis) {
|
|
@@ -25,7 +26,8 @@ export function computeAxisValue({
|
|
|
25
26
|
axisDirection,
|
|
26
27
|
zoomMap,
|
|
27
28
|
zoomOptions,
|
|
28
|
-
getFilters
|
|
29
|
+
getFilters,
|
|
30
|
+
preferStrictDomainInLineCharts
|
|
29
31
|
}) {
|
|
30
32
|
if (allAxis === undefined) {
|
|
31
33
|
return {
|
|
@@ -95,7 +97,7 @@ export function computeAxisValue({
|
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
99
|
const scaleType = axis.scaleType ?? 'linear';
|
|
98
|
-
const domainLimit = axis.domainLimit ?? 'nice';
|
|
100
|
+
const domainLimit = preferStrictDomainInLineCharts ? getAxisDomainLimit(axis, axisDirection, axisIndex, formattedSeries) : axis.domainLimit ?? 'nice';
|
|
99
101
|
const axisExtremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
100
102
|
if (typeof domainLimit === 'function') {
|
|
101
103
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP, DEFAULT_ZOOM_SLIDER_SIZE } from "../../../constants.js";
|
|
2
|
+
import { DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE, DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP, DEFAULT_ZOOM_SLIDER_SIZE } from "../../../constants.js";
|
|
3
3
|
export const defaultZoomOptions = {
|
|
4
4
|
minStart: 0,
|
|
5
5
|
maxEnd: 100,
|
|
@@ -10,6 +10,7 @@ export const defaultZoomOptions = {
|
|
|
10
10
|
filterMode: 'keep',
|
|
11
11
|
slider: {
|
|
12
12
|
enabled: false,
|
|
13
|
+
preview: false,
|
|
13
14
|
size: DEFAULT_ZOOM_SLIDER_SIZE,
|
|
14
15
|
showTooltip: DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP
|
|
15
16
|
}
|
|
@@ -28,6 +29,8 @@ export const defaultizeZoom = (zoom, axisId, axisDirection) => {
|
|
|
28
29
|
axisId,
|
|
29
30
|
axisDirection
|
|
30
31
|
}, defaultZoomOptions, zoom, {
|
|
31
|
-
slider: _extends({}, defaultZoomOptions.slider,
|
|
32
|
+
slider: _extends({}, defaultZoomOptions.slider, {
|
|
33
|
+
size: zoom.slider?.preview ?? defaultZoomOptions.slider.preview ? DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE : DEFAULT_ZOOM_SLIDER_SIZE
|
|
34
|
+
}, zoom.slider)
|
|
32
35
|
});
|
|
33
36
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AxisConfig } from "../../../../models/axis.js";
|
|
2
|
+
import { CartesianChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
3
|
+
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
export declare const getAxisDomainLimit: <T extends CartesianChartSeriesType>(axis: AxisConfig, axisDirection: "x" | "y", axisIndex: number, formattedSeries: ProcessedSeries<T | "line">) => "nice" | "strict" | ((min: number, max: number) => {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const getAxisDomainLimit = (axis, axisDirection, axisIndex, formattedSeries) => {
|
|
2
|
+
if (axis.domainLimit !== undefined) {
|
|
3
|
+
return axis.domainLimit;
|
|
4
|
+
}
|
|
5
|
+
if (axisDirection === 'x') {
|
|
6
|
+
for (const seriesId of formattedSeries.line?.seriesOrder ?? []) {
|
|
7
|
+
const series = formattedSeries.line.series[seriesId];
|
|
8
|
+
if (series.xAxisId === axis.id || series.xAxisId === undefined && axisIndex === 0) {
|
|
9
|
+
return 'strict';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return 'nice';
|
|
14
|
+
};
|
|
@@ -3,6 +3,8 @@ export type * from "./useChartCartesianAxis.types.js";
|
|
|
3
3
|
export * from "./useChartCartesianAxisRendering.selectors.js";
|
|
4
4
|
export * from "./useChartCartesianAxisLayout.selectors.js";
|
|
5
5
|
export * from "./useChartCartesianInteraction.selectors.js";
|
|
6
|
+
export * from "./useChartCartesianHighlight.selectors.js";
|
|
7
|
+
export * from "./useChartCartesianAxisPreview.selectors.js";
|
|
6
8
|
export { defaultizeXAxis, defaultizeYAxis } from "./defaultizeAxis.js";
|
|
7
9
|
export * from "./computeAxisValue.js";
|
|
8
10
|
export * from "./createZoomLookup.js";
|
|
@@ -2,6 +2,8 @@ export { useChartCartesianAxis } from "./useChartCartesianAxis.js";
|
|
|
2
2
|
export * from "./useChartCartesianAxisRendering.selectors.js";
|
|
3
3
|
export * from "./useChartCartesianAxisLayout.selectors.js";
|
|
4
4
|
export * from "./useChartCartesianInteraction.selectors.js";
|
|
5
|
+
export * from "./useChartCartesianHighlight.selectors.js";
|
|
6
|
+
export * from "./useChartCartesianAxisPreview.selectors.js";
|
|
5
7
|
export { defaultizeXAxis, defaultizeYAxis } from "./defaultizeAxis.js";
|
|
6
8
|
export * from "./computeAxisValue.js";
|
|
7
9
|
export * from "./createZoomLookup.js";
|
package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export declare const selectorChartLeftAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
1
|
+
export declare const selectorChartLeftAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
2
2
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3
3
|
} & {
|
|
4
4
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
5
|
}, number, []>;
|
|
6
|
-
export declare const selectorChartRightAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
6
|
+
export declare const selectorChartRightAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
7
7
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
8
|
} & {
|
|
9
9
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
10
10
|
}, number, []>;
|
|
11
|
-
export declare const selectorChartTopAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
11
|
+
export declare const selectorChartTopAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
12
12
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
13
13
|
} & {
|
|
14
14
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
15
15
|
}, number, []>;
|
|
16
|
-
export declare const selectorChartBottomAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
16
|
+
export declare const selectorChartBottomAxisSize: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
17
17
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
18
18
|
} & {
|
|
19
19
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
6
|
+
import { useAssertModelConsistency } from '@mui/x-internals/useAssertModelConsistency';
|
|
5
7
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
6
8
|
import { rainbowSurgePalette } from "../../../../colorPalettes/index.js";
|
|
7
9
|
import { useSelector } from "../../../store/useSelector.js";
|
|
@@ -12,6 +14,8 @@ import { selectorChartXAxis, selectorChartYAxis } from "./useChartCartesianAxisR
|
|
|
12
14
|
import { getAxisIndex } from "./getAxisValue.js";
|
|
13
15
|
import { getSVGPoint } from "../../../getSVGPoint.js";
|
|
14
16
|
import { selectorChartsInteractionIsInitialized } from "../useChartInteraction/index.js";
|
|
17
|
+
import { selectorChartAxisInteraction } from "./useChartCartesianInteraction.selectors.js";
|
|
18
|
+
import { useLazySelectorEffect } from "../../utils/useLazySelectorEffect.js";
|
|
15
19
|
export const useChartCartesianAxis = ({
|
|
16
20
|
params,
|
|
17
21
|
store,
|
|
@@ -22,7 +26,8 @@ export const useChartCartesianAxis = ({
|
|
|
22
26
|
const {
|
|
23
27
|
xAxis,
|
|
24
28
|
yAxis,
|
|
25
|
-
dataset
|
|
29
|
+
dataset,
|
|
30
|
+
onHighlightedAxisChange
|
|
26
31
|
} = params;
|
|
27
32
|
if (process.env.NODE_ENV !== 'production') {
|
|
28
33
|
const ids = [...(xAxis ?? []), ...(yAxis ?? [])].filter(axis => axis.id).map(axis => axis.id);
|
|
@@ -42,6 +47,25 @@ export const useChartCartesianAxis = ({
|
|
|
42
47
|
axis: yAxisWithScale,
|
|
43
48
|
axisIds: yAxisIds
|
|
44
49
|
} = useSelector(store, selectorChartYAxis);
|
|
50
|
+
useAssertModelConsistency({
|
|
51
|
+
warningPrefix: 'MUI X Charts',
|
|
52
|
+
componentName: 'Chart',
|
|
53
|
+
propName: 'highlightedAxis',
|
|
54
|
+
controlled: params.highlightedAxis,
|
|
55
|
+
defaultValue: undefined
|
|
56
|
+
});
|
|
57
|
+
useEnhancedEffect(() => {
|
|
58
|
+
if (params.highlightedAxis !== undefined) {
|
|
59
|
+
store.update(prevState => {
|
|
60
|
+
if (prevState.controlledCartesianAxisHighlight === params.highlightedAxis) {
|
|
61
|
+
return prevState;
|
|
62
|
+
}
|
|
63
|
+
return _extends({}, prevState, {
|
|
64
|
+
controlledCartesianAxisHighlight: params.highlightedAxis
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, [store, params.highlightedAxis]);
|
|
45
69
|
|
|
46
70
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useChartCartesianAxis`
|
|
47
71
|
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
@@ -60,6 +84,21 @@ export const useChartCartesianAxis = ({
|
|
|
60
84
|
}, [seriesConfig, drawingArea, xAxis, yAxis, dataset, store]);
|
|
61
85
|
const usedXAxis = xAxisIds[0];
|
|
62
86
|
const usedYAxis = yAxisIds[0];
|
|
87
|
+
useLazySelectorEffect(store, selectorChartAxisInteraction, (prevAxisInteraction, nextAxisInteraction) => {
|
|
88
|
+
if (Object.is(prevAxisInteraction, nextAxisInteraction)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (prevAxisInteraction.length !== nextAxisInteraction.length) {
|
|
92
|
+
onHighlightedAxisChange(nextAxisInteraction);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (prevAxisInteraction?.some(({
|
|
96
|
+
axisId,
|
|
97
|
+
dataIndex
|
|
98
|
+
}, itemIndex) => nextAxisInteraction[itemIndex].axisId !== axisId || nextAxisInteraction[itemIndex].dataIndex !== dataIndex)) {
|
|
99
|
+
onHighlightedAxisChange(nextAxisInteraction);
|
|
100
|
+
}
|
|
101
|
+
}, !onHighlightedAxisChange);
|
|
63
102
|
React.useEffect(() => {
|
|
64
103
|
const element = svgRef.current;
|
|
65
104
|
if (!isInteractionEnabled || !element || params.disableAxisListener) {
|
|
@@ -159,7 +198,9 @@ useChartCartesianAxis.params = {
|
|
|
159
198
|
yAxis: true,
|
|
160
199
|
dataset: true,
|
|
161
200
|
onAxisClick: true,
|
|
162
|
-
disableAxisListener: true
|
|
201
|
+
disableAxisListener: true,
|
|
202
|
+
onHighlightedAxisChange: true,
|
|
203
|
+
highlightedAxis: true
|
|
163
204
|
};
|
|
164
205
|
useChartCartesianAxis.getDefaultizedParams = ({
|
|
165
206
|
params
|
|
@@ -171,9 +212,11 @@ useChartCartesianAxis.getDefaultizedParams = ({
|
|
|
171
212
|
defaultizedYAxis: defaultizeYAxis(params.yAxis, params.dataset)
|
|
172
213
|
});
|
|
173
214
|
};
|
|
174
|
-
useChartCartesianAxis.getInitialState = params => ({
|
|
215
|
+
useChartCartesianAxis.getInitialState = params => _extends({
|
|
175
216
|
cartesianAxis: {
|
|
176
217
|
x: params.defaultizedXAxis,
|
|
177
218
|
y: params.defaultizedYAxis
|
|
178
219
|
}
|
|
220
|
+
}, params.highlightedAxis === undefined ? {} : {
|
|
221
|
+
controlledCartesianAxisHighlight: params.highlightedAxis
|
|
179
222
|
});
|
package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChartPluginSignature } from "../../models/index.js";
|
|
2
2
|
import type { ChartSeriesType, DatasetType } from "../../../../models/seriesType/config.js";
|
|
3
|
-
import type { ComputedAxis, ScaleName, AxisId, ChartsAxisData, YAxis, XAxis, DefaultedXAxis, DefaultedYAxis } from "../../../../models/axis.js";
|
|
3
|
+
import type { ComputedAxis, ScaleName, AxisId, ChartsAxisData, YAxis, XAxis, DefaultedXAxis, DefaultedYAxis, AxisItemIdentifier } from "../../../../models/axis.js";
|
|
4
4
|
import type { UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
|
|
5
5
|
import type { ZoomData, ZoomOptions, ZoomSliderShowTooltip } from "./zoom.types.js";
|
|
6
6
|
import type { UseChartInteractionSignature } from "../useChartInteraction/index.js";
|
|
@@ -36,6 +36,19 @@ export interface UseChartCartesianAxisParameters<S extends ScaleName = ScaleName
|
|
|
36
36
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
37
37
|
*/
|
|
38
38
|
onAxisClick?: (event: MouseEvent, data: null | ChartsAxisData) => void;
|
|
39
|
+
/**
|
|
40
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
41
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
42
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
43
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
44
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
45
|
+
*/
|
|
46
|
+
onHighlightedAxisChange?: (axisItems: AxisItemIdentifier[]) => void;
|
|
47
|
+
/**
|
|
48
|
+
* The controlled axis highlight.
|
|
49
|
+
* Identified by the axis id, and data index.
|
|
50
|
+
*/
|
|
51
|
+
highlightedAxis?: AxisItemIdentifier[];
|
|
39
52
|
/**
|
|
40
53
|
* If `true`, the charts will not listen to the mouse move event.
|
|
41
54
|
* It might break interactive features, but will improve performance.
|
|
@@ -67,6 +80,10 @@ export interface UseChartCartesianAxisState {
|
|
|
67
80
|
x: DefaultedXAxis[];
|
|
68
81
|
y: DefaultedYAxis[];
|
|
69
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* The controlled axis item highlighted.
|
|
85
|
+
*/
|
|
86
|
+
controlledCartesianAxisHighlight?: AxisItemIdentifier[];
|
|
70
87
|
}
|
|
71
88
|
export type ExtremumFilter = (value: {
|
|
72
89
|
x: number | Date | string | null;
|