@mui/x-charts 9.0.4 → 9.1.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 +133 -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 +87 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.mjs +81 -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/index.d.mts +3 -2
- package/ChartsRadiusAxis/index.d.ts +3 -2
- package/ChartsRadiusAxis/index.mjs +3 -1
- package/ChartsRotationAxis/index.d.mts +3 -2
- package/ChartsRotationAxis/index.d.ts +3 -2
- package/ChartsRotationAxis/index.mjs +3 -1
- 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/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/index.d.mts +5 -0
- package/internals/index.d.ts +5 -0
- package/internals/index.js +48 -0
- package/internals/index.mjs +5 -0
- package/internals/plugins/corePlugins/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/useChartCartesianAxisRendering.selectors.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -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 +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +20 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +20 -4
- 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.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 +1 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +1 -1
- package/models/axis.d.mts +28 -28
- package/models/axis.d.ts +28 -28
- 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 +31 -3
|
@@ -51,6 +51,8 @@ const seriesProcessor = (params, dataset, isItemVisible) => {
|
|
|
51
51
|
if (!data && dataset) {
|
|
52
52
|
const dataKey = series[id].dataKey;
|
|
53
53
|
if (!dataKey && !series[id].valueGetter) {
|
|
54
|
+
// TODO: fix mui/no-guarded-throw
|
|
55
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
54
56
|
throw new Error(`MUI X Charts: Bar series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
|
|
55
57
|
}
|
|
56
58
|
if (dataKey) {
|
|
@@ -44,6 +44,8 @@ const seriesProcessor = (params, dataset, isItemVisible) => {
|
|
|
44
44
|
if (!data && dataset) {
|
|
45
45
|
const dataKey = series[id].dataKey;
|
|
46
46
|
if (!dataKey && !series[id].valueGetter) {
|
|
47
|
+
// TODO: fix mui/no-guarded-throw
|
|
48
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
47
49
|
throw new Error(`MUI X Charts: Bar series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
|
|
48
50
|
}
|
|
49
51
|
if (dataKey) {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,138 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.1.0
|
|
4
|
+
|
|
5
|
+
_May 8, 2026_
|
|
6
|
+
|
|
7
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
8
|
+
|
|
9
|
+
- ⚡️ Add a WebGL renderer to the [Scatter chart](https://mui.com/x/react-charts/scatter/#webgl-renderer), and apply the same WebGL performance patterns to the candlestick and heatmap [Premium]
|
|
10
|
+
- 🐞 Bugfixes
|
|
11
|
+
- 📚 Documentation improvements
|
|
12
|
+
|
|
13
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
14
|
+
@Anexus5919, @gaetanodanelli, @imazizbohra, @mustafajw07
|
|
15
|
+
|
|
16
|
+
The following team members contributed to this release:
|
|
17
|
+
@alexfauquette, @brijeshb42, @flaviendelangle, @JCQuintas, @LukasTy, @mapache-salvaje, @MBilalShafi, @michelengelen, @oliviertassinari, @rita-codes
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@9.1.0`
|
|
22
|
+
|
|
23
|
+
- [DataGrid] Fix accessibility violation in detail panel toggle column header (#22178) @michelengelen
|
|
24
|
+
- [DataGrid] Fix active filter detection for array values (#22340) @MBilalShafi
|
|
25
|
+
- [DataGrid] Fix crash when grouping/tree-data values match `Object.prototype` property names (#22312) @LukasTy
|
|
26
|
+
- [DataGrid] Position overlays below top pinned rows (#22341) @MBilalShafi
|
|
27
|
+
- [l10n] Improve Italian (it-IT) locale (#22290) @gaetanodanelli
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid-pro@9.1.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
30
|
+
|
|
31
|
+
Same changes as in `@mui/x-data-grid@9.1.0`, plus:
|
|
32
|
+
|
|
33
|
+
- [DataGridPro] Fix column unpin restoring stale position after reorder (#22250) @michelengelen
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@9.1.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@9.1.0`, plus:
|
|
38
|
+
|
|
39
|
+
- [DataGridPremium] Fix aggregation column header title truncation without ellipsis (#22248) @michelengelen
|
|
40
|
+
|
|
41
|
+
### Date and Time Pickers
|
|
42
|
+
|
|
43
|
+
#### `@mui/x-date-pickers@9.1.0`
|
|
44
|
+
|
|
45
|
+
- [pickers] Fix duplicate hour label in `MultiSectionDigitalClock` on DST day (#22110) @LukasTy
|
|
46
|
+
- [l10n] Improve Italian (it-IT) locale (#22290) @gaetanodanelli
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers-pro@9.1.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
49
|
+
|
|
50
|
+
Same changes as in `@mui/x-date-pickers@9.1.0`.
|
|
51
|
+
|
|
52
|
+
### Charts
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-charts@9.1.0`
|
|
55
|
+
|
|
56
|
+
- [charts] Add `ChartsAxisHighlightValue` component (#21803) @Copilot
|
|
57
|
+
- [charts] Create `ChartsRadialAxisHighlight` (#22241) @alexfauquette
|
|
58
|
+
- [charts] Remove useless extends (#22313) @alexfauquette
|
|
59
|
+
- [charts] Use `PolarAxisConfig` in polar plugin internals (#22315) @alexfauquette
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-charts-pro@9.1.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
|
+
|
|
63
|
+
Same changes as in `@mui/x-charts@9.1.0`.
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-charts-premium@9.1.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
66
|
+
|
|
67
|
+
Same changes as in `@mui/x-charts-pro@9.1.0`, plus:
|
|
68
|
+
|
|
69
|
+
- [charts-premium] Add WebGL renderer to `ScatterChartPremium` (#22157) @JCQuintas
|
|
70
|
+
- [charts-premium] Add highlight to the `RadialLineChart` (#22156) @alexfauquette
|
|
71
|
+
- [charts-premium] Apply WebGL perf patterns to candlestick + heatmap (#22223) @JCQuintas
|
|
72
|
+
- [charts-premium] Introduce the `RadialBarChart` (#22268) @alexfauquette
|
|
73
|
+
|
|
74
|
+
### Tree View
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-tree-view@9.1.0`
|
|
77
|
+
|
|
78
|
+
- [tree view] Fix stale Tree View `apiRef` after keyed remount (#22342) @MBilalShafi
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-tree-view-pro@9.1.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
81
|
+
|
|
82
|
+
Same changes as in `@mui/x-tree-view@9.1.0`.
|
|
83
|
+
|
|
84
|
+
### Scheduler
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-scheduler@9.0.0-alpha.5`
|
|
87
|
+
|
|
88
|
+
- [scheduler] Make `EventItem` interactive by integrating button props for keyboard accessibility (#22160) @mustafajw07
|
|
89
|
+
- [scheduler] Migrate color switch to Base UI `ToggleGroup` (#22254) @flaviendelangle
|
|
90
|
+
- [scheduler] Rename Scheduler headless packages (#22273) @rita-codes
|
|
91
|
+
- [scheduler] Use TreeView for the resource sidebar (#22261) @flaviendelangle
|
|
92
|
+
- [scheduler] Use fieldset/legend instead of headings for form sections in the event dialog (#22095) @Anexus5919
|
|
93
|
+
- [scheduler] Added `position: relative` for consistent layout (#22284) @mustafajw07
|
|
94
|
+
- [l10n] Improve Italian (it-IT) locale (#22290) @gaetanodanelli
|
|
95
|
+
|
|
96
|
+
#### `@mui/x-scheduler-premium@9.0.0-alpha.5` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
97
|
+
|
|
98
|
+
Same changes as in `@mui/x-scheduler@9.0.0-alpha.5`, plus:
|
|
99
|
+
|
|
100
|
+
- [scheduler] Replace per-view headers with a generic `EventTimelinePremiumHeader` in the `EventTimeline` (#22222) @rita-codes
|
|
101
|
+
|
|
102
|
+
### Codemod
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-codemod@9.1.0`
|
|
105
|
+
|
|
106
|
+
Internal changes.
|
|
107
|
+
|
|
108
|
+
### Docs
|
|
109
|
+
|
|
110
|
+
- [docs] Migrate `FlightPicker` overview demo to v9 `slotProps` shape (#22272) @LukasTy
|
|
111
|
+
- [docs] Standardize Scheduler docs style and formatting (#22161) @mapache-salvaje
|
|
112
|
+
- [docs] Add feedback form to the scheduler docs (#22237) @rita-codes
|
|
113
|
+
- [docs] Fix `GridToolbarCustom` demo crash in DataGrid (#21950) @MBilalShafi
|
|
114
|
+
- [docs] Do not resolve axes in charts (#22307) @alexfauquette
|
|
115
|
+
- [docs] Fix no longer valid link (#22371) @LukasTy
|
|
116
|
+
- [docs] Replace broken CodeSandbox iframes in migration guides (#22352) @LukasTy
|
|
117
|
+
|
|
118
|
+
### Core
|
|
119
|
+
|
|
120
|
+
- [code-infra] Bump browser `testTimeout` to absorb React 19 slowness (#22236) @LukasTy
|
|
121
|
+
- [code-infra] Use vale rules from code-infra package (#22256) @brijeshb42
|
|
122
|
+
- [code-infra] Fix broken valelint and docs build (#22362) @LukasTy
|
|
123
|
+
- [internal] Prepare renaming LICENSE file to LICENSE.md (#22055) @imazizbohra
|
|
124
|
+
- [internal] Remove outdated .woff files (#22286) @oliviertassinari
|
|
125
|
+
- [internal] Replace Codspeed with `@mui/internal-benchmark` for charts (#22243) @JCQuintas
|
|
126
|
+
|
|
127
|
+
### Miscellaneous
|
|
128
|
+
|
|
129
|
+
- [internal-gestures] Add passive option to `TurnWheelGesture` (#22349) @JCQuintas
|
|
130
|
+
- [internal-gestures] Enforce pointer-type filter in `ShadowRoot` branch (#22327) @JCQuintas
|
|
131
|
+
- [internal-gestures] Improve passive event listener handling (#22329) @JCQuintas
|
|
132
|
+
- [internal-gestures] Inline wheel-delta clamp per axis (#22331) @JCQuintas
|
|
133
|
+
- [internal-gestures] Return read-only pointer map without copy (#22330) @JCQuintas
|
|
134
|
+
- [internal-gestures] Track multi-tap reset timeout to prevent leak (#22326) @JCQuintas
|
|
135
|
+
|
|
3
136
|
## 9.0.4
|
|
4
137
|
|
|
5
138
|
_Apr 28, 2026_
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type SxProps } from '@mui/material/styles';
|
|
2
|
+
import { type AxisId } from "../models/axis.mjs";
|
|
3
|
+
export type ChartsAxisHighlightValuePosition = 'start' | 'end' | 'both' | 'none';
|
|
4
|
+
export interface ChartsAxisHighlightValueProps {
|
|
5
|
+
/**
|
|
6
|
+
* The axis direction.
|
|
7
|
+
*/
|
|
8
|
+
axisDirection: 'x' | 'y';
|
|
9
|
+
/**
|
|
10
|
+
* The id of the axis.
|
|
11
|
+
* If not provided, defaults to the first axis.
|
|
12
|
+
*/
|
|
13
|
+
axisId?: AxisId;
|
|
14
|
+
/**
|
|
15
|
+
* The position of the label relative to the drawing area.
|
|
16
|
+
* - `'start'`: at the beginning of the drawing area (top for x-axis, left for y-axis).
|
|
17
|
+
* - `'end'`: at the end of the drawing area (bottom for x-axis, right for y-axis).
|
|
18
|
+
* - `'both'`: at both positions.
|
|
19
|
+
* - `'none'`: no label is displayed.
|
|
20
|
+
* @default 'end'
|
|
21
|
+
*/
|
|
22
|
+
labelPosition?: ChartsAxisHighlightValuePosition;
|
|
23
|
+
/**
|
|
24
|
+
* The value to display.
|
|
25
|
+
* If not defined, tracks the axis highlight value from user interaction.
|
|
26
|
+
*/
|
|
27
|
+
value?: number | Date | string | null;
|
|
28
|
+
/**
|
|
29
|
+
* A function to format the displayed value.
|
|
30
|
+
* If not provided, uses the axis `valueFormatter`, or falls back to a default formatter.
|
|
31
|
+
* @param {number | Date | string} value The value to format.
|
|
32
|
+
* @returns {string} The formatted string.
|
|
33
|
+
*/
|
|
34
|
+
valueFormatter?: (value: number | Date | string) => string;
|
|
35
|
+
sx?: SxProps;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A component that displays the axis value at the edge of the drawing area,
|
|
39
|
+
* aligned with the current axis highlight position.
|
|
40
|
+
*
|
|
41
|
+
* Renders as a portal into the ChartsLayerContainer, appearing as the last child.
|
|
42
|
+
*
|
|
43
|
+
* Demos:
|
|
44
|
+
*
|
|
45
|
+
* - [Custom components](https://mui.com/x/react-charts/components/)
|
|
46
|
+
*
|
|
47
|
+
* API:
|
|
48
|
+
*
|
|
49
|
+
* - [ChartsAxisHighlightValue API](https://mui.com/x/api/charts/charts-axis-highlight-value/)
|
|
50
|
+
*/
|
|
51
|
+
declare function ChartsAxisHighlightValue(props: ChartsAxisHighlightValueProps): import("react").ReactPortal | import("react/jsx-runtime").JSX.Element[] | null;
|
|
52
|
+
declare namespace ChartsAxisHighlightValue {
|
|
53
|
+
var propTypes: any;
|
|
54
|
+
}
|
|
55
|
+
export { ChartsAxisHighlightValue };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type SxProps } from '@mui/material/styles';
|
|
2
|
+
import { type AxisId } from "../models/axis.js";
|
|
3
|
+
export type ChartsAxisHighlightValuePosition = 'start' | 'end' | 'both' | 'none';
|
|
4
|
+
export interface ChartsAxisHighlightValueProps {
|
|
5
|
+
/**
|
|
6
|
+
* The axis direction.
|
|
7
|
+
*/
|
|
8
|
+
axisDirection: 'x' | 'y';
|
|
9
|
+
/**
|
|
10
|
+
* The id of the axis.
|
|
11
|
+
* If not provided, defaults to the first axis.
|
|
12
|
+
*/
|
|
13
|
+
axisId?: AxisId;
|
|
14
|
+
/**
|
|
15
|
+
* The position of the label relative to the drawing area.
|
|
16
|
+
* - `'start'`: at the beginning of the drawing area (top for x-axis, left for y-axis).
|
|
17
|
+
* - `'end'`: at the end of the drawing area (bottom for x-axis, right for y-axis).
|
|
18
|
+
* - `'both'`: at both positions.
|
|
19
|
+
* - `'none'`: no label is displayed.
|
|
20
|
+
* @default 'end'
|
|
21
|
+
*/
|
|
22
|
+
labelPosition?: ChartsAxisHighlightValuePosition;
|
|
23
|
+
/**
|
|
24
|
+
* The value to display.
|
|
25
|
+
* If not defined, tracks the axis highlight value from user interaction.
|
|
26
|
+
*/
|
|
27
|
+
value?: number | Date | string | null;
|
|
28
|
+
/**
|
|
29
|
+
* A function to format the displayed value.
|
|
30
|
+
* If not provided, uses the axis `valueFormatter`, or falls back to a default formatter.
|
|
31
|
+
* @param {number | Date | string} value The value to format.
|
|
32
|
+
* @returns {string} The formatted string.
|
|
33
|
+
*/
|
|
34
|
+
valueFormatter?: (value: number | Date | string) => string;
|
|
35
|
+
sx?: SxProps;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A component that displays the axis value at the edge of the drawing area,
|
|
39
|
+
* aligned with the current axis highlight position.
|
|
40
|
+
*
|
|
41
|
+
* Renders as a portal into the ChartsLayerContainer, appearing as the last child.
|
|
42
|
+
*
|
|
43
|
+
* Demos:
|
|
44
|
+
*
|
|
45
|
+
* - [Custom components](https://mui.com/x/react-charts/components/)
|
|
46
|
+
*
|
|
47
|
+
* API:
|
|
48
|
+
*
|
|
49
|
+
* - [ChartsAxisHighlightValue API](https://mui.com/x/api/charts/charts-axis-highlight-value/)
|
|
50
|
+
*/
|
|
51
|
+
declare function ChartsAxisHighlightValue(props: ChartsAxisHighlightValueProps): import("react").ReactPortal | import("react/jsx-runtime").JSX.Element[] | null;
|
|
52
|
+
declare namespace ChartsAxisHighlightValue {
|
|
53
|
+
var propTypes: any;
|
|
54
|
+
}
|
|
55
|
+
export { ChartsAxisHighlightValue };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsAxisHighlightValue = ChartsAxisHighlightValue;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _useChartsLayerContainerRef = require("../hooks/useChartsLayerContainerRef");
|
|
14
|
+
var _useAxisHighlightValue = require("./useAxisHighlightValue");
|
|
15
|
+
var _ChartsAxisHighlightValueItem = require("./ChartsAxisHighlightValueItem");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* A component that displays the axis value at the edge of the drawing area,
|
|
19
|
+
* aligned with the current axis highlight position.
|
|
20
|
+
*
|
|
21
|
+
* Renders as a portal into the ChartsLayerContainer, appearing as the last child.
|
|
22
|
+
*
|
|
23
|
+
* Demos:
|
|
24
|
+
*
|
|
25
|
+
* - [Custom components](https://mui.com/x/react-charts/components/)
|
|
26
|
+
*
|
|
27
|
+
* API:
|
|
28
|
+
*
|
|
29
|
+
* - [ChartsAxisHighlightValue API](https://mui.com/x/api/charts/charts-axis-highlight-value/)
|
|
30
|
+
*/
|
|
31
|
+
function ChartsAxisHighlightValue(props) {
|
|
32
|
+
const {
|
|
33
|
+
axisDirection,
|
|
34
|
+
axisId,
|
|
35
|
+
labelPosition,
|
|
36
|
+
value,
|
|
37
|
+
valueFormatter,
|
|
38
|
+
sx
|
|
39
|
+
} = props;
|
|
40
|
+
const chartsLayerContainerRef = (0, _useChartsLayerContainerRef.useChartsLayerContainerRef)();
|
|
41
|
+
const items = (0, _useAxisHighlightValue.useAxisHighlightValue)({
|
|
42
|
+
axisDirection,
|
|
43
|
+
axisId,
|
|
44
|
+
labelPosition,
|
|
45
|
+
value,
|
|
46
|
+
valueFormatter
|
|
47
|
+
});
|
|
48
|
+
if (items.length === 0) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const content = items.map(itemProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightValueItem.ChartsAxisHighlightValueItem, (0, _extends2.default)({}, itemProps, {
|
|
52
|
+
sx: sx
|
|
53
|
+
})));
|
|
54
|
+
if (!chartsLayerContainerRef.current) {
|
|
55
|
+
return content;
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/ReactDOM.createPortal(content, chartsLayerContainerRef.current);
|
|
58
|
+
}
|
|
59
|
+
ChartsAxisHighlightValue.propTypes = {
|
|
60
|
+
// ----------------------------- Warning --------------------------------
|
|
61
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
62
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
63
|
+
// ----------------------------------------------------------------------
|
|
64
|
+
/**
|
|
65
|
+
* The axis direction.
|
|
66
|
+
*/
|
|
67
|
+
axisDirection: _propTypes.default.oneOf(['x', 'y']).isRequired,
|
|
68
|
+
/**
|
|
69
|
+
* The id of the axis.
|
|
70
|
+
* If not provided, defaults to the first axis.
|
|
71
|
+
*/
|
|
72
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
73
|
+
/**
|
|
74
|
+
* The position of the label relative to the drawing area.
|
|
75
|
+
* - `'start'`: at the beginning of the drawing area (top for x-axis, left for y-axis).
|
|
76
|
+
* - `'end'`: at the end of the drawing area (bottom for x-axis, right for y-axis).
|
|
77
|
+
* - `'both'`: at both positions.
|
|
78
|
+
* - `'none'`: no label is displayed.
|
|
79
|
+
* @default 'end'
|
|
80
|
+
*/
|
|
81
|
+
labelPosition: _propTypes.default.oneOf(['both', 'end', 'none', 'start']),
|
|
82
|
+
/**
|
|
83
|
+
* The value to display.
|
|
84
|
+
* If not defined, tracks the axis highlight value from user interaction.
|
|
85
|
+
*/
|
|
86
|
+
value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]),
|
|
87
|
+
/**
|
|
88
|
+
* A function to format the displayed value.
|
|
89
|
+
* If not provided, uses the axis `valueFormatter`, or falls back to a default formatter.
|
|
90
|
+
* @param {number | Date | string} value The value to format.
|
|
91
|
+
* @returns {string} The formatted string.
|
|
92
|
+
*/
|
|
93
|
+
valueFormatter: _propTypes.default.func
|
|
94
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { useChartsLayerContainerRef } from "../hooks/useChartsLayerContainerRef.mjs";
|
|
7
|
+
import { useAxisHighlightValue } from "./useAxisHighlightValue.mjs";
|
|
8
|
+
import { ChartsAxisHighlightValueItem } from "./ChartsAxisHighlightValueItem.mjs";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* A component that displays the axis value at the edge of the drawing area,
|
|
12
|
+
* aligned with the current axis highlight position.
|
|
13
|
+
*
|
|
14
|
+
* Renders as a portal into the ChartsLayerContainer, appearing as the last child.
|
|
15
|
+
*
|
|
16
|
+
* Demos:
|
|
17
|
+
*
|
|
18
|
+
* - [Custom components](https://mui.com/x/react-charts/components/)
|
|
19
|
+
*
|
|
20
|
+
* API:
|
|
21
|
+
*
|
|
22
|
+
* - [ChartsAxisHighlightValue API](https://mui.com/x/api/charts/charts-axis-highlight-value/)
|
|
23
|
+
*/
|
|
24
|
+
function ChartsAxisHighlightValue(props) {
|
|
25
|
+
const {
|
|
26
|
+
axisDirection,
|
|
27
|
+
axisId,
|
|
28
|
+
labelPosition,
|
|
29
|
+
value,
|
|
30
|
+
valueFormatter,
|
|
31
|
+
sx
|
|
32
|
+
} = props;
|
|
33
|
+
const chartsLayerContainerRef = useChartsLayerContainerRef();
|
|
34
|
+
const items = useAxisHighlightValue({
|
|
35
|
+
axisDirection,
|
|
36
|
+
axisId,
|
|
37
|
+
labelPosition,
|
|
38
|
+
value,
|
|
39
|
+
valueFormatter
|
|
40
|
+
});
|
|
41
|
+
if (items.length === 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const content = items.map(itemProps => /*#__PURE__*/_jsx(ChartsAxisHighlightValueItem, _extends({}, itemProps, {
|
|
45
|
+
sx: sx
|
|
46
|
+
})));
|
|
47
|
+
if (!chartsLayerContainerRef.current) {
|
|
48
|
+
return content;
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/ReactDOM.createPortal(content, chartsLayerContainerRef.current);
|
|
51
|
+
}
|
|
52
|
+
ChartsAxisHighlightValue.propTypes = {
|
|
53
|
+
// ----------------------------- Warning --------------------------------
|
|
54
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
55
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
56
|
+
// ----------------------------------------------------------------------
|
|
57
|
+
/**
|
|
58
|
+
* The axis direction.
|
|
59
|
+
*/
|
|
60
|
+
axisDirection: PropTypes.oneOf(['x', 'y']).isRequired,
|
|
61
|
+
/**
|
|
62
|
+
* The id of the axis.
|
|
63
|
+
* If not provided, defaults to the first axis.
|
|
64
|
+
*/
|
|
65
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
66
|
+
/**
|
|
67
|
+
* The position of the label relative to the drawing area.
|
|
68
|
+
* - `'start'`: at the beginning of the drawing area (top for x-axis, left for y-axis).
|
|
69
|
+
* - `'end'`: at the end of the drawing area (bottom for x-axis, right for y-axis).
|
|
70
|
+
* - `'both'`: at both positions.
|
|
71
|
+
* - `'none'`: no label is displayed.
|
|
72
|
+
* @default 'end'
|
|
73
|
+
*/
|
|
74
|
+
labelPosition: PropTypes.oneOf(['both', 'end', 'none', 'start']),
|
|
75
|
+
/**
|
|
76
|
+
* The value to display.
|
|
77
|
+
* If not defined, tracks the axis highlight value from user interaction.
|
|
78
|
+
*/
|
|
79
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]),
|
|
80
|
+
/**
|
|
81
|
+
* A function to format the displayed value.
|
|
82
|
+
* If not provided, uses the axis `valueFormatter`, or falls back to a default formatter.
|
|
83
|
+
* @param {number | Date | string} value The value to format.
|
|
84
|
+
* @returns {string} The formatted string.
|
|
85
|
+
*/
|
|
86
|
+
valueFormatter: PropTypes.func
|
|
87
|
+
};
|
|
88
|
+
export { ChartsAxisHighlightValue };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SxProps } from '@mui/material/styles';
|
|
2
|
+
export interface ChartsAxisHighlightValueItemProps {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
formattedValue: string;
|
|
6
|
+
position: 'top' | 'right' | 'bottom' | 'left';
|
|
7
|
+
minCoord: number;
|
|
8
|
+
maxCoord: number;
|
|
9
|
+
space: number;
|
|
10
|
+
sx?: SxProps;
|
|
11
|
+
}
|
|
12
|
+
declare function ChartsAxisHighlightValueItem(props: ChartsAxisHighlightValueItemProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { ChartsAxisHighlightValueItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SxProps } from '@mui/material/styles';
|
|
2
|
+
export interface ChartsAxisHighlightValueItemProps {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
formattedValue: string;
|
|
6
|
+
position: 'top' | 'right' | 'bottom' | 'left';
|
|
7
|
+
minCoord: number;
|
|
8
|
+
maxCoord: number;
|
|
9
|
+
space: number;
|
|
10
|
+
sx?: SxProps;
|
|
11
|
+
}
|
|
12
|
+
declare function ChartsAxisHighlightValueItem(props: ChartsAxisHighlightValueItemProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { ChartsAxisHighlightValueItem };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsAxisHighlightValueItem = ChartsAxisHighlightValueItem;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _createStyled = require("@mui/system/createStyled");
|
|
14
|
+
var _chartsAxisHighlightValueClasses = require("./chartsAxisHighlightValueClasses");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const ChartsAxisHighlightValueText = (0, _styles.styled)('div', {
|
|
17
|
+
name: 'MuiChartsAxisHighlightValue',
|
|
18
|
+
slot: 'Root',
|
|
19
|
+
shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'position'
|
|
20
|
+
})(({
|
|
21
|
+
theme
|
|
22
|
+
}) => (0, _extends2.default)({}, theme.typography.caption, {
|
|
23
|
+
padding: theme.spacing(0.5, 1),
|
|
24
|
+
border: `solid ${theme.palette.divider} 1px`,
|
|
25
|
+
backgroundColor: theme.palette.background.paper,
|
|
26
|
+
'--clamped-offset': 'calc(-1*min(var(--min),max(calc(100% - var(--max)),50%)))',
|
|
27
|
+
variants: [{
|
|
28
|
+
props: {
|
|
29
|
+
position: 'top'
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
translate: 'var(--clamped-offset) -100%'
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
props: {
|
|
36
|
+
position: 'bottom'
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
39
|
+
translate: 'var(--clamped-offset) 0'
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
props: {
|
|
43
|
+
position: 'left'
|
|
44
|
+
},
|
|
45
|
+
style: {
|
|
46
|
+
translate: '-100% var(--clamped-offset)'
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
props: {
|
|
50
|
+
position: 'right'
|
|
51
|
+
},
|
|
52
|
+
style: {
|
|
53
|
+
translate: '0 var(--clamped-offset)'
|
|
54
|
+
}
|
|
55
|
+
}]
|
|
56
|
+
}));
|
|
57
|
+
function ChartsAxisHighlightValueItem(props) {
|
|
58
|
+
const {
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
position,
|
|
62
|
+
formattedValue,
|
|
63
|
+
minCoord,
|
|
64
|
+
maxCoord,
|
|
65
|
+
space,
|
|
66
|
+
sx
|
|
67
|
+
} = props;
|
|
68
|
+
const classes = (0, _chartsAxisHighlightValueClasses.useUtilityClasses)({
|
|
69
|
+
position
|
|
70
|
+
});
|
|
71
|
+
const isXAxis = position === 'top' || position === 'bottom';
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightValueText, {
|
|
73
|
+
className: classes.root,
|
|
74
|
+
position: position,
|
|
75
|
+
style: {
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
top: y,
|
|
78
|
+
left: x,
|
|
79
|
+
'--min': `${isXAxis ? x - minCoord : y - minCoord}px`,
|
|
80
|
+
'--max': `${isXAxis ? maxCoord - x : maxCoord - y}px`,
|
|
81
|
+
'--space': `${space}px`
|
|
82
|
+
},
|
|
83
|
+
sx: sx,
|
|
84
|
+
children: formattedValue
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -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;
|