@mui/x-charts-premium 8.26.0 → 9.0.0-alpha.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/BarChartPremium/BarChartPremium.d.ts +14 -2
- package/BarChartPremium/BarChartPremium.js +11 -5
- package/BarChartPremium/RangeBar/AnimatedRangeBarElement.js +1 -1
- package/BarChartPremium/RangeBar/FocusedRangeBar.d.ts +2 -0
- package/BarChartPremium/RangeBar/FocusedRangeBar.js +70 -0
- package/BarChartPremium/RangeBar/RangeBarPlot.js +1 -1
- package/BarChartPremium/RangeBar/createGetRangeBarDimensions.d.ts +13 -0
- package/BarChartPremium/RangeBar/createGetRangeBarDimensions.js +42 -0
- package/BarChartPremium/RangeBar/seriesConfig/getSeriesWithDefaultValues.d.ts +2 -2
- package/BarChartPremium/RangeBar/seriesConfig/index.js +4 -1
- package/BarChartPremium/RangeBar/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/BarChartPremium/RangeBar/seriesConfig/keyboardFocusHandler.js +22 -0
- package/BarChartPremium/RangeBar/seriesConfig/legend.js +0 -1
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.js +8 -2
- package/BarChartPremium/RangeBar/useRangeBarPlotData.d.ts +2 -9
- package/BarChartPremium/RangeBar/useRangeBarPlotData.js +16 -51
- package/BarChartPremium/index.d.ts +1 -0
- package/BarChartPremium/index.js +12 -0
- package/CHANGELOG.md +355 -3
- package/ChartContainerPremium/ChartContainerPremium.d.ts +17 -31
- package/ChartContainerPremium/ChartContainerPremium.js +15 -43
- package/ChartContainerPremium/useChartContainerPremiumProps.d.ts +10 -9
- package/ChartContainerPremium/useChartContainerPremiumProps.js +10 -27
- package/ChartDataProviderPremium/ChartDataProviderPremium.d.ts +7 -5
- package/ChartDataProviderPremium/ChartDataProviderPremium.js +6 -6
- package/ChartDataProviderPremium/index.d.ts +1 -1
- package/ChartDataProviderPremium/useChartDataProviderPremiumProps.d.ts +3 -3
- package/ChartZoomSlider/internals/previews/RangeBarPreviewPlot.js +1 -1
- package/ChartsContainer/index.d.ts +1 -0
- package/ChartsContainer/index.js +16 -0
- package/ChartsContainerPremium/ChartsContainerPremium.d.ts +37 -0
- package/ChartsContainerPremium/ChartsContainerPremium.js +52 -0
- package/ChartsContainerPremium/index.d.ts +2 -0
- package/ChartsContainerPremium/index.js +17 -0
- package/ChartsContainerPremium/useChartsContainerPremiumProps.d.ts +9 -0
- package/ChartsContainerPremium/useChartsContainerPremiumProps.js +33 -0
- package/ChartsContainerPro/index.d.ts +1 -0
- package/ChartsContainerPro/index.js +16 -0
- package/HeatmapPremium/HeatmapPlotPremium.d.ts +9 -0
- package/HeatmapPremium/HeatmapPlotPremium.js +29 -0
- package/HeatmapPremium/HeatmapPremium.d.ts +15 -0
- package/HeatmapPremium/HeatmapPremium.js +478 -0
- package/HeatmapPremium/HeatmapPremium.plugins.d.ts +4 -0
- package/HeatmapPremium/HeatmapPremium.plugins.js +9 -0
- package/HeatmapPremium/index.d.ts +1 -0
- package/HeatmapPremium/index.js +16 -0
- package/HeatmapPremium/useHeatmapPremiumProps.d.ts +16 -0
- package/HeatmapPremium/useHeatmapPremiumProps.js +26 -0
- package/HeatmapPremium/webgl/HeatmapWebGLPlot.d.ts +6 -0
- package/HeatmapPremium/webgl/HeatmapWebGLPlot.js +185 -0
- package/HeatmapPremium/webgl/HeatmapWebGLRenderer.d.ts +4 -0
- package/HeatmapPremium/webgl/HeatmapWebGLRenderer.js +23 -0
- package/HeatmapPremium/webgl/shaders.d.ts +3 -0
- package/HeatmapPremium/webgl/shaders.js +77 -0
- package/HeatmapPremium/webgl/useHeatmapPlotData.d.ts +12 -0
- package/HeatmapPremium/webgl/useHeatmapPlotData.js +58 -0
- package/HeatmapPremium/webgl/utils.d.ts +8 -0
- package/HeatmapPremium/webgl/utils.js +51 -0
- package/esm/BarChartPremium/BarChartPremium.d.ts +14 -2
- package/esm/BarChartPremium/BarChartPremium.js +12 -6
- package/esm/BarChartPremium/RangeBar/AnimatedRangeBarElement.js +1 -1
- package/esm/BarChartPremium/RangeBar/FocusedRangeBar.d.ts +2 -0
- package/esm/BarChartPremium/RangeBar/FocusedRangeBar.js +63 -0
- package/esm/BarChartPremium/RangeBar/RangeBarPlot.js +1 -1
- package/esm/BarChartPremium/RangeBar/createGetRangeBarDimensions.d.ts +13 -0
- package/esm/BarChartPremium/RangeBar/createGetRangeBarDimensions.js +36 -0
- package/esm/BarChartPremium/RangeBar/seriesConfig/getSeriesWithDefaultValues.d.ts +2 -2
- package/esm/BarChartPremium/RangeBar/seriesConfig/index.js +5 -2
- package/esm/BarChartPremium/RangeBar/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/BarChartPremium/RangeBar/seriesConfig/keyboardFocusHandler.js +16 -0
- package/esm/BarChartPremium/RangeBar/seriesConfig/legend.js +0 -1
- package/esm/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.js +8 -2
- package/esm/BarChartPremium/RangeBar/useRangeBarPlotData.d.ts +2 -9
- package/esm/BarChartPremium/RangeBar/useRangeBarPlotData.js +16 -51
- package/esm/BarChartPremium/index.d.ts +1 -0
- package/esm/BarChartPremium/index.js +1 -0
- package/esm/ChartContainerPremium/ChartContainerPremium.d.ts +17 -31
- package/esm/ChartContainerPremium/ChartContainerPremium.js +16 -42
- package/esm/ChartContainerPremium/useChartContainerPremiumProps.d.ts +10 -9
- package/esm/ChartContainerPremium/useChartContainerPremiumProps.js +10 -25
- package/esm/ChartDataProviderPremium/ChartDataProviderPremium.d.ts +7 -5
- package/esm/ChartDataProviderPremium/ChartDataProviderPremium.js +6 -5
- package/esm/ChartDataProviderPremium/index.d.ts +1 -1
- package/esm/ChartDataProviderPremium/useChartDataProviderPremiumProps.d.ts +3 -3
- package/esm/ChartZoomSlider/internals/previews/RangeBarPreviewPlot.js +1 -1
- package/esm/ChartsContainer/index.d.ts +1 -0
- package/esm/ChartsContainer/index.js +2 -0
- package/esm/ChartsContainerPremium/ChartsContainerPremium.d.ts +37 -0
- package/esm/ChartsContainerPremium/ChartsContainerPremium.js +46 -0
- package/esm/ChartsContainerPremium/index.d.ts +2 -0
- package/esm/ChartsContainerPremium/index.js +2 -0
- package/esm/ChartsContainerPremium/useChartsContainerPremiumProps.d.ts +9 -0
- package/esm/ChartsContainerPremium/useChartsContainerPremiumProps.js +27 -0
- package/esm/ChartsContainerPro/index.d.ts +1 -0
- package/esm/ChartsContainerPro/index.js +2 -0
- package/esm/HeatmapPremium/HeatmapPlotPremium.d.ts +9 -0
- package/esm/HeatmapPremium/HeatmapPlotPremium.js +23 -0
- package/esm/HeatmapPremium/HeatmapPremium.d.ts +15 -0
- package/esm/HeatmapPremium/HeatmapPremium.js +472 -0
- package/esm/HeatmapPremium/HeatmapPremium.plugins.d.ts +4 -0
- package/esm/HeatmapPremium/HeatmapPremium.plugins.js +3 -0
- package/esm/HeatmapPremium/index.d.ts +1 -0
- package/esm/HeatmapPremium/index.js +1 -0
- package/esm/HeatmapPremium/useHeatmapPremiumProps.d.ts +16 -0
- package/esm/HeatmapPremium/useHeatmapPremiumProps.js +19 -0
- package/esm/HeatmapPremium/webgl/HeatmapWebGLPlot.d.ts +6 -0
- package/esm/HeatmapPremium/webgl/HeatmapWebGLPlot.js +178 -0
- package/esm/HeatmapPremium/webgl/HeatmapWebGLRenderer.d.ts +4 -0
- package/esm/HeatmapPremium/webgl/HeatmapWebGLRenderer.js +17 -0
- package/esm/HeatmapPremium/webgl/shaders.d.ts +3 -0
- package/esm/HeatmapPremium/webgl/shaders.js +71 -0
- package/esm/HeatmapPremium/webgl/useHeatmapPlotData.d.ts +12 -0
- package/esm/HeatmapPremium/webgl/useHeatmapPlotData.js +51 -0
- package/esm/HeatmapPremium/webgl/utils.d.ts +8 -0
- package/esm/HeatmapPremium/webgl/utils.js +41 -0
- package/esm/index.d.ts +5 -1
- package/esm/index.js +5 -2
- package/esm/internals/plugins/allPlugins.d.ts +1 -1
- package/esm/models/seriesType/rangeBar.d.ts +1 -1
- package/esm/typeOverloads/modules.d.ts +2 -1
- package/esm/utils/webgl/parseColor.d.ts +5 -0
- package/esm/utils/webgl/parseColor.js +78 -0
- package/esm/utils/webgl/useWebGLResizeObserver.d.ts +7 -0
- package/esm/utils/webgl/useWebGLResizeObserver.js +64 -0
- package/index.d.ts +5 -1
- package/index.js +33 -1
- package/internals/plugins/allPlugins.d.ts +1 -1
- package/models/seriesType/rangeBar.d.ts +1 -1
- package/package.json +9 -9
- package/typeOverloads/modules.d.ts +2 -1
- package/utils/webgl/parseColor.d.ts +5 -0
- package/utils/webgl/parseColor.js +84 -0
- package/utils/webgl/useWebGLResizeObserver.d.ts +7 -0
- package/utils/webgl/useWebGLResizeObserver.js +70 -0
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type BarChartProProps } from '@mui/x-charts-pro/BarChartPro';
|
|
2
|
+
import { type BarChartProProps, type BarChartProSlotProps, type BarChartProSlots } from '@mui/x-charts-pro/BarChartPro';
|
|
3
3
|
import { type BarSeries } from '@mui/x-charts/BarChart';
|
|
4
4
|
import { type BarItemIdentifier, type RangeBarItemIdentifier, type RangeBarSeriesType } from "../models/index.js";
|
|
5
5
|
export type RangeBarSeries = RangeBarSeriesType;
|
|
6
|
-
export interface
|
|
6
|
+
export interface BarChartPremiumSlots extends BarChartProSlots {}
|
|
7
|
+
export interface BarChartPremiumSlotProps extends BarChartProSlotProps {}
|
|
8
|
+
export interface BarChartPremiumProps extends Omit<BarChartProProps, 'series' | 'onItemClick' | 'slots' | 'slotProps'> {
|
|
9
|
+
/**
|
|
10
|
+
* Overridable component slots.
|
|
11
|
+
* @default {}
|
|
12
|
+
*/
|
|
13
|
+
slots?: BarChartPremiumSlots;
|
|
14
|
+
/**
|
|
15
|
+
* The props used for each component slot.
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
slotProps?: BarChartPremiumSlotProps;
|
|
7
19
|
/**
|
|
8
20
|
* Callback fired when a bar or range bar item is clicked.
|
|
9
21
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
@@ -30,6 +30,7 @@ var _useBarChartPremiumProps = require("./useBarChartPremiumProps");
|
|
|
30
30
|
var _BarChartPremium2 = require("./BarChartPremium.plugins");
|
|
31
31
|
var _ChartDataProviderPremium = require("../ChartDataProviderPremium");
|
|
32
32
|
var _RangeBarPlot = require("./RangeBar/RangeBarPlot");
|
|
33
|
+
var _FocusedRangeBar = require("./RangeBar/FocusedRangeBar");
|
|
33
34
|
var _RangeBarPreviewPlot = require("../ChartZoomSlider/internals/previews/RangeBarPreviewPlot");
|
|
34
35
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
36
|
const _excluded = ["initialZoom", "zoomData", "onZoomChange", "apiRef", "showToolbar"];
|
|
@@ -88,7 +89,7 @@ const BarChartPremium = exports.BarChartPremium = /*#__PURE__*/React.forwardRef(
|
|
|
88
89
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
89
90
|
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
90
91
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
91
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, (0, _extends2.default)({}, barPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangeBarPlot.RangeBarPlot, (0, _extends2.default)({}, rangeBarPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, (0, _extends2.default)({}, barPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangeBarPlot.RangeBarPlot, (0, _extends2.default)({}, rangeBarPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.FocusedBar, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedRangeBar.FocusedRangeBar, {})]
|
|
92
93
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartZoomSlider.ChartZoomSlider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsBrushOverlay.ChartsBrushOverlay, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
93
94
|
})), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
|
|
94
95
|
}))
|
|
@@ -108,6 +109,11 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
108
109
|
setZoomData: _propTypes.default.func.isRequired
|
|
109
110
|
})
|
|
110
111
|
}),
|
|
112
|
+
/**
|
|
113
|
+
* A gap added between axes when multiple axes are rendered on the same side of the chart.
|
|
114
|
+
* @default 0
|
|
115
|
+
*/
|
|
116
|
+
axesGap: _propTypes.default.number,
|
|
111
117
|
/**
|
|
112
118
|
* The configuration of axes highlight.
|
|
113
119
|
* Default is set to 'band' in the bar direction.
|
|
@@ -191,7 +197,7 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
191
197
|
*/
|
|
192
198
|
hiddenItems: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
193
199
|
dataIndex: _propTypes.default.number,
|
|
194
|
-
seriesId: _propTypes.default.
|
|
200
|
+
seriesId: _propTypes.default.string,
|
|
195
201
|
type: _propTypes.default.oneOf(['bar']).isRequired
|
|
196
202
|
})),
|
|
197
203
|
/**
|
|
@@ -212,7 +218,7 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
212
218
|
*/
|
|
213
219
|
highlightedItem: _propTypes.default.shape({
|
|
214
220
|
dataIndex: _propTypes.default.number,
|
|
215
|
-
seriesId: _propTypes.default.
|
|
221
|
+
seriesId: _propTypes.default.string.isRequired
|
|
216
222
|
}),
|
|
217
223
|
/**
|
|
218
224
|
* This prop is used to help implement the accessibility logic.
|
|
@@ -242,7 +248,7 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
242
248
|
*/
|
|
243
249
|
initialHiddenItems: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
244
250
|
dataIndex: _propTypes.default.number,
|
|
245
|
-
seriesId: _propTypes.default.
|
|
251
|
+
seriesId: _propTypes.default.string,
|
|
246
252
|
type: _propTypes.default.oneOf(['bar']).isRequired
|
|
247
253
|
})),
|
|
248
254
|
/**
|
|
@@ -367,7 +373,7 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
367
373
|
*/
|
|
368
374
|
tooltipItem: _propTypes.default.shape({
|
|
369
375
|
dataIndex: _propTypes.default.number.isRequired,
|
|
370
|
-
seriesId: _propTypes.default.
|
|
376
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
371
377
|
type: _propTypes.default.oneOf(['bar']).isRequired
|
|
372
378
|
}),
|
|
373
379
|
/**
|
|
@@ -12,7 +12,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _useAnimateRangeBar = require("../../hooks/animation/useAnimateRangeBar");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
const _excluded = ["ownerState", "skipAnimation", "
|
|
15
|
+
const _excluded = ["ownerState", "skipAnimation", "seriesId", "dataIndex", "xOrigin", "yOrigin", "hidden"];
|
|
16
16
|
function AnimatedRangeBarElement(props) {
|
|
17
17
|
const {
|
|
18
18
|
ownerState
|
|
@@ -0,0 +1,70 @@
|
|
|
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.FocusedRangeBar = FocusedRangeBar;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
14
|
+
var _createGetRangeBarDimensions = require("./createGetRangeBarDimensions");
|
|
15
|
+
var _useRangeBarSeries = require("../../hooks/useRangeBarSeries");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function FocusedRangeBar(props) {
|
|
18
|
+
const theme = (0, _styles.useTheme)();
|
|
19
|
+
const focusedItem = (0, _hooks.useFocusedItem)();
|
|
20
|
+
const rangeBarSeries = (0, _useRangeBarSeries.useRangeBarSeriesContext)();
|
|
21
|
+
const {
|
|
22
|
+
xAxis,
|
|
23
|
+
xAxisIds
|
|
24
|
+
} = (0, _hooks.useXAxes)();
|
|
25
|
+
const {
|
|
26
|
+
yAxis,
|
|
27
|
+
yAxisIds
|
|
28
|
+
} = (0, _hooks.useYAxes)();
|
|
29
|
+
if (focusedItem === null || focusedItem.type !== 'rangeBar' || !rangeBarSeries) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const series = rangeBarSeries.series[focusedItem.seriesId];
|
|
33
|
+
if (series.data[focusedItem.dataIndex] == null) {
|
|
34
|
+
// Handle missing data
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
38
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
39
|
+
const xAxisConfig = xAxis[xAxisId];
|
|
40
|
+
const yAxisConfig = yAxis[yAxisId];
|
|
41
|
+
const verticalLayout = rangeBarSeries.series[focusedItem.seriesId].layout === 'vertical';
|
|
42
|
+
const groupIndex = rangeBarSeries.seriesOrder.findIndex(seriesId => seriesId === focusedItem.seriesId);
|
|
43
|
+
const barDimensions = (0, _createGetRangeBarDimensions.createGetRangeBarDimensions)({
|
|
44
|
+
verticalLayout,
|
|
45
|
+
xAxisConfig,
|
|
46
|
+
yAxisConfig,
|
|
47
|
+
series,
|
|
48
|
+
numberOfGroups: rangeBarSeries.seriesOrder.length
|
|
49
|
+
})(focusedItem.dataIndex, groupIndex);
|
|
50
|
+
if (barDimensions === null) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const {
|
|
54
|
+
x,
|
|
55
|
+
y,
|
|
56
|
+
height,
|
|
57
|
+
width
|
|
58
|
+
} = barDimensions;
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", (0, _extends2.default)({
|
|
60
|
+
fill: "none",
|
|
61
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
62
|
+
strokeWidth: 2,
|
|
63
|
+
x: x - 3,
|
|
64
|
+
y: y - 3,
|
|
65
|
+
width: width + 6,
|
|
66
|
+
height: height + 6,
|
|
67
|
+
rx: 3,
|
|
68
|
+
ry: 3
|
|
69
|
+
}, props));
|
|
70
|
+
}
|
|
@@ -81,7 +81,7 @@ function RangeBarPlot(props) {
|
|
|
81
81
|
hidden
|
|
82
82
|
}) => {
|
|
83
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarElement, (0, _extends2.default)({
|
|
84
|
-
|
|
84
|
+
seriesId: seriesId,
|
|
85
85
|
dataIndex: dataIndex,
|
|
86
86
|
color: color,
|
|
87
87
|
skipAnimation: skipAnimation ?? false,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ChartSeriesDefaultized, type ChartsXAxisProps, type ChartsYAxisProps, type ComputedAxis, type ScaleName } from '@mui/x-charts/internals';
|
|
2
|
+
export declare function createGetRangeBarDimensions(params: {
|
|
3
|
+
verticalLayout: boolean;
|
|
4
|
+
xAxisConfig: ComputedAxis<ScaleName, any, ChartsXAxisProps>;
|
|
5
|
+
yAxisConfig: ComputedAxis<ScaleName, any, ChartsYAxisProps>;
|
|
6
|
+
series: ChartSeriesDefaultized<'rangeBar'>;
|
|
7
|
+
numberOfGroups: number;
|
|
8
|
+
}): (dataIndex: number, groupIndex: number) => {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
height: number;
|
|
12
|
+
width: number;
|
|
13
|
+
} | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createGetRangeBarDimensions = createGetRangeBarDimensions;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
function createGetRangeBarDimensions(params) {
|
|
9
|
+
const {
|
|
10
|
+
verticalLayout,
|
|
11
|
+
xAxisConfig,
|
|
12
|
+
yAxisConfig,
|
|
13
|
+
series,
|
|
14
|
+
numberOfGroups
|
|
15
|
+
} = params;
|
|
16
|
+
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
17
|
+
const xScale = xAxisConfig.scale;
|
|
18
|
+
const yScale = yAxisConfig.scale;
|
|
19
|
+
const bandWidth = baseScaleConfig.scale.bandwidth();
|
|
20
|
+
const {
|
|
21
|
+
barWidth,
|
|
22
|
+
offset
|
|
23
|
+
} = (0, _internals.getBandSize)(bandWidth, numberOfGroups, baseScaleConfig.barGapRatio);
|
|
24
|
+
return function getBarDimensions(dataIndex, groupIndex) {
|
|
25
|
+
const barOffset = groupIndex * (barWidth + offset);
|
|
26
|
+
const baseValue = baseScaleConfig.data[dataIndex];
|
|
27
|
+
const seriesValue = series.data[dataIndex];
|
|
28
|
+
if (seriesValue == null) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const valueCoordinates = seriesValue.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
32
|
+
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
33
|
+
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
34
|
+
const barSize = maxValueCoord - minValueCoord;
|
|
35
|
+
return {
|
|
36
|
+
x: verticalLayout ? xScale(baseValue) + barOffset : minValueCoord,
|
|
37
|
+
y: verticalLayout ? minValueCoord : yScale(baseValue) + barOffset,
|
|
38
|
+
height: verticalLayout ? barSize : barWidth,
|
|
39
|
+
width: verticalLayout ? barWidth : barSize
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AllSeriesType } from '@mui/x-charts/models';
|
|
2
2
|
export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'rangeBar'>, seriesIndex: number, colors: readonly string[]): {
|
|
3
|
-
id:
|
|
3
|
+
id: string;
|
|
4
4
|
color: string;
|
|
5
5
|
type: "rangeBar";
|
|
6
6
|
data?: ReadonlyArray<import("../../../index.js").RangeBarValueType | null>;
|
|
@@ -11,7 +11,7 @@ export declare function getSeriesWithDefaultValues(seriesData: AllSeriesType<'ra
|
|
|
11
11
|
label?: string | ((location: "tooltip" | "legend") => string);
|
|
12
12
|
layout?: "horizontal" | "vertical";
|
|
13
13
|
valueFormatter?: import("@mui/x-charts/internals").SeriesValueFormatter<import("../../../index.js").RangeBarValueType | null> | undefined;
|
|
14
|
-
highlightScope?: import("@mui/x-charts").
|
|
14
|
+
highlightScope?: import("@mui/x-charts/internals").CommonHighlightScope | undefined;
|
|
15
15
|
labelMarkType?: import("@mui/x-charts/internals").ChartsLabelMarkType;
|
|
16
16
|
colorGetter?: ((data: import("@mui/x-charts/internals").ColorCallbackValue<import("../../../index.js").RangeBarValueType | null>) => string) | undefined;
|
|
17
17
|
xAxisId?: import("@mui/x-charts/internals").AxisId;
|
|
@@ -12,6 +12,7 @@ var _tooltip = _interopRequireWildcard(require("./tooltip"));
|
|
|
12
12
|
var _seriesProcessor = _interopRequireDefault(require("./seriesProcessor"));
|
|
13
13
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
14
14
|
var _legend = _interopRequireDefault(require("./legend"));
|
|
15
|
+
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
15
16
|
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
16
17
|
var _getSeriesWithDefaultValues = require("./getSeriesWithDefaultValues");
|
|
17
18
|
const rangeBarSeriesConfig = exports.rangeBarSeriesConfig = {
|
|
@@ -24,6 +25,8 @@ const rangeBarSeriesConfig = exports.rangeBarSeriesConfig = {
|
|
|
24
25
|
xExtremumGetter: _extrema.getExtremumX,
|
|
25
26
|
yExtremumGetter: _extrema.getExtremumY,
|
|
26
27
|
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.getSeriesWithDefaultValues,
|
|
27
|
-
|
|
28
|
+
keyboardFocusHandler: _keyboardFocusHandler.default,
|
|
29
|
+
identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
|
|
30
|
+
identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex
|
|
28
31
|
};
|
|
29
32
|
_internals.cartesianSeriesTypes.addType('rangeBar');
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
const keyboardFocusHandler = event => {
|
|
9
|
+
switch (event.key) {
|
|
10
|
+
case 'ArrowRight':
|
|
11
|
+
return (0, _internals.createGetNextIndexFocusedItem)(_internals.composableCartesianSeriesTypes);
|
|
12
|
+
case 'ArrowLeft':
|
|
13
|
+
return (0, _internals.createGetPreviousIndexFocusedItem)(_internals.composableCartesianSeriesTypes);
|
|
14
|
+
case 'ArrowDown':
|
|
15
|
+
return (0, _internals.createGetPreviousSeriesFocusedItem)(_internals.composableCartesianSeriesTypes);
|
|
16
|
+
case 'ArrowUp':
|
|
17
|
+
return (0, _internals.createGetNextSeriesFocusedItem)(_internals.composableCartesianSeriesTypes);
|
|
18
|
+
default:
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var _default = exports.default = keyboardFocusHandler;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _createGetRangeBarDimensions = require("../createGetRangeBarDimensions");
|
|
8
8
|
const tooltipItemPositionGetter = params => {
|
|
9
9
|
const {
|
|
10
10
|
series,
|
|
@@ -22,7 +22,13 @@ const tooltipItemPositionGetter = params => {
|
|
|
22
22
|
if (axesConfig.x === undefined || axesConfig.y === undefined) {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
const dimensions = (0,
|
|
25
|
+
const dimensions = (0, _createGetRangeBarDimensions.createGetRangeBarDimensions)({
|
|
26
|
+
verticalLayout: itemSeries.layout === 'vertical',
|
|
27
|
+
xAxisConfig: axesConfig.x,
|
|
28
|
+
yAxisConfig: axesConfig.y,
|
|
29
|
+
series: itemSeries,
|
|
30
|
+
numberOfGroups: series.rangeBar.seriesOrder.length
|
|
31
|
+
})(identifier.dataIndex, series.rangeBar.seriesOrder.findIndex(id => id === itemSeries.id));
|
|
26
32
|
if (dimensions == null) {
|
|
27
33
|
return null;
|
|
28
34
|
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { type ChartDrawingArea } from '@mui/x-charts/hooks';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ComputedAxisConfig } from '@mui/x-charts/internals';
|
|
3
3
|
import { type ChartsXAxisProps, type ChartsYAxisProps } from '@mui/x-charts/models';
|
|
4
|
-
import { type DefaultizedRangeBarSeriesType } from "../../models/seriesType/rangeBar.js";
|
|
5
4
|
import { type ProcessedRangeBarSeriesData } from "./types.js";
|
|
6
|
-
export declare function useRangeBarPlotData(drawingArea: ChartDrawingArea, xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): ProcessedRangeBarSeriesData[];
|
|
7
|
-
export declare function getRangeBarDimensions(layout: 'vertical' | 'horizontal', xAxis: ComputedAxis<ScaleName, any, ChartsXAxisProps>, yAxis: ComputedAxis<ScaleName, any, ChartsYAxisProps>, seriesData: DefaultizedRangeBarSeriesType['data'], dataIndex: number, seriesCount: number, seriesIndex: number): {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
height: number;
|
|
11
|
-
width: number;
|
|
12
|
-
} | null;
|
|
5
|
+
export declare function useRangeBarPlotData(drawingArea: ChartDrawingArea, xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): ProcessedRangeBarSeriesData[];
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.getRangeBarDimensions = getRangeBarDimensions;
|
|
7
7
|
exports.useRangeBarPlotData = useRangeBarPlotData;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _hooks = require("@mui/x-charts/hooks");
|
|
9
10
|
var _internals = require("@mui/x-charts/internals");
|
|
10
11
|
var _useRangeBarSeries = require("../../hooks/useRangeBarSeries");
|
|
12
|
+
var _createGetRangeBarDimensions = require("./createGetRangeBarDimensions");
|
|
11
13
|
function useRangeBarPlotData(drawingArea, xAxes, yAxes) {
|
|
12
14
|
const store = (0, _internals.useStore)();
|
|
13
15
|
const seriesData = (0, _useRangeBarSeries.useRangeBarSeriesContext)() ?? {
|
|
@@ -16,7 +18,7 @@ function useRangeBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
16
18
|
};
|
|
17
19
|
const defaultXAxisId = (0, _hooks.useXAxes)().xAxisIds[0];
|
|
18
20
|
const defaultYAxisId = (0, _hooks.useYAxes)().yAxisIds[0];
|
|
19
|
-
const getColor = store.
|
|
21
|
+
const getColor = store.state.seriesConfig.config.rangeBar.colorProcessor;
|
|
20
22
|
const {
|
|
21
23
|
series,
|
|
22
24
|
seriesOrder
|
|
@@ -26,11 +28,18 @@ function useRangeBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
26
28
|
const yMin = drawingArea.top;
|
|
27
29
|
const yMax = drawingArea.top + drawingArea.height;
|
|
28
30
|
const data = seriesOrder.map((seriesId, seriesIndex) => {
|
|
31
|
+
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
32
|
+
const getRangeBarDimensions = (0, _createGetRangeBarDimensions.createGetRangeBarDimensions)({
|
|
33
|
+
verticalLayout,
|
|
34
|
+
xAxisConfig: xAxes[series[seriesId].xAxisId ?? defaultXAxisId],
|
|
35
|
+
yAxisConfig: yAxes[series[seriesId].yAxisId ?? defaultYAxisId],
|
|
36
|
+
series: series[seriesId],
|
|
37
|
+
numberOfGroups: seriesOrder.length
|
|
38
|
+
});
|
|
29
39
|
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
30
40
|
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
31
41
|
const xAxisConfig = xAxes[xAxisId];
|
|
32
42
|
const yAxisConfig = yAxes[yAxisId];
|
|
33
|
-
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
34
43
|
(0, _internals.checkBarChartScaleErrors)(verticalLayout, seriesId, series[seriesId].data.length, xAxisId, xAxes, yAxisId, yAxes);
|
|
35
44
|
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
36
45
|
const xScale = xAxisConfig.scale;
|
|
@@ -38,41 +47,23 @@ function useRangeBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
38
47
|
const xOrigin = Math.round(xScale(0) ?? 0);
|
|
39
48
|
const yOrigin = Math.round(yScale(0) ?? 0);
|
|
40
49
|
const colorGetter = getColor(series[seriesId], xAxes[xAxisId], yAxes[yAxisId]);
|
|
41
|
-
const bandWidth = baseScaleConfig.scale.bandwidth();
|
|
42
|
-
const {
|
|
43
|
-
barWidth,
|
|
44
|
-
offset
|
|
45
|
-
} = (0, _internals.getBandSize)(bandWidth, seriesOrder.length, baseScaleConfig.barGapRatio);
|
|
46
|
-
const barOffset = seriesIndex * (barWidth + offset);
|
|
47
50
|
const {
|
|
48
51
|
data: currentSeriesData,
|
|
49
52
|
layout
|
|
50
53
|
} = series[seriesId];
|
|
51
54
|
const seriesDataPoints = [];
|
|
52
55
|
for (let dataIndex = 0; dataIndex < baseScaleConfig.data.length; dataIndex += 1) {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
if (seriesValue == null) {
|
|
56
|
+
const dimensions = getRangeBarDimensions(dataIndex, seriesIndex);
|
|
57
|
+
if (dimensions === null || dimensions.x > xMax || dimensions.x + dimensions.width < xMin || dimensions.y > yMax || dimensions.y + dimensions.height < yMin) {
|
|
56
58
|
continue;
|
|
57
59
|
}
|
|
58
|
-
const
|
|
59
|
-
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
60
|
-
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
61
|
-
const barSize = maxValueCoord - minValueCoord;
|
|
62
|
-
const result = {
|
|
60
|
+
const result = (0, _extends2.default)({
|
|
63
61
|
seriesId,
|
|
64
62
|
dataIndex,
|
|
65
|
-
x: verticalLayout ? xScale(baseValue) + barOffset : minValueCoord,
|
|
66
|
-
y: verticalLayout ? minValueCoord : yScale(baseValue) + barOffset,
|
|
67
|
-
height: verticalLayout ? barSize : barWidth,
|
|
68
|
-
width: verticalLayout ? barWidth : barSize,
|
|
69
63
|
color: colorGetter(dataIndex),
|
|
70
64
|
value: currentSeriesData[dataIndex],
|
|
71
65
|
hidden: series[seriesId].hidden
|
|
72
|
-
};
|
|
73
|
-
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
66
|
+
}, dimensions);
|
|
76
67
|
seriesDataPoints.push(result);
|
|
77
68
|
}
|
|
78
69
|
return {
|
|
@@ -84,30 +75,4 @@ function useRangeBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
84
75
|
};
|
|
85
76
|
});
|
|
86
77
|
return data;
|
|
87
|
-
}
|
|
88
|
-
function getRangeBarDimensions(layout, xAxis, yAxis, seriesData, dataIndex, seriesCount, seriesIndex) {
|
|
89
|
-
const xScale = xAxis.scale;
|
|
90
|
-
const yScale = yAxis.scale;
|
|
91
|
-
const verticalLayout = layout === 'vertical';
|
|
92
|
-
const baseScaleConfig = verticalLayout ? xAxis : yAxis;
|
|
93
|
-
const baseValue = baseScaleConfig.data[dataIndex];
|
|
94
|
-
const seriesValue = seriesData[dataIndex];
|
|
95
|
-
const {
|
|
96
|
-
barWidth,
|
|
97
|
-
offset
|
|
98
|
-
} = (0, _internals.getBandSize)(baseScaleConfig.scale.bandwidth(), seriesCount, baseScaleConfig.barGapRatio);
|
|
99
|
-
const barOffset = seriesIndex * (barWidth + offset);
|
|
100
|
-
if (seriesValue == null) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
const valueCoordinates = seriesValue.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
104
|
-
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
105
|
-
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
106
|
-
const barSize = maxValueCoord - minValueCoord;
|
|
107
|
-
return {
|
|
108
|
-
x: verticalLayout ? xScale(baseValue) + barOffset : minValueCoord,
|
|
109
|
-
y: verticalLayout ? minValueCoord : yScale(baseValue) + barOffset,
|
|
110
|
-
height: verticalLayout ? barSize : barWidth,
|
|
111
|
-
width: verticalLayout ? barWidth : barSize
|
|
112
|
-
};
|
|
113
78
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./BarChartPremium.js";
|
|
2
2
|
export * from "./BarChartPremium.plugins.js";
|
|
3
3
|
export * from "./RangeBar/RangeBarPlot.js";
|
|
4
|
+
export * from "./RangeBar/FocusedRangeBar.js";
|
|
4
5
|
export { rangeBarClasses, type RangeBarClasses, type RangeBarClassKey } from "./RangeBar/useUtilityClasses.js";
|
package/BarChartPremium/index.js
CHANGED
|
@@ -48,4 +48,16 @@ Object.keys(_RangeBarPlot).forEach(function (key) {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
|
+
var _FocusedRangeBar = require("./RangeBar/FocusedRangeBar");
|
|
52
|
+
Object.keys(_FocusedRangeBar).forEach(function (key) {
|
|
53
|
+
if (key === "default" || key === "__esModule") return;
|
|
54
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
55
|
+
if (key in exports && exports[key] === _FocusedRangeBar[key]) return;
|
|
56
|
+
Object.defineProperty(exports, key, {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return _FocusedRangeBar[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
51
63
|
var _useUtilityClasses = require("./RangeBar/useUtilityClasses");
|