@mui/x-charts 8.15.0 → 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.plugins.d.ts +1 -1
- package/BarChart/BarChart.plugins.js +1 -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/useBarPlotData.d.ts +17 -2
- package/BarChart/useBarPlotData.js +59 -34
- package/CHANGELOG.md +100 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -1
- package/ChartsTooltip/ChartsTooltip.js +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +48 -22
- package/ChartsTooltip/useItemTooltip.js +7 -14
- package/ChartsWrapper/ChartsWrapper.js +2 -1
- package/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/LineChart/LineChart.plugins.d.ts +1 -1
- package/LineChart/LineChart.plugins.js +1 -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/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.plugins.d.ts +1 -1
- package/ScatterChart/ScatterChart.plugins.js +1 -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/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/BarChart/BarChart.plugins.d.ts +1 -1
- package/esm/BarChart/BarChart.plugins.js +1 -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/useBarPlotData.d.ts +17 -2
- package/esm/BarChart/useBarPlotData.js +58 -34
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -2
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -2
- package/esm/ChartsTooltip/ChartsTooltip.js +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +9 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +49 -23
- package/esm/ChartsTooltip/useItemTooltip.js +9 -16
- package/esm/ChartsWrapper/ChartsWrapper.js +2 -1
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +81 -81
- package/esm/LineChart/LineChart.plugins.d.ts +1 -1
- package/esm/LineChart/LineChart.plugins.js +1 -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/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.plugins.d.ts +1 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +1 -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/context/ChartProvider/ChartProvider.js +1 -1
- package/esm/hooks/useFocusedItem.d.ts +1 -1
- package/esm/hooks/useInteractionItemProps.js +6 -2
- package/esm/index.js +1 -1
- package/esm/internals/configInit.d.ts +1 -1
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/internals/isCartesian.d.ts +3 -2
- package/esm/internals/isCartesian.js +3 -0
- package/esm/internals/plugins/allPlugins.d.ts +2 -2
- package/esm/internals/plugins/allPlugins.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +5 -3
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +20 -3
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +3 -3
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +11 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +1 -1
- 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/models/seriesConfig/tooltipItemPositionGetter.types.js +1 -0
- 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/models/seriesType/common.d.ts +3 -2
- package/hooks/useFocusedItem.d.ts +1 -1
- package/hooks/useInteractionItemProps.js +6 -2
- package/index.js +1 -1
- package/internals/configInit.d.ts +1 -1
- package/internals/getScale.js +2 -2
- package/internals/index.d.ts +2 -1
- package/internals/index.js +12 -0
- package/internals/isCartesian.d.ts +3 -2
- package/internals/isCartesian.js +4 -0
- package/internals/plugins/allPlugins.d.ts +2 -2
- package/internals/plugins/allPlugins.js +1 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +5 -3
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +20 -3
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +3 -3
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +11 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +3 -3
- 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/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/models/seriesType/common.d.ts +3 -2
- package/package.json +4 -4
- package/esm/internals/symlogScale.d.ts +0 -2
- package/internals/symlogScale.d.ts +0 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { NumberValue, ScaleSymLog } from '@mui/x-charts-vendor/d3-scale';
|
|
2
|
+
/**
|
|
3
|
+
* Constructs a new continuous scale with the specified range, the constant 1, the default interpolator and clamping disabled.
|
|
4
|
+
* The domain defaults to [0, 1].
|
|
5
|
+
* If range is not specified, it defaults to [0, 1].
|
|
6
|
+
*
|
|
7
|
+
* The first generic corresponds to the data type of the range elements.
|
|
8
|
+
* The second generic corresponds to the data type of the output elements generated by the scale.
|
|
9
|
+
* The third generic corresponds to the data type of the unknown value.
|
|
10
|
+
*
|
|
11
|
+
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
|
12
|
+
* convert the interpolated range element to a corresponding output element.
|
|
13
|
+
*
|
|
14
|
+
* The range must be set in accordance with the range element type.
|
|
15
|
+
*
|
|
16
|
+
* The interpolator factory may be set using the interpolate(...) method of the scale.
|
|
17
|
+
*
|
|
18
|
+
* @param range Array of range values.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scaleSymlog<Range = number, Output = Range, Unknown = never>(range?: Iterable<Range>): ScaleSymLog<Range, Output, Unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new continuous scale with the specified domain and range, the constant 1, the default interpolator and clamping disabled.
|
|
23
|
+
*
|
|
24
|
+
* The first generic corresponds to the data type of the range elements.
|
|
25
|
+
* The second generic corresponds to the data type of the output elements generated by the scale.
|
|
26
|
+
* The third generic corresponds to the data type of the unknown value.
|
|
27
|
+
*
|
|
28
|
+
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
|
29
|
+
* convert the interpolated range element to a corresponding output element.
|
|
30
|
+
*
|
|
31
|
+
* The range must be set in accordance with the range element type.
|
|
32
|
+
*
|
|
33
|
+
* The interpolator factory may be set using the interpolate(...) method of the scale.
|
|
34
|
+
*
|
|
35
|
+
* @param domain Array of numeric domain values.
|
|
36
|
+
* @param range Array of range values.
|
|
37
|
+
*/
|
|
38
|
+
export declare function scaleSymlog<Range, Output = Range, Unknown = never>(domain: Iterable<NumberValue>, range: Iterable<Range>): ScaleSymLog<Range, Output, Unknown>;
|
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
import { scaleSymlog as originalScaleSymlog, scaleLog, scaleLinear } from '@mui/x-charts-vendor/d3-scale';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new continuous scale with the specified range, the constant 1, the default interpolator and clamping disabled.
|
|
5
|
+
* The domain defaults to [0, 1].
|
|
6
|
+
* If range is not specified, it defaults to [0, 1].
|
|
7
|
+
*
|
|
8
|
+
* The first generic corresponds to the data type of the range elements.
|
|
9
|
+
* The second generic corresponds to the data type of the output elements generated by the scale.
|
|
10
|
+
* The third generic corresponds to the data type of the unknown value.
|
|
11
|
+
*
|
|
12
|
+
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
|
13
|
+
* convert the interpolated range element to a corresponding output element.
|
|
14
|
+
*
|
|
15
|
+
* The range must be set in accordance with the range element type.
|
|
16
|
+
*
|
|
17
|
+
* The interpolator factory may be set using the interpolate(...) method of the scale.
|
|
18
|
+
*
|
|
19
|
+
* @param range Array of range values.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new continuous scale with the specified domain and range, the constant 1, the default interpolator and clamping disabled.
|
|
24
|
+
*
|
|
25
|
+
* The first generic corresponds to the data type of the range elements.
|
|
26
|
+
* The second generic corresponds to the data type of the output elements generated by the scale.
|
|
27
|
+
* The third generic corresponds to the data type of the unknown value.
|
|
28
|
+
*
|
|
29
|
+
* If range element and output element type differ, the interpolator factory used with the scale must match this behavior and
|
|
30
|
+
* convert the interpolated range element to a corresponding output element.
|
|
31
|
+
*
|
|
32
|
+
* The range must be set in accordance with the range element type.
|
|
33
|
+
*
|
|
34
|
+
* The interpolator factory may be set using the interpolate(...) method of the scale.
|
|
35
|
+
*
|
|
36
|
+
* @param domain Array of numeric domain values.
|
|
37
|
+
* @param range Array of range values.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export function scaleSymlog(...args) {
|
|
41
|
+
const scale = originalScaleSymlog(...args);
|
|
4
42
|
const originalTicks = scale.ticks;
|
|
5
43
|
const {
|
|
6
44
|
negativeScale,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HighlightScope } from "../../internals/plugins/featurePlugins/useChartHighlight/highlightConfig.types.js";
|
|
2
2
|
import type { StackOffsetType, StackOrderType } from "../stacking.js";
|
|
3
3
|
import type { ChartsLabelMarkType } from "../../ChartsLabel/ChartsLabelMark.js";
|
|
4
|
+
import { AxisId } from "../axis.js";
|
|
4
5
|
export type SeriesId = number | string;
|
|
5
6
|
export type SeriesValueFormatterContext = {
|
|
6
7
|
/**
|
|
@@ -41,11 +42,11 @@ export type CartesianSeriesType = {
|
|
|
41
42
|
/**
|
|
42
43
|
* The id of the x-axis used to render the series.
|
|
43
44
|
*/
|
|
44
|
-
xAxisId?:
|
|
45
|
+
xAxisId?: AxisId;
|
|
45
46
|
/**
|
|
46
47
|
* The id of the y-axis used to render the series.
|
|
47
48
|
*/
|
|
48
|
-
yAxisId?:
|
|
49
|
+
yAxisId?: AxisId;
|
|
49
50
|
};
|
|
50
51
|
export type StackableSeriesType = {
|
|
51
52
|
/**
|
|
@@ -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;
|
|
@@ -23,7 +23,9 @@ const useInteractionItemProps = (data, skip) => {
|
|
|
23
23
|
const interactionActive = React.useRef(false);
|
|
24
24
|
const onPointerEnter = (0, _useEventCallback.default)(() => {
|
|
25
25
|
interactionActive.current = true;
|
|
26
|
-
instance.setItemInteraction(data
|
|
26
|
+
instance.setItemInteraction(data, {
|
|
27
|
+
interaction: 'pointer'
|
|
28
|
+
});
|
|
27
29
|
instance.setHighlight(data);
|
|
28
30
|
});
|
|
29
31
|
const onPointerLeave = (0, _useEventCallback.default)(() => {
|
|
@@ -66,7 +68,9 @@ function getInteractionItemProps(instance, item) {
|
|
|
66
68
|
if (!item) {
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
|
-
instance.setItemInteraction(item
|
|
71
|
+
instance.setItemInteraction(item, {
|
|
72
|
+
interaction: 'pointer'
|
|
73
|
+
});
|
|
70
74
|
instance.setHighlight(item);
|
|
71
75
|
}
|
|
72
76
|
function onPointerLeave() {
|
package/index.js
CHANGED
|
@@ -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>;
|
package/internals/getScale.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getScale = getScale;
|
|
7
7
|
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
8
|
-
var
|
|
8
|
+
var _scales = require("./scales");
|
|
9
9
|
function getScale(scaleType, domain, range) {
|
|
10
10
|
switch (scaleType) {
|
|
11
11
|
case 'log':
|
|
@@ -19,7 +19,7 @@ function getScale(scaleType, domain, range) {
|
|
|
19
19
|
case 'utc':
|
|
20
20
|
return (0, _d3Scale.scaleUtc)(domain, range);
|
|
21
21
|
case 'symlog':
|
|
22
|
-
return (0,
|
|
22
|
+
return (0, _scales.scaleSymlog)(domain, range);
|
|
23
23
|
default:
|
|
24
24
|
return (0, _d3Scale.scaleLinear)(domain, range);
|
|
25
25
|
}
|
package/internals/index.d.ts
CHANGED
|
@@ -66,4 +66,5 @@ export * from "../models/axis.js";
|
|
|
66
66
|
export * from "./plugins/models/index.js";
|
|
67
67
|
export * from "./material/index.js";
|
|
68
68
|
export * from "./createSvgIcon.js";
|
|
69
|
-
export * from "./constants.js";
|
|
69
|
+
export * from "./constants.js";
|
|
70
|
+
export * from "./scales/index.js";
|
package/internals/index.js
CHANGED
|
@@ -772,4 +772,16 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
772
772
|
return _constants[key];
|
|
773
773
|
}
|
|
774
774
|
});
|
|
775
|
+
});
|
|
776
|
+
var _scales = require("./scales");
|
|
777
|
+
Object.keys(_scales).forEach(function (key) {
|
|
778
|
+
if (key === "default" || key === "__esModule") return;
|
|
779
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
780
|
+
if (key in exports && exports[key] === _scales[key]) return;
|
|
781
|
+
Object.defineProperty(exports, key, {
|
|
782
|
+
enumerable: true,
|
|
783
|
+
get: function () {
|
|
784
|
+
return _scales[key];
|
|
785
|
+
}
|
|
786
|
+
});
|
|
775
787
|
});
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { CartesianChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
-
export declare function isCartesianSeriesType(seriesType: string): seriesType is CartesianChartSeriesType;
|
|
1
|
+
import { CartesianChartSeriesType, ChartSeriesDefaultized, ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
+
export declare function isCartesianSeriesType(seriesType: string): seriesType is CartesianChartSeriesType;
|
|
3
|
+
export declare function isCartesianSeries(series: ChartSeriesDefaultized<ChartSeriesType>): series is ChartSeriesDefaultized<CartesianChartSeriesType>;
|
package/internals/isCartesian.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.isCartesianSeries = isCartesianSeries;
|
|
6
7
|
exports.isCartesianSeriesType = isCartesianSeriesType;
|
|
7
8
|
var _configInit = require("./configInit");
|
|
8
9
|
function isCartesianSeriesType(seriesType) {
|
|
9
10
|
return _configInit.cartesianSeriesTypes.getTypes().has(seriesType);
|
|
11
|
+
}
|
|
12
|
+
function isCartesianSeries(series) {
|
|
13
|
+
return isCartesianSeriesType(series.type);
|
|
10
14
|
}
|
|
@@ -8,5 +8,5 @@ import { UseChartClosestPointSignature } from "./featurePlugins/useChartClosestP
|
|
|
8
8
|
import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
|
|
9
9
|
import { UseChartBrushSignature } from "./featurePlugins/useChartBrush/index.js";
|
|
10
10
|
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
11
|
-
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>,
|
|
12
|
-
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<
|
|
11
|
+
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<TSeries>, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
12
|
+
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
|
|
@@ -13,4 +13,4 @@ var _useChartZAxis = require("./featurePlugins/useChartZAxis");
|
|
|
13
13
|
var _useChartBrush = require("./featurePlugins/useChartBrush");
|
|
14
14
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
15
15
|
|
|
16
|
-
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush,
|
|
16
|
+
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js
CHANGED
|
@@ -59,6 +59,9 @@ const useChartInteractionListener = ({
|
|
|
59
59
|
name: 'zoomPressAndDrag',
|
|
60
60
|
dragThreshold: 10,
|
|
61
61
|
preventIf: ['zoomPinch']
|
|
62
|
+
}), new _core.TapGesture({
|
|
63
|
+
name: 'zoomDoubleTapReset',
|
|
64
|
+
taps: 2
|
|
62
65
|
})]
|
|
63
66
|
});
|
|
64
67
|
}
|
|
@@ -68,7 +71,7 @@ const useChartInteractionListener = ({
|
|
|
68
71
|
if (!svg || !gestureManager) {
|
|
69
72
|
return undefined;
|
|
70
73
|
}
|
|
71
|
-
gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'brush'], svg);
|
|
74
|
+
gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'zoomDoubleTapReset', 'brush'], svg);
|
|
72
75
|
return () => {
|
|
73
76
|
// Cleanup gesture manager
|
|
74
77
|
gestureManager.unregisterAllGestures(svg);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type PressAndDragEvent, type PressAndDragGestureOptions, type TapAndDragEvent, type TapAndDragGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
|
|
1
|
+
import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type PressAndDragEvent, type PressAndDragGestureOptions, type TapAndDragEvent, type TapAndDragGestureOptions, type TapGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
|
|
2
2
|
import { ChartPluginSignature } from "../../models/index.js";
|
|
3
|
-
export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
|
|
3
|
+
export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'zoomDoubleTapReset' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
|
|
4
4
|
export type InteractionListenerResult = {
|
|
5
5
|
cleanup: () => void;
|
|
6
6
|
};
|
|
@@ -9,7 +9,7 @@ export type AddInteractionListener = {
|
|
|
9
9
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd', callback: (event: PinchEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
10
10
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
11
11
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'move' | 'moveStart' | 'moveEnd', callback: (event: MoveEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
12
|
-
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
12
|
+
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap' | 'zoomDoubleTapReset', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
13
13
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'quickPress' | 'quickPressEnd', callback: (event: PressEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
14
14
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd', callback: (event: TapAndDragEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
15
15
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd', callback: (event: PressAndDragEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
@@ -20,6 +20,8 @@ export type UpdateZoomInteractionListeners = {
|
|
|
20
20
|
(interaction: 'zoomTurnWheel', options?: Omit<TurnWheelGestureOptions<'zoomTurnWheel'>, 'name'>): void;
|
|
21
21
|
(interaction: 'zoomTapAndDrag', options?: Omit<TapAndDragGestureOptions<'zoomTapAndDrag'>, 'name'>): void;
|
|
22
22
|
(interaction: 'zoomPressAndDrag', options?: Omit<PressAndDragGestureOptions<'zoomPressAndDrag'>, 'name'>): void;
|
|
23
|
+
(interaction: 'zoomDoubleTapReset', options?: Omit<TapGestureOptions<'zoomDoubleTapReset'>, 'name'>): void;
|
|
24
|
+
(interaction: 'brush', options?: Omit<PanGestureOptions<'brush'>, 'name'>): void;
|
|
23
25
|
};
|
|
24
26
|
export interface UseChartInteractionListenerParameters {}
|
|
25
27
|
export interface UseChartInteractionListenerState {}
|
|
@@ -12,12 +12,15 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
14
14
|
var _getSVGPoint = require("../../../getSVGPoint");
|
|
15
|
+
var _useSelector = require("../../../store/useSelector");
|
|
16
|
+
var _useChartBrush = require("./useChartBrush.selectors");
|
|
15
17
|
const useChartBrush = ({
|
|
16
18
|
store,
|
|
17
19
|
svgRef,
|
|
18
20
|
instance,
|
|
19
21
|
params
|
|
20
22
|
}) => {
|
|
23
|
+
const isEnabled = (0, _useSelector.useSelector)(store, _useChartBrush.selectorIsBrushEnabled);
|
|
21
24
|
(0, _useEnhancedEffect.default)(() => {
|
|
22
25
|
store.update(prev => {
|
|
23
26
|
return (0, _extends2.default)({}, prev, {
|
|
@@ -49,9 +52,21 @@ const useChartBrush = ({
|
|
|
49
52
|
});
|
|
50
53
|
});
|
|
51
54
|
});
|
|
55
|
+
const setZoomBrushEnabled = (0, _useEventCallback.default)(function setZoomBrushEnabled(enabled) {
|
|
56
|
+
store.update(prev => {
|
|
57
|
+
if (prev.brush.isZoomBrushEnabled === enabled) {
|
|
58
|
+
return prev;
|
|
59
|
+
}
|
|
60
|
+
return (0, _extends2.default)({}, prev, {
|
|
61
|
+
brush: (0, _extends2.default)({}, prev.brush, {
|
|
62
|
+
isZoomBrushEnabled: enabled
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
52
67
|
React.useEffect(() => {
|
|
53
68
|
const element = svgRef.current;
|
|
54
|
-
if (element === null || !
|
|
69
|
+
if (element === null || !isEnabled) {
|
|
55
70
|
return () => {};
|
|
56
71
|
}
|
|
57
72
|
const handleBrushStart = event => {
|
|
@@ -81,11 +96,12 @@ const useChartBrush = ({
|
|
|
81
96
|
brushEndHandler.cleanup();
|
|
82
97
|
brushCancelHandler.cleanup();
|
|
83
98
|
};
|
|
84
|
-
}, [svgRef, instance, store, clearBrush, setBrushCoordinates]);
|
|
99
|
+
}, [svgRef, instance, store, clearBrush, setBrushCoordinates, isEnabled]);
|
|
85
100
|
return {
|
|
86
101
|
instance: {
|
|
87
102
|
setBrushCoordinates,
|
|
88
|
-
clearBrush
|
|
103
|
+
clearBrush,
|
|
104
|
+
setZoomBrushEnabled
|
|
89
105
|
}
|
|
90
106
|
};
|
|
91
107
|
};
|
|
@@ -108,6 +124,7 @@ useChartBrush.getInitialState = params => {
|
|
|
108
124
|
return {
|
|
109
125
|
brush: {
|
|
110
126
|
enabled: params.brushConfig.enabled,
|
|
127
|
+
isZoomBrushEnabled: false,
|
|
111
128
|
preventTooltip: params.brushConfig.preventTooltip,
|
|
112
129
|
preventHighlight: params.brushConfig.preventHighlight,
|
|
113
130
|
start: null,
|
|
@@ -74,9 +74,9 @@ const selectorBrushConfigZoom = exports.selectorBrushConfigZoom = (0, _selectors
|
|
|
74
74
|
return null;
|
|
75
75
|
});
|
|
76
76
|
const selectorBrushConfig = exports.selectorBrushConfig = (0, _selectors.createSelector)([selectorBrushConfigNoZoom, selectorBrushConfigZoom], (configNoZoom, configZoom) => configZoom ?? configNoZoom);
|
|
77
|
-
const selectorIsBrushEnabled = exports.selectorIsBrushEnabled = (0, _selectors.createSelector)([selectorBrush], brush => brush?.enabled);
|
|
78
|
-
const selectorIsBrushSelectionActive = exports.selectorIsBrushSelectionActive = (0, _selectors.createSelector)([selectorBrush], brush => {
|
|
79
|
-
return
|
|
77
|
+
const selectorIsBrushEnabled = exports.selectorIsBrushEnabled = (0, _selectors.createSelector)([selectorBrush], brush => brush?.enabled || brush?.isZoomBrushEnabled);
|
|
78
|
+
const selectorIsBrushSelectionActive = exports.selectorIsBrushSelectionActive = (0, _selectors.createSelector)([selectorIsBrushEnabled, selectorBrush], (isBrushEnabled, brush) => {
|
|
79
|
+
return isBrushEnabled && brush?.start !== null && brush?.current !== null;
|
|
80
80
|
});
|
|
81
81
|
const selectorBrushShouldPreventAxisHighlight = exports.selectorBrushShouldPreventAxisHighlight = (0, _selectors.createSelector)([selectorBrush, selectorIsBrushSelectionActive], (brush, isBrushSelectionActive) => isBrushSelectionActive && brush?.preventHighlight);
|
|
82
82
|
const selectorBrushShouldPreventTooltip = exports.selectorBrushShouldPreventTooltip = (0, _selectors.createSelector)([selectorBrush, selectorIsBrushSelectionActive], (brush, isBrushSelectionActive) => isBrushSelectionActive && brush?.preventTooltip);
|
|
@@ -9,6 +9,10 @@ export interface UseChartBrushState {
|
|
|
9
9
|
* Whether the brush interaction is enabled.
|
|
10
10
|
*/
|
|
11
11
|
enabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the zoom brush interaction is enabled.
|
|
14
|
+
*/
|
|
15
|
+
isZoomBrushEnabled: boolean;
|
|
12
16
|
/**
|
|
13
17
|
* Whether to prevent tooltip from showing during brush interaction.
|
|
14
18
|
*/
|
|
@@ -37,6 +41,11 @@ export interface UseChartBrushInstance {
|
|
|
37
41
|
* Clear the brush coordinates.
|
|
38
42
|
*/
|
|
39
43
|
clearBrush: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Enable or disable the zoom brush interaction.
|
|
46
|
+
* @param {boolean} enabled Whether to enable the zoom brush interaction.
|
|
47
|
+
*/
|
|
48
|
+
setZoomBrushEnabled: (enabled: boolean) => void;
|
|
40
49
|
}
|
|
41
50
|
export interface BrushConfig {
|
|
42
51
|
/**
|
|
@@ -46,12 +55,12 @@ export interface BrushConfig {
|
|
|
46
55
|
enabled?: boolean;
|
|
47
56
|
/**
|
|
48
57
|
* Whether to prevent tooltip from showing during brush interaction.
|
|
49
|
-
* @default
|
|
58
|
+
* @default true
|
|
50
59
|
*/
|
|
51
60
|
preventTooltip?: boolean;
|
|
52
61
|
/**
|
|
53
62
|
* Whether to prevent highlighting during brush interaction.
|
|
54
|
-
* @default
|
|
63
|
+
* @default true
|
|
55
64
|
*/
|
|
56
65
|
preventHighlight?: boolean;
|
|
57
66
|
}
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getNormalizedAxisScale = getNormalizedAxisScale;
|
|
7
7
|
exports.getRange = getRange;
|
|
8
|
-
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
9
8
|
var _axis = require("../../../../models/axis");
|
|
10
9
|
var _getScale = require("../../../getScale");
|
|
10
|
+
var _scales = require("../../../scales");
|
|
11
11
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
12
12
|
function getRange(drawingArea, axisDirection, axis) {
|
|
13
13
|
const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
@@ -17,10 +17,10 @@ function getNormalizedAxisScale(axis, domain) {
|
|
|
17
17
|
const range = [0, 1];
|
|
18
18
|
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
19
19
|
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, _scales.scaleBand)(domain, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2);
|
|
21
21
|
}
|
|
22
22
|
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
23
|
-
return (0,
|
|
23
|
+
return (0, _scales.scalePoint)(domain, range);
|
|
24
24
|
}
|
|
25
25
|
const scaleType = axis.scaleType ?? 'linear';
|
|
26
26
|
const scale = (0, _getScale.getScale)(scaleType, domain, range);
|
|
@@ -24,4 +24,16 @@ Object.keys(_useChartInteraction2).forEach(function (key) {
|
|
|
24
24
|
return _useChartInteraction2[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
});
|
|
28
|
+
var _useChartTooltip = require("./useChartTooltip.selectors");
|
|
29
|
+
Object.keys(_useChartTooltip).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
+
if (key in exports && exports[key] === _useChartTooltip[key]) return;
|
|
33
|
+
Object.defineProperty(exports, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _useChartTooltip[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
27
39
|
});
|
|
@@ -43,13 +43,14 @@ const useChartInteraction = ({
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
const setItemInteraction = (0, _useEventCallback.default)(function setItemInteraction(newItem) {
|
|
46
|
+
const setItemInteraction = (0, _useEventCallback.default)(function setItemInteraction(newItem, context) {
|
|
47
47
|
store.update(prev => {
|
|
48
48
|
if ((0, _fastObjectShallowCompare.fastObjectShallowCompare)(prev.interaction.item, newItem)) {
|
|
49
49
|
return prev;
|
|
50
50
|
}
|
|
51
51
|
return (0, _extends2.default)({}, prev, {
|
|
52
52
|
interaction: (0, _extends2.default)({}, prev.interaction, {
|
|
53
|
+
lastUpdate: context.interaction,
|
|
53
54
|
item: newItem
|
|
54
55
|
})
|
|
55
56
|
});
|
package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const selectorChartsInteractionItem: import("reselect").Selector<
|
|
|
7
7
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
8
|
} & {
|
|
9
9
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
10
|
-
}, import("../../../../index.js").
|
|
10
|
+
}, import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null, any[]>;
|
|
11
11
|
export declare const selectorChartsInteractionPointer: 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("./useChartInteraction.types.js").UseChartInteractionState> & {
|
|
12
12
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
13
13
|
} & {
|
|
@@ -13,8 +13,12 @@ export interface UseChartInteractionInstance {
|
|
|
13
13
|
/**
|
|
14
14
|
* Setter for the item the user is interacting with.
|
|
15
15
|
* @param {ChartItemIdentifier} newItem The identifier of the item.
|
|
16
|
+
* @param {{ interaction: InteractionUpdateSource }} context The context of the interaction.
|
|
17
|
+
* @param {InteractionUpdateSource} context.interaction The source of the interaction update (pointer or keyboard).
|
|
16
18
|
*/
|
|
17
|
-
setItemInteraction: (newItem: ChartItemIdentifierWithData<ChartSeriesType
|
|
19
|
+
setItemInteraction: (newItem: ChartItemIdentifierWithData<ChartSeriesType>, context: {
|
|
20
|
+
interaction: InteractionUpdateSource;
|
|
21
|
+
}) => void;
|
|
18
22
|
/**
|
|
19
23
|
* Remove item interaction if the current if the provided item is still the one interacting.
|
|
20
24
|
* @param {ChartItemIdentifier} itemToRemove The identifier of the item.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const selectorChartsTooltipItem: 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("./useChartInteraction.types.js").UseChartInteractionState> & {
|
|
2
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
3
|
+
} & {
|
|
4
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
+
} & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null, any[]>;
|
|
6
|
+
export declare const selectorChartsTooltipItemIsDefined: 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("./useChartInteraction.types.js").UseChartInteractionState> & {
|
|
7
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
8
|
+
} & {
|
|
9
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
10
|
+
} & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, boolean, any[]>;
|
|
11
|
+
export declare const selectorChartsTooltipItemPosition: import("reselect").Selector<any, {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
} | null, [placement?: "bottom" | "left" | "right" | "top" | undefined]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorChartsTooltipItemPosition = exports.selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItem = void 0;
|
|
7
|
+
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
8
|
+
var _selectors = require("../../utils/selectors");
|
|
9
|
+
var _useChartCartesianAxisRendering = require("../useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
|
|
10
|
+
var _useChartKeyboardNavigation = require("../useChartKeyboardNavigation");
|
|
11
|
+
var _useChartInteraction = require("./useChartInteraction.selectors");
|
|
12
|
+
var _useChartDimensions = require("../../corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
13
|
+
var _isCartesian = require("../../../isCartesian");
|
|
14
|
+
const selectorChartsTooltipItem = exports.selectorChartsTooltipItem = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsLastInteraction, _useChartInteraction.selectorChartsInteractionItem, _useChartKeyboardNavigation.selectorChartsKeyboardItem], (lastInteraction, interactionItem, keyboardItem) => lastInteraction === 'keyboard' ? keyboardItem : interactionItem ?? null);
|
|
15
|
+
const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsLastInteraction, _useChartInteraction.selectorChartsInteractionItemIsDefined, _useChartKeyboardNavigation.selectorChartsKeyboardItemIsDefined], (lastInteraction, interactionItemIsDefined, keyboardItemIsDefined) => lastInteraction === 'keyboard' ? keyboardItemIsDefined : interactionItemIsDefined);
|
|
16
|
+
const selectorChartsTooltipItemPosition = exports.selectorChartsTooltipItemPosition = (0, _selectors.createSelector)([selectorChartsTooltipItem, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartSeries.selectorChartSeriesProcessed, (_, placement) => placement], function selectorChartsTooltipItemPosition(identifier, drawingArea, seriesConfig, {
|
|
17
|
+
axis: xAxis,
|
|
18
|
+
axisIds: xAxisIds
|
|
19
|
+
}, {
|
|
20
|
+
axis: yAxis,
|
|
21
|
+
axisIds: yAxisIds
|
|
22
|
+
}, series, placement = 'top') {
|
|
23
|
+
if (!identifier) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const itemSeries = series[identifier.type]?.series[identifier.seriesId];
|
|
27
|
+
if (itemSeries) {
|
|
28
|
+
const axesConfig = {};
|
|
29
|
+
const xAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.xAxisId ?? xAxisIds[0] : undefined;
|
|
30
|
+
const yAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.yAxisId ?? yAxisIds[0] : undefined;
|
|
31
|
+
if (xAxisId !== undefined) {
|
|
32
|
+
axesConfig.x = xAxis[xAxisId];
|
|
33
|
+
}
|
|
34
|
+
if (yAxisId !== undefined) {
|
|
35
|
+
axesConfig.y = yAxis[yAxisId];
|
|
36
|
+
}
|
|
37
|
+
return seriesConfig[itemSeries.type].tooltipItemPositionGetter?.({
|
|
38
|
+
series,
|
|
39
|
+
drawingArea,
|
|
40
|
+
axesConfig,
|
|
41
|
+
identifier,
|
|
42
|
+
placement
|
|
43
|
+
}) ?? null;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isFocusableSeriesType = isFocusableSeriesType;
|
|
7
|
+
const FOCUSABLE_SERIES_TYPES = new Set(['bar', 'line', 'scatter', 'pie']);
|
|
8
|
+
function isFocusableSeriesType(type) {
|
|
9
|
+
return FOCUSABLE_SERIES_TYPES.has(type);
|
|
10
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
|
|
2
2
|
import { SeriesId } from "../../../../models/seriesType/common.js";
|
|
3
3
|
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
import { FocusableSeriesTypes } from "./useChartKeyboardNavigation.types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Returns the next series type and id that contains some data.
|
|
6
7
|
* Returns `null` if no other series have data.
|
|
7
8
|
*/
|
|
8
|
-
export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?:
|
|
9
|
-
type:
|
|
9
|
+
export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: FocusableSeriesTypes, seriesId?: SeriesId): {
|
|
10
|
+
type: FocusableSeriesTypes;
|
|
10
11
|
seriesId: SeriesId;
|
|
11
12
|
} | null;
|
|
12
13
|
/**
|
|
13
14
|
* Returns the previous series type and id that contains some data.
|
|
14
15
|
* Returns `null` if no other series have data.
|
|
15
16
|
*/
|
|
16
|
-
export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?:
|
|
17
|
-
type:
|
|
17
|
+
export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: FocusableSeriesTypes, seriesId?: SeriesId): {
|
|
18
|
+
type: FocusableSeriesTypes;
|
|
18
19
|
seriesId: SeriesId;
|
|
19
20
|
} | null;
|
|
20
21
|
export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean | undefined;
|