@mui/x-charts-pro 8.0.0-alpha.12 → 8.0.0-alpha.14
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/BarChartPro/BarChartPro.d.ts +2 -1
- package/BarChartPro/BarChartPro.js +25 -30
- package/CHANGELOG.md +430 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/ChartContainerPro/ChartContainerPro.js +1 -1
- package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/FunnelChart/FunnelChart.d.ts +37 -0
- package/FunnelChart/FunnelChart.js +218 -0
- package/FunnelChart/FunnelPlot.d.ts +16 -0
- package/FunnelChart/FunnelPlot.js +191 -0
- package/FunnelChart/FunnelSection.d.ts +15 -0
- package/FunnelChart/FunnelSection.js +62 -0
- package/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/FunnelChart/categoryAxis.types.js +5 -0
- package/FunnelChart/funnel.types.d.ts +124 -0
- package/FunnelChart/funnel.types.js +5 -0
- package/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/FunnelChart/funnelPlotSlots.types.js +5 -0
- package/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/FunnelChart/funnelSectionClasses.js +28 -0
- package/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/FunnelChart/funnelSlots.types.js +5 -0
- package/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/FunnelChart/funnelStepCurve.js +74 -0
- package/FunnelChart/index.d.ts +7 -0
- package/FunnelChart/index.js +59 -0
- package/FunnelChart/labelUtils.d.ts +42 -0
- package/FunnelChart/labelUtils.js +174 -0
- package/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/FunnelChart/seriesConfig/extremums.js +50 -0
- package/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/FunnelChart/seriesConfig/getColor.js +10 -0
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +18 -0
- package/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/FunnelChart/seriesConfig/index.js +22 -0
- package/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/FunnelChart/seriesConfig/legend.js +31 -0
- package/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/FunnelChart/seriesConfig/seriesProcessor.js +96 -0
- package/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/FunnelChart/seriesConfig/tooltip.js +36 -0
- package/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/FunnelChart/useFunnelChartProps.js +168 -0
- package/Heatmap/Heatmap.d.ts +5 -4
- package/Heatmap/Heatmap.js +37 -52
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +15 -0
- package/Heatmap/seriesConfig/index.js +3 -1
- package/LineChartPro/LineChartPro.d.ts +2 -1
- package/LineChartPro/LineChartPro.js +25 -30
- package/ScatterChartPro/ScatterChartPro.js +25 -30
- package/esm/BarChartPro/BarChartPro.d.ts +2 -1
- package/esm/BarChartPro/BarChartPro.js +25 -30
- package/esm/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/esm/ChartContainerPro/ChartContainerPro.js +1 -1
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/esm/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/esm/FunnelChart/FunnelChart.d.ts +37 -0
- package/esm/FunnelChart/FunnelChart.js +212 -0
- package/esm/FunnelChart/FunnelPlot.d.ts +16 -0
- package/esm/FunnelChart/FunnelPlot.js +184 -0
- package/esm/FunnelChart/FunnelSection.d.ts +15 -0
- package/esm/FunnelChart/FunnelSection.js +56 -0
- package/esm/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/esm/FunnelChart/categoryAxis.types.js +1 -0
- package/esm/FunnelChart/funnel.types.d.ts +124 -0
- package/esm/FunnelChart/funnel.types.js +1 -0
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/esm/FunnelChart/funnelPlotSlots.types.js +1 -0
- package/esm/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/esm/FunnelChart/funnelSectionClasses.js +20 -0
- package/esm/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/esm/FunnelChart/funnelSlots.types.js +1 -0
- package/esm/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/esm/FunnelChart/funnelStepCurve.js +67 -0
- package/esm/FunnelChart/index.d.ts +7 -0
- package/esm/FunnelChart/index.js +5 -0
- package/esm/FunnelChart/labelUtils.d.ts +42 -0
- package/esm/FunnelChart/labelUtils.js +166 -0
- package/esm/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/extremums.js +42 -0
- package/esm/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/getColor.js +4 -0
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
- package/esm/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/esm/FunnelChart/seriesConfig/index.js +15 -0
- package/esm/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/legend.js +25 -0
- package/esm/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
- package/esm/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/tooltip.js +29 -0
- package/esm/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/esm/FunnelChart/useFunnelChartProps.js +161 -0
- package/esm/Heatmap/Heatmap.d.ts +5 -4
- package/esm/Heatmap/Heatmap.js +37 -52
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
- package/esm/Heatmap/seriesConfig/index.js +3 -1
- package/esm/LineChartPro/LineChartPro.d.ts +2 -1
- package/esm/LineChartPro/LineChartPro.js +25 -30
- package/esm/ScatterChartPro/ScatterChartPro.js +25 -30
- package/esm/hooks/useFunnelSeries.d.ts +33 -0
- package/esm/hooks/useFunnelSeries.js +42 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +4 -2
- package/esm/internals/plugins/allPlugins.d.ts +3 -3
- package/esm/internals/plugins/allPlugins.js +2 -2
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/models/seriesType/heatmap.d.ts +2 -2
- package/esm/typeOverloads/modules.d.ts +13 -2
- package/hooks/useFunnelSeries.d.ts +33 -0
- package/hooks/useFunnelSeries.js +48 -0
- package/index.d.ts +3 -1
- package/index.js +23 -1
- package/internals/plugins/allPlugins.d.ts +3 -3
- package/internals/plugins/allPlugins.js +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/internals/utils/releaseInfo.js +1 -1
- package/models/seriesType/heatmap.d.ts +2 -2
- package/modern/BarChartPro/BarChartPro.d.ts +2 -1
- package/modern/BarChartPro/BarChartPro.js +25 -30
- package/modern/ChartContainerPro/ChartContainerPro.d.ts +1 -1
- package/modern/ChartContainerPro/ChartContainerPro.js +1 -1
- package/modern/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/modern/ChartContainerPro/useChartContainerProProps.js +3 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +3 -2
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/modern/FunnelChart/FunnelChart.d.ts +37 -0
- package/modern/FunnelChart/FunnelChart.js +212 -0
- package/modern/FunnelChart/FunnelPlot.d.ts +16 -0
- package/modern/FunnelChart/FunnelPlot.js +184 -0
- package/modern/FunnelChart/FunnelSection.d.ts +15 -0
- package/modern/FunnelChart/FunnelSection.js +56 -0
- package/modern/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/modern/FunnelChart/categoryAxis.types.js +1 -0
- package/modern/FunnelChart/funnel.types.d.ts +124 -0
- package/modern/FunnelChart/funnel.types.js +1 -0
- package/modern/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/modern/FunnelChart/funnelPlotSlots.types.js +1 -0
- package/modern/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/modern/FunnelChart/funnelSectionClasses.js +20 -0
- package/modern/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/modern/FunnelChart/funnelSlots.types.js +1 -0
- package/modern/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/modern/FunnelChart/funnelStepCurve.js +67 -0
- package/modern/FunnelChart/index.d.ts +7 -0
- package/modern/FunnelChart/index.js +5 -0
- package/modern/FunnelChart/labelUtils.d.ts +42 -0
- package/modern/FunnelChart/labelUtils.js +166 -0
- package/modern/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/extremums.js +42 -0
- package/modern/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/getColor.js +4 -0
- package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
- package/modern/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/modern/FunnelChart/seriesConfig/index.js +15 -0
- package/modern/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/legend.js +25 -0
- package/modern/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
- package/modern/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/tooltip.js +29 -0
- package/modern/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/modern/FunnelChart/useFunnelChartProps.js +161 -0
- package/modern/Heatmap/Heatmap.d.ts +5 -4
- package/modern/Heatmap/Heatmap.js +37 -52
- package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
- package/modern/Heatmap/seriesConfig/index.js +3 -1
- package/modern/LineChartPro/LineChartPro.d.ts +2 -1
- package/modern/LineChartPro/LineChartPro.js +25 -30
- package/modern/ScatterChartPro/ScatterChartPro.js +25 -30
- package/modern/hooks/useFunnelSeries.d.ts +33 -0
- package/modern/hooks/useFunnelSeries.js +42 -0
- package/modern/index.d.ts +3 -1
- package/modern/index.js +4 -2
- package/modern/internals/plugins/allPlugins.d.ts +3 -3
- package/modern/internals/plugins/allPlugins.js +2 -2
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +63 -12
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +26 -24
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +12 -3
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/seriesType/heatmap.d.ts +2 -2
- package/modern/typeOverloads/modules.d.ts +13 -2
- package/package.json +5 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typeOverloads/modules.d.ts +13 -2
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
+
const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef"];
|
|
6
|
+
import { DEFAULT_MARGINS, DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
|
|
7
|
+
import useId from '@mui/utils/useId';
|
|
8
|
+
import { defaultizeMargin } from '@mui/x-charts/internals';
|
|
9
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
10
|
+
function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
|
|
11
|
+
const maxSeriesLength = Math.max(...series.map(s => (s.data ?? []).length), 0);
|
|
12
|
+
const maxSeriesValue = Array.from({
|
|
13
|
+
length: maxSeriesLength
|
|
14
|
+
}, (_, index) => series.reduce((a, s) => a + (s.data?.[index]?.value ?? 0), 0));
|
|
15
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
16
|
+
if ((categoryAxis?.position === 'left' || categoryAxis?.position === 'right') && isHorizontal || (categoryAxis?.position === 'top' || categoryAxis?.position === 'bottom') && !isHorizontal) {
|
|
17
|
+
warnOnce([`MUI X: the categoryAxis position is set to '${categoryAxis.position}' but the series layout is ${isHorizontal ? 'horizontal' : 'vertical'}.`, `Ensure that the categoryAxis position is set to '${isHorizontal ? 'top' : 'left'}' or '${isHorizontal ? 'bottom' : 'right'}' for ${isHorizontal ? 'horizontal' : 'vertical'} layout.\n`], 'warning');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const side = isHorizontal ? 'bottom' : 'left';
|
|
21
|
+
const categoryValues = _extends({
|
|
22
|
+
id: direction === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY
|
|
23
|
+
}, categoryAxis, categoryAxis?.size ? {
|
|
24
|
+
[isHorizontal ? 'height' : 'width']: categoryAxis.size
|
|
25
|
+
} : {}, {
|
|
26
|
+
position: categoryAxis?.position ?? (categoryAxis?.categories ? side : 'none')
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// If the scaleType is not defined or is 'band', our job is simple.
|
|
30
|
+
if (!categoryAxis?.scaleType || categoryAxis.scaleType === 'band') {
|
|
31
|
+
return _extends({
|
|
32
|
+
scaleType: 'band',
|
|
33
|
+
categoryGapRatio: 0,
|
|
34
|
+
// Use the categories as the domain if they are defined.
|
|
35
|
+
data: categoryAxis?.categories ? categoryAxis.categories :
|
|
36
|
+
// Otherwise we just need random data to create the band scale.
|
|
37
|
+
Array.from({
|
|
38
|
+
length: maxSeriesLength
|
|
39
|
+
}, (_, index) => index),
|
|
40
|
+
tickLabelPlacement: 'middle'
|
|
41
|
+
}, categoryValues);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// If the scaleType is other than 'band', we have to do some magic.
|
|
45
|
+
// First we need to calculate the tick values additively and in reverse order.
|
|
46
|
+
const tickValues = [...maxSeriesValue.toReversed().map((_, i, arr) => arr.slice(0, i).reduce((a, value) => a + value, 0)),
|
|
47
|
+
// We add the total value of the series as the last tick value
|
|
48
|
+
maxSeriesValue.reduce((a, value) => a + value, 0)];
|
|
49
|
+
return _extends({
|
|
50
|
+
scaleType: categoryAxis.scaleType,
|
|
51
|
+
domainLimit: 'strict',
|
|
52
|
+
tickLabelPlacement: 'middle',
|
|
53
|
+
tickInterval: tickValues,
|
|
54
|
+
// No need to show the first tick label
|
|
55
|
+
tickLabelInterval: (_, i) => i !== 0,
|
|
56
|
+
// We trick the valueFormatter to show the category values.
|
|
57
|
+
// By using the index of the tickValues array we can get the category value.
|
|
58
|
+
valueFormatter: value => `${categoryAxis.categories?.toReversed()[tickValues.findIndex(v => v === value) - 1]}`
|
|
59
|
+
}, categoryValues);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A helper function that extracts FunnelChartProps from the input props
|
|
64
|
+
* and returns an object with props for the children components of FunnelChart.
|
|
65
|
+
*
|
|
66
|
+
* @param props The input props for FunnelChart
|
|
67
|
+
* @returns An object with props for the children components of FunnelChart
|
|
68
|
+
*/
|
|
69
|
+
export const useFunnelChartProps = props => {
|
|
70
|
+
const {
|
|
71
|
+
categoryAxis,
|
|
72
|
+
series,
|
|
73
|
+
width,
|
|
74
|
+
height,
|
|
75
|
+
margin: marginProps,
|
|
76
|
+
colors,
|
|
77
|
+
sx,
|
|
78
|
+
children,
|
|
79
|
+
slots,
|
|
80
|
+
slotProps,
|
|
81
|
+
loading,
|
|
82
|
+
onItemClick,
|
|
83
|
+
highlightedItem,
|
|
84
|
+
onHighlightChange,
|
|
85
|
+
className,
|
|
86
|
+
axisHighlight,
|
|
87
|
+
apiRef
|
|
88
|
+
} = props,
|
|
89
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
90
|
+
const margin = defaultizeMargin(marginProps, DEFAULT_MARGINS);
|
|
91
|
+
const id = useId();
|
|
92
|
+
const clipPathId = `${id}-clip-path`;
|
|
93
|
+
const isHorizontal = series.some(s => s.layout === 'horizontal');
|
|
94
|
+
const valueAxisConfig = {
|
|
95
|
+
id: isHorizontal ? DEFAULT_Y_AXIS_KEY : DEFAULT_X_AXIS_KEY,
|
|
96
|
+
scaleType: 'linear',
|
|
97
|
+
domainLimit: 'strict',
|
|
98
|
+
position: 'none'
|
|
99
|
+
};
|
|
100
|
+
const xAxis = isHorizontal ? getCategoryAxisConfig(categoryAxis, series, isHorizontal, 'x') : valueAxisConfig;
|
|
101
|
+
const yAxis = isHorizontal ? valueAxisConfig : getCategoryAxisConfig(categoryAxis, series, isHorizontal, 'y');
|
|
102
|
+
const chartContainerProps = _extends({}, rest, {
|
|
103
|
+
series: series.map(s => _extends({
|
|
104
|
+
type: 'funnel',
|
|
105
|
+
layout: isHorizontal ? 'horizontal' : 'vertical'
|
|
106
|
+
}, s)),
|
|
107
|
+
width,
|
|
108
|
+
height,
|
|
109
|
+
margin,
|
|
110
|
+
colors,
|
|
111
|
+
xAxis: [xAxis],
|
|
112
|
+
yAxis: [yAxis],
|
|
113
|
+
sx,
|
|
114
|
+
highlightedItem,
|
|
115
|
+
onHighlightChange,
|
|
116
|
+
className,
|
|
117
|
+
apiRef
|
|
118
|
+
});
|
|
119
|
+
const funnelPlotProps = {
|
|
120
|
+
onItemClick,
|
|
121
|
+
slots,
|
|
122
|
+
slotProps
|
|
123
|
+
};
|
|
124
|
+
const overlayProps = {
|
|
125
|
+
slots,
|
|
126
|
+
slotProps,
|
|
127
|
+
loading
|
|
128
|
+
};
|
|
129
|
+
const chartsAxisProps = {
|
|
130
|
+
slots,
|
|
131
|
+
slotProps
|
|
132
|
+
};
|
|
133
|
+
const legendProps = {
|
|
134
|
+
slots,
|
|
135
|
+
slotProps
|
|
136
|
+
};
|
|
137
|
+
const clipPathGroupProps = {
|
|
138
|
+
clipPath: `url(#${clipPathId})`
|
|
139
|
+
};
|
|
140
|
+
const clipPathProps = {
|
|
141
|
+
id: clipPathId
|
|
142
|
+
};
|
|
143
|
+
const chartsWrapperProps = {
|
|
144
|
+
sx,
|
|
145
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
146
|
+
legendDirection: props.slotProps?.legend?.direction
|
|
147
|
+
};
|
|
148
|
+
const axisHighlightProps = _extends({}, axisHighlight);
|
|
149
|
+
return {
|
|
150
|
+
chartContainerProps,
|
|
151
|
+
funnelPlotProps,
|
|
152
|
+
overlayProps,
|
|
153
|
+
chartsAxisProps,
|
|
154
|
+
legendProps,
|
|
155
|
+
clipPathGroupProps,
|
|
156
|
+
clipPathProps,
|
|
157
|
+
chartsWrapperProps,
|
|
158
|
+
axisHighlightProps,
|
|
159
|
+
children
|
|
160
|
+
};
|
|
161
|
+
};
|
|
@@ -8,6 +8,7 @@ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
|
8
8
|
import { HeatmapSeriesType } from "../models/seriesType/heatmap.js";
|
|
9
9
|
import { HeatmapTooltipProps } from "./HeatmapTooltip.js";
|
|
10
10
|
import { HeatmapItemSlotProps, HeatmapItemSlots } from "./HeatmapItem.js";
|
|
11
|
+
import { HeatmapPluginsSignatures } from "./Heatmap.plugins.js";
|
|
11
12
|
export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots {
|
|
12
13
|
/**
|
|
13
14
|
* Custom component for the tooltip popper.
|
|
@@ -18,24 +19,24 @@ export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, Heatm
|
|
|
18
19
|
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps {
|
|
19
20
|
tooltip?: Partial<HeatmapTooltipProps>;
|
|
20
21
|
}
|
|
21
|
-
export interface HeatmapProps extends Omit<ChartContainerProProps, 'series' | 'plugins' | 'xAxis' | 'yAxis' | '
|
|
22
|
+
export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
22
23
|
/**
|
|
23
24
|
* The configuration of the x-axes.
|
|
24
25
|
* If not provided, a default axis config is used.
|
|
25
26
|
* An array of [[AxisConfig]] objects.
|
|
26
27
|
*/
|
|
27
|
-
xAxis: MakeOptional<AxisConfig<'band', any, ChartsXAxisProps>, 'id' | 'scaleType'>[]
|
|
28
|
+
xAxis: Readonly<MakeOptional<AxisConfig<'band', any, ChartsXAxisProps>, 'id' | 'scaleType'>[]>;
|
|
28
29
|
/**
|
|
29
30
|
* The configuration of the y-axes.
|
|
30
31
|
* If not provided, a default axis config is used.
|
|
31
32
|
* An array of [[AxisConfig]] objects.
|
|
32
33
|
*/
|
|
33
|
-
yAxis: MakeOptional<AxisConfig<'band', any, ChartsYAxisProps>, 'id' | 'scaleType'>[]
|
|
34
|
+
yAxis: Readonly<MakeOptional<AxisConfig<'band', any, ChartsYAxisProps>, 'id' | 'scaleType'>[]>;
|
|
34
35
|
/**
|
|
35
36
|
* The series to display in the bar chart.
|
|
36
37
|
* An array of [[HeatmapSeriesType]] objects.
|
|
37
38
|
*/
|
|
38
|
-
series: MakeOptional<HeatmapSeriesType, 'type'>[]
|
|
39
|
+
series: Readonly<MakeOptional<HeatmapSeriesType, 'type'>[]>;
|
|
39
40
|
/**
|
|
40
41
|
* The configuration of the tooltip.
|
|
41
42
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
@@ -9,6 +9,7 @@ import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
|
|
|
9
9
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
10
10
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
11
11
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
|
|
12
13
|
import { ChartContainerPro } from "../ChartContainerPro/index.js";
|
|
13
14
|
import { HeatmapPlot } from "./HeatmapPlot.js";
|
|
14
15
|
import { seriesConfig as heatmapSeriesConfig } from "./seriesConfig/index.js";
|
|
@@ -20,6 +21,16 @@ const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#
|
|
|
20
21
|
const seriesConfig = {
|
|
21
22
|
heatmap: heatmapSeriesConfig
|
|
22
23
|
};
|
|
24
|
+
function getDefaultDataForAxis(series, dimension) {
|
|
25
|
+
if (series?.[0]?.data === undefined || series[0].data.length === 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return Array.from({
|
|
29
|
+
length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
|
|
30
|
+
}, (_, index) => index);
|
|
31
|
+
}
|
|
32
|
+
const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
|
|
33
|
+
const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
|
|
23
34
|
const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
24
35
|
const props = useThemeProps({
|
|
25
36
|
props: inProps,
|
|
@@ -36,10 +47,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
36
47
|
colors,
|
|
37
48
|
dataset,
|
|
38
49
|
sx,
|
|
39
|
-
topAxis,
|
|
40
|
-
leftAxis,
|
|
41
|
-
rightAxis,
|
|
42
|
-
bottomAxis,
|
|
43
50
|
onAxisClick,
|
|
44
51
|
children,
|
|
45
52
|
slots,
|
|
@@ -50,14 +57,22 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
50
57
|
} = props;
|
|
51
58
|
const id = useId();
|
|
52
59
|
const clipPathId = `${id}-clip-path`;
|
|
53
|
-
const defaultizedXAxis = React.useMemo(() => xAxis.
|
|
60
|
+
const defaultizedXAxis = React.useMemo(() => (xAxis && xAxis.length > 0 ? xAxis : [{
|
|
61
|
+
id: DEFAULT_X_AXIS_KEY
|
|
62
|
+
}]).map(axis => _extends({
|
|
54
63
|
scaleType: 'band',
|
|
55
64
|
categoryGapRatio: 0
|
|
56
|
-
}, axis
|
|
57
|
-
|
|
65
|
+
}, axis, {
|
|
66
|
+
data: axis.data ?? getDefaultDataForXAxis(series)
|
|
67
|
+
})), [series, xAxis]);
|
|
68
|
+
const defaultizedYAxis = React.useMemo(() => (yAxis && yAxis.length > 0 ? yAxis : [{
|
|
69
|
+
id: DEFAULT_Y_AXIS_KEY
|
|
70
|
+
}]).map(axis => _extends({
|
|
58
71
|
scaleType: 'band',
|
|
59
72
|
categoryGapRatio: 0
|
|
60
|
-
}, axis
|
|
73
|
+
}, axis, {
|
|
74
|
+
data: axis.data ?? getDefaultDataForYAxis(series)
|
|
75
|
+
})), [series, yAxis]);
|
|
61
76
|
const defaultizedZAxis = React.useMemo(() => zAxis ?? [{
|
|
62
77
|
colorMap: {
|
|
63
78
|
type: 'continuous',
|
|
@@ -98,10 +113,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
98
113
|
slotProps: slotProps
|
|
99
114
|
})]
|
|
100
115
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
101
|
-
topAxis: topAxis,
|
|
102
|
-
leftAxis: leftAxis,
|
|
103
|
-
rightAxis: rightAxis,
|
|
104
|
-
bottomAxis: bottomAxis,
|
|
105
116
|
slots: slots,
|
|
106
117
|
slotProps: slotProps
|
|
107
118
|
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
@@ -115,16 +126,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
115
126
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
116
127
|
// ----------------------------------------------------------------------
|
|
117
128
|
apiRef: PropTypes.shape({
|
|
118
|
-
current: PropTypes.
|
|
119
|
-
setZoomData: PropTypes.func.isRequired
|
|
120
|
-
})
|
|
129
|
+
current: PropTypes.object
|
|
121
130
|
}),
|
|
122
|
-
/**
|
|
123
|
-
* Indicate which axis to display the bottom of the charts.
|
|
124
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
125
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
126
|
-
*/
|
|
127
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
128
131
|
children: PropTypes.node,
|
|
129
132
|
className: PropTypes.string,
|
|
130
133
|
/**
|
|
@@ -160,20 +163,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
160
163
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
161
164
|
*/
|
|
162
165
|
id: PropTypes.string,
|
|
163
|
-
/**
|
|
164
|
-
* The list of zoom data related to each axis.
|
|
165
|
-
*/
|
|
166
|
-
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
167
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
168
|
-
end: PropTypes.number.isRequired,
|
|
169
|
-
start: PropTypes.number.isRequired
|
|
170
|
-
})),
|
|
171
|
-
/**
|
|
172
|
-
* Indicate which axis to display the left of the charts.
|
|
173
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
174
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
175
|
-
*/
|
|
176
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
177
166
|
/**
|
|
178
167
|
* If `true`, a loading overlay is displayed.
|
|
179
168
|
* @default false
|
|
@@ -182,14 +171,15 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
182
171
|
/**
|
|
183
172
|
* The margin between the SVG and the drawing area.
|
|
184
173
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
185
|
-
*
|
|
174
|
+
*
|
|
175
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
186
176
|
*/
|
|
187
|
-
margin: PropTypes.shape({
|
|
177
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
188
178
|
bottom: PropTypes.number,
|
|
189
179
|
left: PropTypes.number,
|
|
190
180
|
right: PropTypes.number,
|
|
191
181
|
top: PropTypes.number
|
|
192
|
-
}),
|
|
182
|
+
})]),
|
|
193
183
|
/**
|
|
194
184
|
* The function called for onClick events.
|
|
195
185
|
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
@@ -203,12 +193,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
203
193
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
204
194
|
*/
|
|
205
195
|
onHighlightChange: PropTypes.func,
|
|
206
|
-
/**
|
|
207
|
-
* Indicate which axis to display the right of the charts.
|
|
208
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
209
|
-
* @default null
|
|
210
|
-
*/
|
|
211
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
212
196
|
/**
|
|
213
197
|
* The series to display in the bar chart.
|
|
214
198
|
* An array of [[HeatmapSeriesType]] objects.
|
|
@@ -237,12 +221,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
237
221
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
238
222
|
*/
|
|
239
223
|
tooltip: PropTypes.object,
|
|
240
|
-
/**
|
|
241
|
-
* Indicate which axis to display the top of the charts.
|
|
242
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
243
|
-
* @default null
|
|
244
|
-
*/
|
|
245
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
246
224
|
/**
|
|
247
225
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
248
226
|
*/
|
|
@@ -253,6 +231,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
253
231
|
* An array of [[AxisConfig]] objects.
|
|
254
232
|
*/
|
|
255
233
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
234
|
+
axis: PropTypes.oneOf(['x']),
|
|
256
235
|
barGapRatio: PropTypes.number,
|
|
257
236
|
categoryGapRatio: PropTypes.number,
|
|
258
237
|
classes: PropTypes.object,
|
|
@@ -277,13 +256,15 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
277
256
|
disableTicks: PropTypes.bool,
|
|
278
257
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
279
258
|
fill: PropTypes.string,
|
|
259
|
+
height: PropTypes.number,
|
|
280
260
|
hideTooltip: PropTypes.bool,
|
|
281
261
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
282
262
|
label: PropTypes.string,
|
|
283
263
|
labelStyle: PropTypes.object,
|
|
284
264
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
285
265
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
286
|
-
|
|
266
|
+
offset: PropTypes.number,
|
|
267
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
287
268
|
reverse: PropTypes.bool,
|
|
288
269
|
scaleType: PropTypes.oneOf(['band']),
|
|
289
270
|
slotProps: PropTypes.object,
|
|
@@ -292,6 +273,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
292
273
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
293
274
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
294
275
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
276
|
+
tickLabelMinGap: PropTypes.number,
|
|
295
277
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
296
278
|
tickLabelStyle: PropTypes.object,
|
|
297
279
|
tickMaxStep: PropTypes.number,
|
|
@@ -316,6 +298,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
316
298
|
* An array of [[AxisConfig]] objects.
|
|
317
299
|
*/
|
|
318
300
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
301
|
+
axis: PropTypes.oneOf(['y']),
|
|
319
302
|
barGapRatio: PropTypes.number,
|
|
320
303
|
categoryGapRatio: PropTypes.number,
|
|
321
304
|
classes: PropTypes.object,
|
|
@@ -346,7 +329,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
346
329
|
labelStyle: PropTypes.object,
|
|
347
330
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
348
331
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
349
|
-
|
|
332
|
+
offset: PropTypes.number,
|
|
333
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
350
334
|
reverse: PropTypes.bool,
|
|
351
335
|
scaleType: PropTypes.oneOf(['band']),
|
|
352
336
|
slotProps: PropTypes.object,
|
|
@@ -363,6 +347,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
363
347
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
364
348
|
tickSize: PropTypes.number,
|
|
365
349
|
valueFormatter: PropTypes.func,
|
|
350
|
+
width: PropTypes.number,
|
|
366
351
|
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
367
352
|
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
368
353
|
maxEnd: PropTypes.number,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
3
|
+
return _extends({
|
|
4
|
+
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
5
|
+
color: colors[seriesIndex % colors.length]
|
|
6
|
+
}, seriesData);
|
|
7
|
+
};
|
|
8
|
+
export default getSeriesWithDefaultValues;
|
|
@@ -2,11 +2,13 @@ import { getBaseExtremum } from "./extremums.js";
|
|
|
2
2
|
import seriesProcessor from "./seriesProcessor.js";
|
|
3
3
|
import getColor from "./getColor.js";
|
|
4
4
|
import tooltipGetter from "./tooltip.js";
|
|
5
|
+
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
|
|
5
6
|
export const seriesConfig = {
|
|
6
7
|
seriesProcessor,
|
|
7
8
|
colorProcessor: getColor,
|
|
8
9
|
legendGetter: () => [],
|
|
9
10
|
tooltipGetter,
|
|
10
11
|
xExtremumGetter: getBaseExtremum,
|
|
11
|
-
yExtremumGetter: getBaseExtremum
|
|
12
|
+
yExtremumGetter: getBaseExtremum,
|
|
13
|
+
getSeriesWithDefaultValues
|
|
12
14
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LineChartProps } from '@mui/x-charts/LineChart';
|
|
3
3
|
import { ChartContainerProProps } from "../ChartContainerPro/index.js";
|
|
4
|
-
|
|
4
|
+
import { LineChartProPluginsSignatures } from "./LineChartPro.plugins.js";
|
|
5
|
+
export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line', LineChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig'> {}
|
|
5
6
|
/**
|
|
6
7
|
* Demos:
|
|
7
8
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
|
|
5
|
+
const _excluded = ["initialZoom", "zoomData", "onZoomChange", "apiRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -137,6 +137,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
137
137
|
});
|
|
138
138
|
const {
|
|
139
139
|
initialZoom,
|
|
140
|
+
zoomData,
|
|
140
141
|
onZoomChange,
|
|
141
142
|
apiRef
|
|
142
143
|
} = props,
|
|
@@ -162,6 +163,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
162
163
|
chartsSurfaceProps
|
|
163
164
|
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
164
165
|
initialZoom,
|
|
166
|
+
zoomData,
|
|
165
167
|
onZoomChange,
|
|
166
168
|
apiRef,
|
|
167
169
|
plugins: LINE_CHART_PRO_PLUGINS
|
|
@@ -199,12 +201,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
199
201
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
200
202
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
201
203
|
}),
|
|
202
|
-
/**
|
|
203
|
-
* Indicate which axis to display the bottom of the charts.
|
|
204
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
205
|
-
* @default xAxisIds[0] The id of the first provided axis
|
|
206
|
-
*/
|
|
207
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
208
204
|
children: PropTypes.node,
|
|
209
205
|
className: PropTypes.string,
|
|
210
206
|
/**
|
|
@@ -257,18 +253,13 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
257
253
|
id: PropTypes.string,
|
|
258
254
|
/**
|
|
259
255
|
* The list of zoom data related to each axis.
|
|
256
|
+
* Used to initialize the zoom in a specific configuration without controlling it.
|
|
260
257
|
*/
|
|
261
258
|
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
262
259
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
263
260
|
end: PropTypes.number.isRequired,
|
|
264
261
|
start: PropTypes.number.isRequired
|
|
265
262
|
})),
|
|
266
|
-
/**
|
|
267
|
-
* Indicate which axis to display the left of the charts.
|
|
268
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
269
|
-
* @default yAxisIds[0] The id of the first provided axis
|
|
270
|
-
*/
|
|
271
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
272
263
|
/**
|
|
273
264
|
* If `true`, a loading overlay is displayed.
|
|
274
265
|
* @default false
|
|
@@ -277,14 +268,15 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
277
268
|
/**
|
|
278
269
|
* The margin between the SVG and the drawing area.
|
|
279
270
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
280
|
-
*
|
|
271
|
+
*
|
|
272
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
281
273
|
*/
|
|
282
|
-
margin: PropTypes.shape({
|
|
274
|
+
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
283
275
|
bottom: PropTypes.number,
|
|
284
276
|
left: PropTypes.number,
|
|
285
277
|
right: PropTypes.number,
|
|
286
278
|
top: PropTypes.number
|
|
287
|
-
}),
|
|
279
|
+
})]),
|
|
288
280
|
/**
|
|
289
281
|
* Callback fired when an area element is clicked.
|
|
290
282
|
*/
|
|
@@ -316,12 +308,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
316
308
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
317
309
|
*/
|
|
318
310
|
onZoomChange: PropTypes.func,
|
|
319
|
-
/**
|
|
320
|
-
* Indicate which axis to display the right of the charts.
|
|
321
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
322
|
-
* @default null
|
|
323
|
-
*/
|
|
324
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
325
311
|
/**
|
|
326
312
|
* The series to display in the line chart.
|
|
327
313
|
* An array of [[LineSeriesType]] objects.
|
|
@@ -345,12 +331,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
345
331
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
346
332
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
347
333
|
title: PropTypes.string,
|
|
348
|
-
/**
|
|
349
|
-
* Indicate which axis to display the top of the charts.
|
|
350
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
351
|
-
* @default null
|
|
352
|
-
*/
|
|
353
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
354
334
|
/**
|
|
355
335
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
356
336
|
*/
|
|
@@ -361,6 +341,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
361
341
|
* An array of [[AxisConfig]] objects.
|
|
362
342
|
*/
|
|
363
343
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
344
|
+
axis: PropTypes.oneOf(['x']),
|
|
364
345
|
classes: PropTypes.object,
|
|
365
346
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
366
347
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -383,13 +364,15 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
383
364
|
disableTicks: PropTypes.bool,
|
|
384
365
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
385
366
|
fill: PropTypes.string,
|
|
367
|
+
height: PropTypes.number,
|
|
386
368
|
hideTooltip: PropTypes.bool,
|
|
387
369
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
388
370
|
label: PropTypes.string,
|
|
389
371
|
labelStyle: PropTypes.object,
|
|
390
372
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
391
373
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
392
|
-
|
|
374
|
+
offset: PropTypes.number,
|
|
375
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
393
376
|
reverse: PropTypes.bool,
|
|
394
377
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
395
378
|
slotProps: PropTypes.object,
|
|
@@ -398,6 +381,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
398
381
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
399
382
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
400
383
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
384
|
+
tickLabelMinGap: PropTypes.number,
|
|
401
385
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
402
386
|
tickLabelStyle: PropTypes.object,
|
|
403
387
|
tickMaxStep: PropTypes.number,
|
|
@@ -422,6 +406,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
422
406
|
* An array of [[AxisConfig]] objects.
|
|
423
407
|
*/
|
|
424
408
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
409
|
+
axis: PropTypes.oneOf(['y']),
|
|
425
410
|
classes: PropTypes.object,
|
|
426
411
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
427
412
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -450,7 +435,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
450
435
|
labelStyle: PropTypes.object,
|
|
451
436
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
452
437
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
453
|
-
|
|
438
|
+
offset: PropTypes.number,
|
|
439
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
454
440
|
reverse: PropTypes.bool,
|
|
455
441
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
456
442
|
slotProps: PropTypes.object,
|
|
@@ -467,6 +453,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
467
453
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
468
454
|
tickSize: PropTypes.number,
|
|
469
455
|
valueFormatter: PropTypes.func,
|
|
456
|
+
width: PropTypes.number,
|
|
470
457
|
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
471
458
|
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
472
459
|
maxEnd: PropTypes.number,
|
|
@@ -501,6 +488,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
501
488
|
id: PropTypes.string,
|
|
502
489
|
max: PropTypes.number,
|
|
503
490
|
min: PropTypes.number
|
|
491
|
+
})),
|
|
492
|
+
/**
|
|
493
|
+
* The list of zoom data related to each axis.
|
|
494
|
+
*/
|
|
495
|
+
zoomData: PropTypes.arrayOf(PropTypes.shape({
|
|
496
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
497
|
+
end: PropTypes.number.isRequired,
|
|
498
|
+
start: PropTypes.number.isRequired
|
|
504
499
|
}))
|
|
505
500
|
} : void 0;
|
|
506
501
|
export { LineChartPro };
|