@mui/x-charts 9.0.4 → 9.2.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.mts +1 -2
- package/BarChart/BarChart.d.ts +1 -2
- package/BarChart/BarChart.js +2 -913
- package/BarChart/BarChart.mjs +2 -913
- package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.mjs +2 -0
- package/CHANGELOG.md +236 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.mts +55 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.ts +55 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.js +94 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.mjs +88 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.mts +13 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.ts +13 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.js +86 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.mjs +80 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.mts +18 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.ts +18 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.js +26 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.mjs +16 -0
- package/ChartsAxisHighlightValue/index.d.mts +1 -0
- package/ChartsAxisHighlightValue/index.d.ts +1 -0
- package/ChartsAxisHighlightValue/index.js +16 -0
- package/ChartsAxisHighlightValue/index.mjs +1 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.d.mts +14 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.d.ts +14 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.js +130 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.mjs +124 -0
- package/ChartsContainer/ChartsContainer.js +4 -1431
- package/ChartsContainer/ChartsContainer.mjs +4 -1431
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.mts +15 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.ts +15 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.js +56 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.mjs +50 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.mts +6 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.ts +6 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.js +5 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.mjs +1 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.mts +11 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.ts +11 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.js +70 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.mjs +64 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.mts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.ts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.js +104 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.mjs +98 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.mts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.ts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.js +98 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.mjs +92 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.mts +7 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.ts +7 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.js +14 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.mjs +6 -0
- package/ChartsRadialAxisHighlight/index.d.mts +5 -0
- package/ChartsRadialAxisHighlight/index.d.ts +5 -0
- package/ChartsRadialAxisHighlight/index.js +47 -0
- package/ChartsRadialAxisHighlight/index.mjs +4 -0
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.mts +1 -47
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +1 -47
- package/ChartsRadiusAxis/ChartsRadiusAxis.js +20 -16
- package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +21 -15
- package/ChartsRadiusAxis/index.d.mts +3 -2
- package/ChartsRadiusAxis/index.d.ts +3 -2
- package/ChartsRadiusAxis/index.mjs +3 -1
- package/ChartsRotationAxis/ChartsRotationAxis.d.mts +1 -47
- package/ChartsRotationAxis/ChartsRotationAxis.d.ts +1 -47
- package/ChartsRotationAxis/ChartsRotationAxis.js +16 -19
- package/ChartsRotationAxis/ChartsRotationAxis.mjs +17 -18
- package/ChartsRotationAxis/index.d.mts +3 -2
- package/ChartsRotationAxis/index.d.ts +3 -2
- package/ChartsRotationAxis/index.mjs +3 -1
- package/ChartsTooltip/useAxesTooltip.d.mts +1 -1
- package/ChartsTooltip/useAxesTooltip.d.ts +1 -1
- package/ChartsTooltip/useAxesTooltip.js +11 -2
- package/ChartsTooltip/useAxesTooltip.mjs +12 -3
- package/ChartsXAxis/useAxisTicksProps.d.mts +162 -81
- package/ChartsXAxis/useAxisTicksProps.d.ts +162 -81
- package/ChartsYAxis/useAxisTicksProps.d.mts +162 -81
- package/ChartsYAxis/useAxisTicksProps.d.ts +162 -81
- package/LICENSE +2 -0
- package/LineChart/LineChart.js +2 -913
- package/LineChart/LineChart.mjs +2 -913
- package/LineChart/seriesConfig/curveEvaluation.d.mts +19 -1
- package/LineChart/seriesConfig/curveEvaluation.d.ts +19 -1
- package/LineChart/seriesConfig/curveEvaluation.js +132 -0
- package/LineChart/seriesConfig/curveEvaluation.mjs +131 -0
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +2 -1
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +2 -1
- package/LineChart/seriesConfig/seriesProcessor.js +4 -0
- package/LineChart/seriesConfig/seriesProcessor.mjs +4 -0
- package/LineChart/useAreaPlotData.js +4 -0
- package/LineChart/useAreaPlotData.mjs +4 -0
- package/LineChart/useLinePlotData.js +2 -0
- package/LineChart/useLinePlotData.mjs +2 -0
- package/LineChart/useMarkPlotData.js +2 -0
- package/LineChart/useMarkPlotData.mjs +2 -0
- package/RadarChart/RadarGrid/CircularRadarStripes.js +2 -3
- package/RadarChart/RadarGrid/CircularRadarStripes.mjs +2 -3
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -1
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.mjs +2 -2
- package/ScatterChart/FocusedScatterMark.js +10 -24
- package/ScatterChart/FocusedScatterMark.mjs +10 -24
- package/ScatterChart/HighlightedScatterMark.d.mts +11 -0
- package/ScatterChart/HighlightedScatterMark.d.ts +11 -0
- package/ScatterChart/HighlightedScatterMark.js +68 -0
- package/ScatterChart/HighlightedScatterMark.mjs +62 -0
- package/ScatterChart/ScatterChart.d.mts +1 -2
- package/ScatterChart/ScatterChart.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +2 -913
- package/ScatterChart/ScatterChart.mjs +2 -913
- package/ScatterChart/index.d.mts +1 -0
- package/ScatterChart/index.d.ts +1 -0
- package/ScatterChart/index.js +12 -0
- package/ScatterChart/index.mjs +1 -0
- package/ScatterChart/scatterClasses.d.mts +3 -1
- package/ScatterChart/scatterClasses.d.ts +3 -1
- package/ScatterChart/scatterClasses.js +3 -2
- package/ScatterChart/scatterClasses.mjs +3 -2
- package/ScatterChart/useScatterChartProps.js +3 -1
- package/ScatterChart/useScatterChartProps.mjs +3 -1
- package/ScatterChart/useScatterItemPosition.d.mts +16 -0
- package/ScatterChart/useScatterItemPosition.d.ts +16 -0
- package/ScatterChart/useScatterItemPosition.js +47 -0
- package/ScatterChart/useScatterItemPosition.mjs +41 -0
- package/SparkLineChart/SparkLineChart.js +2 -913
- package/SparkLineChart/SparkLineChart.mjs +2 -913
- package/hooks/useAxis.d.mts +3 -3
- package/hooks/useAxis.d.ts +3 -3
- package/hooks/useAxisSystem.d.mts +1 -1
- package/hooks/useAxisSystem.d.ts +1 -1
- package/hooks/useAxisSystem.js +1 -1
- package/hooks/useAxisSystem.mjs +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/index.js +25 -1
- package/index.mjs +3 -1
- package/internals/getRingPath.d.mts +16 -0
- package/internals/getRingPath.d.ts +16 -0
- package/internals/getRingPath.js +39 -0
- package/internals/getRingPath.mjs +33 -0
- package/internals/index.d.mts +8 -1
- package/internals/index.d.ts +8 -1
- package/internals/index.js +67 -0
- package/internals/index.mjs +7 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -2
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +4 -2
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.mts +2 -2
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.d.mts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.mts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +8 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.mts +6 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +48 -36
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.mjs +47 -36
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +77 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +77 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.mts +152 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +152 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +4 -7
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +4 -7
- package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.ts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.mts +7 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.ts +7 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +56 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +54 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.mts +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.mjs +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts +4 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.mts +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.mts +23 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +23 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +73 -12
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.mjs +74 -12
- package/models/axis.d.mts +79 -31
- package/models/axis.d.ts +79 -31
- package/models/axis.js +5 -1
- package/models/axis.mjs +5 -1
- package/models/seriesType/line.d.mts +6 -6
- package/models/seriesType/line.d.ts +6 -6
- package/package.json +32 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
7
|
+
import { useUtilityClasses } from "./chartsAxisHighlightValueClasses.mjs";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const ChartsAxisHighlightValueText = styled('div', {
|
|
10
|
+
name: 'MuiChartsAxisHighlightValue',
|
|
11
|
+
slot: 'Root',
|
|
12
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'position'
|
|
13
|
+
})(({
|
|
14
|
+
theme
|
|
15
|
+
}) => _extends({}, theme.typography.caption, {
|
|
16
|
+
padding: theme.spacing(0.5, 1),
|
|
17
|
+
border: `solid ${theme.palette.divider} 1px`,
|
|
18
|
+
backgroundColor: theme.palette.background.paper,
|
|
19
|
+
'--clamped-offset': 'calc(-1*min(var(--min),max(calc(100% - var(--max)),50%)))',
|
|
20
|
+
variants: [{
|
|
21
|
+
props: {
|
|
22
|
+
position: 'top'
|
|
23
|
+
},
|
|
24
|
+
style: {
|
|
25
|
+
translate: 'var(--clamped-offset) -100%'
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
props: {
|
|
29
|
+
position: 'bottom'
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
translate: 'var(--clamped-offset) 0'
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
props: {
|
|
36
|
+
position: 'left'
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
39
|
+
translate: '-100% var(--clamped-offset)'
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
props: {
|
|
43
|
+
position: 'right'
|
|
44
|
+
},
|
|
45
|
+
style: {
|
|
46
|
+
translate: '0 var(--clamped-offset)'
|
|
47
|
+
}
|
|
48
|
+
}]
|
|
49
|
+
}));
|
|
50
|
+
function ChartsAxisHighlightValueItem(props) {
|
|
51
|
+
const {
|
|
52
|
+
x,
|
|
53
|
+
y,
|
|
54
|
+
position,
|
|
55
|
+
formattedValue,
|
|
56
|
+
minCoord,
|
|
57
|
+
maxCoord,
|
|
58
|
+
space,
|
|
59
|
+
sx
|
|
60
|
+
} = props;
|
|
61
|
+
const classes = useUtilityClasses({
|
|
62
|
+
position
|
|
63
|
+
});
|
|
64
|
+
const isXAxis = position === 'top' || position === 'bottom';
|
|
65
|
+
return /*#__PURE__*/_jsx(ChartsAxisHighlightValueText, {
|
|
66
|
+
className: classes.root,
|
|
67
|
+
position: position,
|
|
68
|
+
style: {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
top: y,
|
|
71
|
+
left: x,
|
|
72
|
+
'--min': `${isXAxis ? x - minCoord : y - minCoord}px`,
|
|
73
|
+
'--max': `${isXAxis ? maxCoord - x : maxCoord - y}px`,
|
|
74
|
+
'--space': `${space}px`
|
|
75
|
+
},
|
|
76
|
+
sx: sx,
|
|
77
|
+
children: formattedValue
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export { ChartsAxisHighlightValueItem };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ChartsAxisHighlightValueClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the top axis highlight. */
|
|
5
|
+
top: string;
|
|
6
|
+
/** Styles applied to the bottom axis highlight. */
|
|
7
|
+
bottom: string;
|
|
8
|
+
/** Styles applied to the left axis highlight. */
|
|
9
|
+
left: string;
|
|
10
|
+
/** Styles applied to the right axis highlight. */
|
|
11
|
+
right: string;
|
|
12
|
+
}
|
|
13
|
+
export type ChartsAxisHighlightValueClassKey = keyof ChartsAxisHighlightValueClasses;
|
|
14
|
+
export declare function getChartsAxisHighlightValueUtilityClass(slot: string): string;
|
|
15
|
+
export declare const useUtilityClasses: (ownerState: {
|
|
16
|
+
position: "top" | "right" | "bottom" | "left";
|
|
17
|
+
}) => Record<"root", string>;
|
|
18
|
+
export declare const chartsAxisHighlightValueClasses: ChartsAxisHighlightValueClasses;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ChartsAxisHighlightValueClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the top axis highlight. */
|
|
5
|
+
top: string;
|
|
6
|
+
/** Styles applied to the bottom axis highlight. */
|
|
7
|
+
bottom: string;
|
|
8
|
+
/** Styles applied to the left axis highlight. */
|
|
9
|
+
left: string;
|
|
10
|
+
/** Styles applied to the right axis highlight. */
|
|
11
|
+
right: string;
|
|
12
|
+
}
|
|
13
|
+
export type ChartsAxisHighlightValueClassKey = keyof ChartsAxisHighlightValueClasses;
|
|
14
|
+
export declare function getChartsAxisHighlightValueUtilityClass(slot: string): string;
|
|
15
|
+
export declare const useUtilityClasses: (ownerState: {
|
|
16
|
+
position: "top" | "right" | "bottom" | "left";
|
|
17
|
+
}) => Record<"root", string>;
|
|
18
|
+
export declare const chartsAxisHighlightValueClasses: ChartsAxisHighlightValueClasses;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.chartsAxisHighlightValueClasses = void 0;
|
|
8
|
+
exports.getChartsAxisHighlightValueUtilityClass = getChartsAxisHighlightValueUtilityClass;
|
|
9
|
+
exports.useUtilityClasses = void 0;
|
|
10
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
11
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
12
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
13
|
+
function getChartsAxisHighlightValueUtilityClass(slot) {
|
|
14
|
+
return (0, _generateUtilityClass.default)('MuiChartsAxisHighlightValue', slot);
|
|
15
|
+
}
|
|
16
|
+
const useUtilityClasses = ownerState => {
|
|
17
|
+
const {
|
|
18
|
+
position
|
|
19
|
+
} = ownerState;
|
|
20
|
+
const slots = {
|
|
21
|
+
root: ['root', position]
|
|
22
|
+
};
|
|
23
|
+
return (0, _composeClasses.default)(slots, getChartsAxisHighlightValueUtilityClass);
|
|
24
|
+
};
|
|
25
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
26
|
+
const chartsAxisHighlightValueClasses = exports.chartsAxisHighlightValueClasses = (0, _generateUtilityClasses.default)('MuiChartsAxisHighlightValue', ['root', 'top', 'bottom', 'left', 'right']);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
4
|
+
export function getChartsAxisHighlightValueUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiChartsAxisHighlightValue', slot);
|
|
6
|
+
}
|
|
7
|
+
export const useUtilityClasses = ownerState => {
|
|
8
|
+
const {
|
|
9
|
+
position
|
|
10
|
+
} = ownerState;
|
|
11
|
+
const slots = {
|
|
12
|
+
root: ['root', position]
|
|
13
|
+
};
|
|
14
|
+
return composeClasses(slots, getChartsAxisHighlightValueUtilityClass);
|
|
15
|
+
};
|
|
16
|
+
export const chartsAxisHighlightValueClasses = generateUtilityClasses('MuiChartsAxisHighlightValue', ['root', 'top', 'bottom', 'left', 'right']);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartsAxisHighlightValue.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartsAxisHighlightValue.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsAxisHighlightValue = require("./ChartsAxisHighlightValue");
|
|
7
|
+
Object.keys(_ChartsAxisHighlightValue).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsAxisHighlightValue[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsAxisHighlightValue[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartsAxisHighlightValue.mjs";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AxisId } from "../models/axis.mjs";
|
|
2
|
+
import type { ChartsAxisHighlightValuePosition } from "./ChartsAxisHighlightValue.mjs";
|
|
3
|
+
import type { ChartsAxisHighlightValueItemProps } from "./ChartsAxisHighlightValueItem.mjs";
|
|
4
|
+
export interface AxisHighlightValueItem extends ChartsAxisHighlightValueItemProps {
|
|
5
|
+
key: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UseAxisHighlightValueParams {
|
|
8
|
+
axisDirection: 'x' | 'y';
|
|
9
|
+
axisId?: AxisId;
|
|
10
|
+
labelPosition?: ChartsAxisHighlightValuePosition;
|
|
11
|
+
value?: number | Date | string | null;
|
|
12
|
+
valueFormatter?: (value: number | Date | string) => string;
|
|
13
|
+
}
|
|
14
|
+
export declare function useAxisHighlightValue(params: UseAxisHighlightValueParams): AxisHighlightValueItem[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AxisId } from "../models/axis.js";
|
|
2
|
+
import type { ChartsAxisHighlightValuePosition } from "./ChartsAxisHighlightValue.js";
|
|
3
|
+
import type { ChartsAxisHighlightValueItemProps } from "./ChartsAxisHighlightValueItem.js";
|
|
4
|
+
export interface AxisHighlightValueItem extends ChartsAxisHighlightValueItemProps {
|
|
5
|
+
key: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UseAxisHighlightValueParams {
|
|
8
|
+
axisDirection: 'x' | 'y';
|
|
9
|
+
axisId?: AxisId;
|
|
10
|
+
labelPosition?: ChartsAxisHighlightValuePosition;
|
|
11
|
+
value?: number | Date | string | null;
|
|
12
|
+
valueFormatter?: (value: number | Date | string) => string;
|
|
13
|
+
}
|
|
14
|
+
export declare function useAxisHighlightValue(params: UseAxisHighlightValueParams): AxisHighlightValueItem[];
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAxisHighlightValue = useAxisHighlightValue;
|
|
7
|
+
var _getValueToPositionMapper = require("../hooks/getValueToPositionMapper");
|
|
8
|
+
var _hooks = require("../hooks");
|
|
9
|
+
var _useStore = require("../internals/store/useStore");
|
|
10
|
+
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
11
|
+
function getAxisValueFormatter(axis, valueFormatter) {
|
|
12
|
+
if (valueFormatter) {
|
|
13
|
+
return valueFormatter;
|
|
14
|
+
}
|
|
15
|
+
if (axis.valueFormatter) {
|
|
16
|
+
return v => axis.valueFormatter(v, {
|
|
17
|
+
location: 'tooltip',
|
|
18
|
+
scale: axis.scale
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return v => `${v}`;
|
|
22
|
+
}
|
|
23
|
+
const EMPTY_ARRAY = [];
|
|
24
|
+
function useAxisHighlightValue(params) {
|
|
25
|
+
const {
|
|
26
|
+
axisDirection,
|
|
27
|
+
axisId,
|
|
28
|
+
labelPosition = 'end',
|
|
29
|
+
value,
|
|
30
|
+
valueFormatter
|
|
31
|
+
} = params;
|
|
32
|
+
const {
|
|
33
|
+
top,
|
|
34
|
+
left,
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
right,
|
|
38
|
+
bottom
|
|
39
|
+
} = (0, _hooks.useDrawingArea)();
|
|
40
|
+
const store = (0, _useStore.useStore)();
|
|
41
|
+
const highlightSelector = axisDirection === 'x' ? _useChartCartesianAxis.selectorChartsHighlightXAxisValue : _useChartCartesianAxis.selectorChartsHighlightYAxisValue;
|
|
42
|
+
const axisSelector = axisDirection === 'x' ? _useChartCartesianAxis.selectorChartXAxis : _useChartCartesianAxis.selectorChartYAxis;
|
|
43
|
+
const axisHighlightValues = store.use(highlightSelector);
|
|
44
|
+
const axes = store.use(axisSelector);
|
|
45
|
+
if (labelPosition === 'none') {
|
|
46
|
+
return EMPTY_ARRAY;
|
|
47
|
+
}
|
|
48
|
+
let items;
|
|
49
|
+
if (value !== undefined && value !== null) {
|
|
50
|
+
const targetAxisId = axisId ?? axes.axisIds[0];
|
|
51
|
+
items = [{
|
|
52
|
+
axisId: targetAxisId,
|
|
53
|
+
value
|
|
54
|
+
}];
|
|
55
|
+
} else {
|
|
56
|
+
items = axisHighlightValues.filter(item => (axisId === undefined || item.axisId === axisId) && item.value !== undefined).map(item => ({
|
|
57
|
+
axisId: item.axisId,
|
|
58
|
+
value: item.value
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
const result = [];
|
|
62
|
+
for (const {
|
|
63
|
+
axisId: itemAxisId,
|
|
64
|
+
value: itemValue
|
|
65
|
+
} of items) {
|
|
66
|
+
const axis = axes.axis[itemAxisId];
|
|
67
|
+
if (!axis) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const scale = axis.scale;
|
|
71
|
+
const position = (0, _getValueToPositionMapper.getValueToPositionMapper)(scale)(itemValue);
|
|
72
|
+
if (!Number.isFinite(position)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const format = getAxisValueFormatter(axis, valueFormatter);
|
|
76
|
+
const formattedValue = format(itemValue);
|
|
77
|
+
if (axisDirection === 'x') {
|
|
78
|
+
if (labelPosition === 'start' || labelPosition === 'both') {
|
|
79
|
+
result.push({
|
|
80
|
+
key: `${itemAxisId}-${String(itemValue)}-start`,
|
|
81
|
+
x: position,
|
|
82
|
+
y: top,
|
|
83
|
+
formattedValue,
|
|
84
|
+
position: 'top',
|
|
85
|
+
minCoord: left,
|
|
86
|
+
maxCoord: left + width,
|
|
87
|
+
space: top
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (labelPosition === 'end' || labelPosition === 'both') {
|
|
91
|
+
result.push({
|
|
92
|
+
key: `${itemAxisId}-${String(itemValue)}-end`,
|
|
93
|
+
x: position,
|
|
94
|
+
y: top + height,
|
|
95
|
+
formattedValue,
|
|
96
|
+
position: 'bottom',
|
|
97
|
+
minCoord: left,
|
|
98
|
+
maxCoord: left + width,
|
|
99
|
+
space: bottom
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
if (labelPosition === 'start' || labelPosition === 'both') {
|
|
104
|
+
result.push({
|
|
105
|
+
key: `${itemAxisId}-${String(itemValue)}-start`,
|
|
106
|
+
x: left,
|
|
107
|
+
y: position,
|
|
108
|
+
formattedValue,
|
|
109
|
+
position: 'left',
|
|
110
|
+
minCoord: top,
|
|
111
|
+
maxCoord: top + height,
|
|
112
|
+
space: left
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (labelPosition === 'end' || labelPosition === 'both') {
|
|
116
|
+
result.push({
|
|
117
|
+
key: `${itemAxisId}-${String(itemValue)}-end`,
|
|
118
|
+
x: left + width,
|
|
119
|
+
y: position,
|
|
120
|
+
formattedValue,
|
|
121
|
+
position: 'right',
|
|
122
|
+
minCoord: top,
|
|
123
|
+
maxCoord: top + height,
|
|
124
|
+
space: right
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { getValueToPositionMapper } from "../hooks/getValueToPositionMapper.mjs";
|
|
2
|
+
import { useDrawingArea } from "../hooks/index.mjs";
|
|
3
|
+
import { useStore } from "../internals/store/useStore.mjs";
|
|
4
|
+
import { selectorChartsHighlightXAxisValue, selectorChartsHighlightYAxisValue, selectorChartXAxis, selectorChartYAxis } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs";
|
|
5
|
+
function getAxisValueFormatter(axis, valueFormatter) {
|
|
6
|
+
if (valueFormatter) {
|
|
7
|
+
return valueFormatter;
|
|
8
|
+
}
|
|
9
|
+
if (axis.valueFormatter) {
|
|
10
|
+
return v => axis.valueFormatter(v, {
|
|
11
|
+
location: 'tooltip',
|
|
12
|
+
scale: axis.scale
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return v => `${v}`;
|
|
16
|
+
}
|
|
17
|
+
const EMPTY_ARRAY = [];
|
|
18
|
+
export function useAxisHighlightValue(params) {
|
|
19
|
+
const {
|
|
20
|
+
axisDirection,
|
|
21
|
+
axisId,
|
|
22
|
+
labelPosition = 'end',
|
|
23
|
+
value,
|
|
24
|
+
valueFormatter
|
|
25
|
+
} = params;
|
|
26
|
+
const {
|
|
27
|
+
top,
|
|
28
|
+
left,
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
right,
|
|
32
|
+
bottom
|
|
33
|
+
} = useDrawingArea();
|
|
34
|
+
const store = useStore();
|
|
35
|
+
const highlightSelector = axisDirection === 'x' ? selectorChartsHighlightXAxisValue : selectorChartsHighlightYAxisValue;
|
|
36
|
+
const axisSelector = axisDirection === 'x' ? selectorChartXAxis : selectorChartYAxis;
|
|
37
|
+
const axisHighlightValues = store.use(highlightSelector);
|
|
38
|
+
const axes = store.use(axisSelector);
|
|
39
|
+
if (labelPosition === 'none') {
|
|
40
|
+
return EMPTY_ARRAY;
|
|
41
|
+
}
|
|
42
|
+
let items;
|
|
43
|
+
if (value !== undefined && value !== null) {
|
|
44
|
+
const targetAxisId = axisId ?? axes.axisIds[0];
|
|
45
|
+
items = [{
|
|
46
|
+
axisId: targetAxisId,
|
|
47
|
+
value
|
|
48
|
+
}];
|
|
49
|
+
} else {
|
|
50
|
+
items = axisHighlightValues.filter(item => (axisId === undefined || item.axisId === axisId) && item.value !== undefined).map(item => ({
|
|
51
|
+
axisId: item.axisId,
|
|
52
|
+
value: item.value
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
const result = [];
|
|
56
|
+
for (const {
|
|
57
|
+
axisId: itemAxisId,
|
|
58
|
+
value: itemValue
|
|
59
|
+
} of items) {
|
|
60
|
+
const axis = axes.axis[itemAxisId];
|
|
61
|
+
if (!axis) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const scale = axis.scale;
|
|
65
|
+
const position = getValueToPositionMapper(scale)(itemValue);
|
|
66
|
+
if (!Number.isFinite(position)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const format = getAxisValueFormatter(axis, valueFormatter);
|
|
70
|
+
const formattedValue = format(itemValue);
|
|
71
|
+
if (axisDirection === 'x') {
|
|
72
|
+
if (labelPosition === 'start' || labelPosition === 'both') {
|
|
73
|
+
result.push({
|
|
74
|
+
key: `${itemAxisId}-${String(itemValue)}-start`,
|
|
75
|
+
x: position,
|
|
76
|
+
y: top,
|
|
77
|
+
formattedValue,
|
|
78
|
+
position: 'top',
|
|
79
|
+
minCoord: left,
|
|
80
|
+
maxCoord: left + width,
|
|
81
|
+
space: top
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (labelPosition === 'end' || labelPosition === 'both') {
|
|
85
|
+
result.push({
|
|
86
|
+
key: `${itemAxisId}-${String(itemValue)}-end`,
|
|
87
|
+
x: position,
|
|
88
|
+
y: top + height,
|
|
89
|
+
formattedValue,
|
|
90
|
+
position: 'bottom',
|
|
91
|
+
minCoord: left,
|
|
92
|
+
maxCoord: left + width,
|
|
93
|
+
space: bottom
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
if (labelPosition === 'start' || labelPosition === 'both') {
|
|
98
|
+
result.push({
|
|
99
|
+
key: `${itemAxisId}-${String(itemValue)}-start`,
|
|
100
|
+
x: left,
|
|
101
|
+
y: position,
|
|
102
|
+
formattedValue,
|
|
103
|
+
position: 'left',
|
|
104
|
+
minCoord: top,
|
|
105
|
+
maxCoord: top + height,
|
|
106
|
+
space: left
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (labelPosition === 'end' || labelPosition === 'both') {
|
|
110
|
+
result.push({
|
|
111
|
+
key: `${itemAxisId}-${String(itemValue)}-end`,
|
|
112
|
+
x: left + width,
|
|
113
|
+
y: position,
|
|
114
|
+
formattedValue,
|
|
115
|
+
position: 'right',
|
|
116
|
+
minCoord: top,
|
|
117
|
+
maxCoord: top + height,
|
|
118
|
+
space: right
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|