@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.4
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.ts +21 -5
- package/BarChart/BarChart.js +27 -7
- package/CHANGELOG.md +298 -23
- package/ChartsGrid/ChartsGrid.d.ts +30 -0
- package/ChartsGrid/ChartsGrid.js +128 -0
- package/ChartsGrid/chartsGridClasses.d.ts +13 -0
- package/ChartsGrid/chartsGridClasses.js +14 -0
- package/ChartsGrid/index.d.ts +2 -0
- package/ChartsGrid/index.js +27 -0
- package/ChartsGrid/package.json +6 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsSurface.js +6 -4
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
- package/ChartsXAxis/ChartsXAxis.js +3 -3
- package/ChartsYAxis/ChartsYAxis.js +3 -3
- package/Gauge/Gauge.d.ts +13 -0
- package/Gauge/Gauge.js +154 -0
- package/Gauge/GaugeContainer.d.ts +17 -0
- package/Gauge/GaugeContainer.js +214 -0
- package/Gauge/GaugeProvider.d.ts +117 -0
- package/Gauge/GaugeProvider.js +99 -0
- package/Gauge/GaugeReferenceArc.d.ts +2 -0
- package/Gauge/GaugeReferenceArc.js +44 -0
- package/Gauge/GaugeValueArc.d.ts +2 -0
- package/Gauge/GaugeValueArc.js +51 -0
- package/Gauge/GaugeValueText.d.ts +15 -0
- package/Gauge/GaugeValueText.js +77 -0
- package/Gauge/gaugeClasses.d.ts +14 -0
- package/Gauge/gaugeClasses.js +15 -0
- package/Gauge/index.d.ts +7 -0
- package/Gauge/index.js +87 -0
- package/Gauge/package.json +6 -0
- package/Gauge/utils.d.ts +19 -0
- package/Gauge/utils.js +75 -0
- package/LineChart/LineChart.d.ts +24 -5
- package/LineChart/LineChart.js +31 -7
- package/PieChart/PieArc.d.ts +4 -4
- package/PieChart/PieArc.js +9 -9
- package/PieChart/PieArcLabelPlot.js +13 -13
- package/PieChart/PieChart.d.ts +22 -0
- package/PieChart/PieChart.js +22 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
- package/ScatterChart/ScatterChart.d.ts +18 -0
- package/ScatterChart/ScatterChart.js +25 -3
- package/SparkLineChart/SparkLineChart.js +0 -2
- package/context/CartesianContextProvider.d.ts +0 -8
- package/context/CartesianContextProvider.js +4 -89
- package/context/DrawingProvider.d.ts +2 -11
- package/context/DrawingProvider.js +10 -35
- package/context/HighlightProvider.js +3 -0
- package/context/InteractionProvider.js +3 -0
- package/context/SeriesContextProvider.js +3 -0
- package/context/index.d.ts +0 -2
- package/context/index.js +1 -15
- package/esm/BarChart/BarChart.js +27 -7
- package/esm/ChartsGrid/ChartsGrid.js +121 -0
- package/esm/ChartsGrid/chartsGridClasses.js +6 -0
- package/esm/ChartsGrid/index.js +2 -0
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsSurface.js +6 -4
- package/esm/ChartsTooltip/utils.js +2 -2
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/Gauge/Gauge.js +147 -0
- package/esm/Gauge/GaugeContainer.js +209 -0
- package/esm/Gauge/GaugeProvider.js +88 -0
- package/esm/Gauge/GaugeReferenceArc.js +35 -0
- package/esm/Gauge/GaugeValueArc.js +42 -0
- package/esm/Gauge/GaugeValueText.js +69 -0
- package/esm/Gauge/gaugeClasses.js +7 -0
- package/esm/Gauge/index.js +7 -0
- package/esm/Gauge/utils.js +68 -0
- package/esm/LineChart/LineChart.js +31 -7
- package/esm/PieChart/PieArc.js +9 -9
- package/esm/PieChart/PieArcLabelPlot.js +13 -13
- package/esm/PieChart/PieChart.js +22 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/esm/ScatterChart/ScatterChart.js +25 -3
- package/esm/SparkLineChart/SparkLineChart.js +0 -2
- package/esm/context/CartesianContextProvider.js +3 -88
- package/esm/context/DrawingProvider.js +10 -36
- package/esm/context/HighlightProvider.js +3 -0
- package/esm/context/InteractionProvider.js +3 -0
- package/esm/context/SeriesContextProvider.js +3 -0
- package/esm/context/index.js +1 -2
- package/esm/hooks/useAxisEvents.js +2 -2
- package/esm/hooks/useTicks.js +2 -3
- package/esm/index.js +2 -0
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useTicks.d.ts +2 -3
- package/hooks/useTicks.js +2 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/modern/BarChart/BarChart.js +27 -7
- package/modern/ChartsGrid/ChartsGrid.js +121 -0
- package/modern/ChartsGrid/chartsGridClasses.js +6 -0
- package/modern/ChartsGrid/index.js +2 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsSurface.js +6 -4
- package/modern/ChartsTooltip/utils.js +2 -2
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/Gauge/Gauge.js +147 -0
- package/modern/Gauge/GaugeContainer.js +206 -0
- package/modern/Gauge/GaugeProvider.js +88 -0
- package/modern/Gauge/GaugeReferenceArc.js +35 -0
- package/modern/Gauge/GaugeValueArc.js +42 -0
- package/modern/Gauge/GaugeValueText.js +69 -0
- package/modern/Gauge/gaugeClasses.js +7 -0
- package/modern/Gauge/index.js +7 -0
- package/modern/Gauge/utils.js +68 -0
- package/modern/LineChart/LineChart.js +31 -7
- package/modern/PieChart/PieArc.js +9 -9
- package/modern/PieChart/PieArcLabelPlot.js +13 -13
- package/modern/PieChart/PieChart.js +22 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/modern/ScatterChart/ScatterChart.js +25 -3
- package/modern/SparkLineChart/SparkLineChart.js +0 -2
- package/modern/context/CartesianContextProvider.js +3 -88
- package/modern/context/DrawingProvider.js +10 -36
- package/modern/context/HighlightProvider.js +3 -0
- package/modern/context/InteractionProvider.js +3 -0
- package/modern/context/SeriesContextProvider.js +3 -0
- package/modern/context/index.js +1 -2
- package/modern/hooks/useAxisEvents.js +2 -2
- package/modern/hooks/useTicks.js +2 -3
- package/modern/index.js +3 -1
- package/package.json +4 -4
- package/legacy/BarChart/BarChart.js +0 -418
- package/legacy/BarChart/BarElement.js +0 -119
- package/legacy/BarChart/BarPlot.js +0 -232
- package/legacy/BarChart/extremums.js +0 -45
- package/legacy/BarChart/formatter.js +0 -78
- package/legacy/BarChart/index.js +0 -3
- package/legacy/BarChart/legend.js +0 -15
- package/legacy/ChartContainer/ChartContainer.js +0 -189
- package/legacy/ChartContainer/index.js +0 -1
- package/legacy/ChartsAxis/ChartsAxis.js +0 -215
- package/legacy/ChartsAxis/axisClasses.js +0 -5
- package/legacy/ChartsAxis/index.js +0 -2
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
- package/legacy/ChartsAxisHighlight/index.js +0 -1
- package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
- package/legacy/ChartsClipPath/index.js +0 -1
- package/legacy/ChartsLegend/ChartsLegend.js +0 -100
- package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
- package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
- package/legacy/ChartsLegend/index.js +0 -4
- package/legacy/ChartsLegend/utils.js +0 -15
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
- package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
- package/legacy/ChartsReferenceLine/common.js +0 -19
- package/legacy/ChartsReferenceLine/index.js +0 -2
- package/legacy/ChartsSurface.js +0 -76
- package/legacy/ChartsText/ChartsText.js +0 -95
- package/legacy/ChartsText/index.js +0 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
- package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
- package/legacy/ChartsTooltip/index.js +0 -6
- package/legacy/ChartsTooltip/utils.js +0 -103
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
- package/legacy/ChartsVoronoiHandler/index.js +0 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
- package/legacy/ChartsXAxis/index.js +0 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
- package/legacy/ChartsYAxis/index.js +0 -1
- package/legacy/LineChart/AnimatedArea.js +0 -102
- package/legacy/LineChart/AnimatedLine.js +0 -104
- package/legacy/LineChart/AreaElement.js +0 -112
- package/legacy/LineChart/AreaPlot.js +0 -149
- package/legacy/LineChart/LineChart.js +0 -426
- package/legacy/LineChart/LineElement.js +0 -112
- package/legacy/LineChart/LineHighlightElement.js +0 -79
- package/legacy/LineChart/LineHighlightPlot.js +0 -97
- package/legacy/LineChart/LinePlot.js +0 -144
- package/legacy/LineChart/MarkElement.js +0 -153
- package/legacy/LineChart/MarkPlot.js +0 -178
- package/legacy/LineChart/extremums.js +0 -54
- package/legacy/LineChart/formatter.js +0 -82
- package/legacy/LineChart/index.js +0 -11
- package/legacy/LineChart/legend.js +0 -15
- package/legacy/PieChart/PieArc.js +0 -103
- package/legacy/PieChart/PieArcLabel.js +0 -112
- package/legacy/PieChart/PieArcLabelPlot.js +0 -193
- package/legacy/PieChart/PieArcPlot.js +0 -180
- package/legacy/PieChart/PieChart.js +0 -382
- package/legacy/PieChart/PiePlot.js +0 -137
- package/legacy/PieChart/dataTransform/transition.js +0 -149
- package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
- package/legacy/PieChart/formatter.js +0 -55
- package/legacy/PieChart/index.js +0 -6
- package/legacy/PieChart/legend.js +0 -16
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -255
- package/legacy/ResponsiveChartContainer/index.js +0 -1
- package/legacy/ScatterChart/Scatter.js +0 -110
- package/legacy/ScatterChart/ScatterChart.js +0 -370
- package/legacy/ScatterChart/ScatterPlot.js +0 -80
- package/legacy/ScatterChart/extremums.js +0 -39
- package/legacy/ScatterChart/formatter.js +0 -12
- package/legacy/ScatterChart/index.js +0 -3
- package/legacy/ScatterChart/legend.js +0 -15
- package/legacy/SparkLineChart/SparkLineChart.js +0 -266
- package/legacy/SparkLineChart/index.js +0 -1
- package/legacy/colorPalettes/colorPalettes.js +0 -15
- package/legacy/colorPalettes/index.js +0 -1
- package/legacy/constants.js +0 -8
- package/legacy/context/CartesianContextProvider.js +0 -327
- package/legacy/context/DrawingProvider.js +0 -74
- package/legacy/context/HighlightProvider.js +0 -56
- package/legacy/context/InteractionProvider.js +0 -81
- package/legacy/context/SeriesContextProvider.js +0 -74
- package/legacy/context/index.js +0 -2
- package/legacy/hooks/index.js +0 -2
- package/legacy/hooks/useAxisEvents.js +0 -120
- package/legacy/hooks/useChartDimensions.js +0 -18
- package/legacy/hooks/useDrawingArea.js +0 -21
- package/legacy/hooks/useInteractionItemProps.js +0 -71
- package/legacy/hooks/useMounted.js +0 -21
- package/legacy/hooks/useReducedMotion.js +0 -27
- package/legacy/hooks/useScale.js +0 -33
- package/legacy/hooks/useTicks.js +0 -66
- package/legacy/index.js +0 -31
- package/legacy/internals/components/AxisSharedComponents.js +0 -25
- package/legacy/internals/defaultizeColor.js +0 -17
- package/legacy/internals/defaultizeValueFormatter.js +0 -12
- package/legacy/internals/domUtils.js +0 -121
- package/legacy/internals/geometry.js +0 -37
- package/legacy/internals/getCurve.js +0 -39
- package/legacy/internals/getScale.js +0 -17
- package/legacy/internals/getWordsByLines.js +0 -15
- package/legacy/internals/isBandScale.js +0 -3
- package/legacy/internals/stackSeries.js +0 -92
- package/legacy/internals/useAnimatedPath.js +0 -32
- package/legacy/internals/utils.js +0 -52
- package/legacy/models/axis.js +0 -6
- package/legacy/models/helpers.js +0 -1
- package/legacy/models/index.js +0 -4
- package/legacy/models/layout.js +0 -1
- package/legacy/models/seriesType/bar.js +0 -1
- package/legacy/models/seriesType/common.js +0 -1
- package/legacy/models/seriesType/config.js +0 -1
- package/legacy/models/seriesType/index.js +0 -5
- package/legacy/models/seriesType/line.js +0 -1
- package/legacy/models/seriesType/pie.js +0 -1
- package/legacy/models/seriesType/scatter.js +0 -1
- package/legacy/models/stacking.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -3
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { BarPlot } from '../BarChart';
|
|
5
|
-
import { LinePlot, AreaPlot, LineHighlightPlot } from '../LineChart';
|
|
6
|
-
import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
7
|
-
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
8
|
-
import { ChartsTooltip } from '../ChartsTooltip';
|
|
9
|
-
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
var SPARKLINE_DEFAULT_MARGIN = {
|
|
13
|
-
top: 5,
|
|
14
|
-
bottom: 5,
|
|
15
|
-
left: 5,
|
|
16
|
-
right: 5
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Demos:
|
|
21
|
-
*
|
|
22
|
-
* - [SparkLine](https://mui.com/x/react-charts/sparkline/)
|
|
23
|
-
*
|
|
24
|
-
* API:
|
|
25
|
-
*
|
|
26
|
-
* - [SparkLineChart API](https://mui.com/x/api/charts/spark-line-chart/)
|
|
27
|
-
*/
|
|
28
|
-
var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
29
|
-
var xAxis = props.xAxis,
|
|
30
|
-
width = props.width,
|
|
31
|
-
height = props.height,
|
|
32
|
-
_props$margin = props.margin,
|
|
33
|
-
margin = _props$margin === void 0 ? SPARKLINE_DEFAULT_MARGIN : _props$margin,
|
|
34
|
-
colors = props.colors,
|
|
35
|
-
sx = props.sx,
|
|
36
|
-
showTooltip = props.showTooltip,
|
|
37
|
-
tooltip = props.tooltip,
|
|
38
|
-
showHighlight = props.showHighlight,
|
|
39
|
-
inAxisHighlight = props.axisHighlight,
|
|
40
|
-
children = props.children,
|
|
41
|
-
slots = props.slots,
|
|
42
|
-
slotProps = props.slotProps,
|
|
43
|
-
data = props.data,
|
|
44
|
-
_props$plotType = props.plotType,
|
|
45
|
-
plotType = _props$plotType === void 0 ? 'line' : _props$plotType,
|
|
46
|
-
_props$valueFormatter = props.valueFormatter,
|
|
47
|
-
valueFormatter = _props$valueFormatter === void 0 ? function (value) {
|
|
48
|
-
return value === null ? '' : value.toString();
|
|
49
|
-
} : _props$valueFormatter,
|
|
50
|
-
area = props.area,
|
|
51
|
-
_props$curve = props.curve,
|
|
52
|
-
curve = _props$curve === void 0 ? 'linear' : _props$curve;
|
|
53
|
-
var defaultXHighlight = showHighlight && plotType === 'bar' ? {
|
|
54
|
-
x: 'band'
|
|
55
|
-
} : {
|
|
56
|
-
x: 'none'
|
|
57
|
-
};
|
|
58
|
-
var axisHighlight = _extends({}, defaultXHighlight, inAxisHighlight);
|
|
59
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
60
|
-
ref: ref,
|
|
61
|
-
series: [_extends({
|
|
62
|
-
type: plotType,
|
|
63
|
-
data: data,
|
|
64
|
-
valueFormatter: valueFormatter
|
|
65
|
-
}, plotType === 'bar' ? {} : {
|
|
66
|
-
area: area,
|
|
67
|
-
curve: curve,
|
|
68
|
-
disableHighlight: !showHighlight
|
|
69
|
-
})],
|
|
70
|
-
width: width,
|
|
71
|
-
height: height,
|
|
72
|
-
margin: margin,
|
|
73
|
-
xAxis: [_extends({
|
|
74
|
-
id: DEFAULT_X_AXIS_KEY,
|
|
75
|
-
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
76
|
-
data: Array.from({
|
|
77
|
-
length: data.length
|
|
78
|
-
}, function (_, index) {
|
|
79
|
-
return index;
|
|
80
|
-
}),
|
|
81
|
-
hideTooltip: xAxis === undefined
|
|
82
|
-
}, xAxis)],
|
|
83
|
-
colors: colors,
|
|
84
|
-
sx: sx,
|
|
85
|
-
disableAxisListener: (!showTooltip || (tooltip == null ? void 0 : tooltip.trigger) !== 'axis') && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
86
|
-
children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
|
|
87
|
-
skipAnimation: true,
|
|
88
|
-
slots: slots,
|
|
89
|
-
slotProps: slotProps,
|
|
90
|
-
sx: {
|
|
91
|
-
shapeRendering: 'auto'
|
|
92
|
-
}
|
|
93
|
-
}), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
94
|
-
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
95
|
-
skipAnimation: true,
|
|
96
|
-
slots: slots,
|
|
97
|
-
slotProps: slotProps
|
|
98
|
-
}), /*#__PURE__*/_jsx(LinePlot, {
|
|
99
|
-
skipAnimation: true,
|
|
100
|
-
slots: slots,
|
|
101
|
-
slotProps: slotProps
|
|
102
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, {
|
|
103
|
-
slots: slots,
|
|
104
|
-
slotProps: slotProps
|
|
105
|
-
})]
|
|
106
|
-
}), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), showTooltip && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
107
|
-
slotProps: slotProps,
|
|
108
|
-
slots: slots
|
|
109
|
-
})), children]
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
113
|
-
// ----------------------------- Warning --------------------------------
|
|
114
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
115
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
116
|
-
// ----------------------------------------------------------------------
|
|
117
|
-
/**
|
|
118
|
-
* Set to `true` to fill spark line area.
|
|
119
|
-
* Has no effect if plotType='bar'.
|
|
120
|
-
* @default false
|
|
121
|
-
*/
|
|
122
|
-
area: PropTypes.bool,
|
|
123
|
-
axisHighlight: PropTypes.shape({
|
|
124
|
-
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
125
|
-
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
126
|
-
}),
|
|
127
|
-
children: PropTypes.node,
|
|
128
|
-
className: PropTypes.string,
|
|
129
|
-
/**
|
|
130
|
-
* Color palette used to colorize multiple series.
|
|
131
|
-
* @default blueberryTwilightPalette
|
|
132
|
-
*/
|
|
133
|
-
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
134
|
-
/**
|
|
135
|
-
* @default 'linear'
|
|
136
|
-
*/
|
|
137
|
-
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
138
|
-
/**
|
|
139
|
-
* Data to plot.
|
|
140
|
-
*/
|
|
141
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
142
|
-
/**
|
|
143
|
-
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
144
|
-
*/
|
|
145
|
-
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
146
|
-
desc: PropTypes.string,
|
|
147
|
-
/**
|
|
148
|
-
* If `true`, the charts will not listen to the mouse move event.
|
|
149
|
-
* It might break interactive features, but will improve performance.
|
|
150
|
-
* @default false
|
|
151
|
-
*/
|
|
152
|
-
disableAxisListener: PropTypes.bool,
|
|
153
|
-
/**
|
|
154
|
-
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
155
|
-
* @default undefined
|
|
156
|
-
*/
|
|
157
|
-
height: PropTypes.number,
|
|
158
|
-
/**
|
|
159
|
-
* The margin between the SVG and the drawing area.
|
|
160
|
-
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
161
|
-
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
162
|
-
* @default {
|
|
163
|
-
* top: 5,
|
|
164
|
-
* bottom: 5,
|
|
165
|
-
* left: 5,
|
|
166
|
-
* right: 5,
|
|
167
|
-
* }
|
|
168
|
-
*/
|
|
169
|
-
margin: PropTypes.shape({
|
|
170
|
-
bottom: PropTypes.number,
|
|
171
|
-
left: PropTypes.number,
|
|
172
|
-
right: PropTypes.number,
|
|
173
|
-
top: PropTypes.number
|
|
174
|
-
}),
|
|
175
|
-
/**
|
|
176
|
-
* Type of plot used.
|
|
177
|
-
* @default 'line'
|
|
178
|
-
*/
|
|
179
|
-
plotType: PropTypes.oneOf(['bar', 'line']),
|
|
180
|
-
/**
|
|
181
|
-
* Set to `true` to highlight the value.
|
|
182
|
-
* With line, it shows a point.
|
|
183
|
-
* With bar, it shows a highlight band.
|
|
184
|
-
* @default false
|
|
185
|
-
*/
|
|
186
|
-
showHighlight: PropTypes.bool,
|
|
187
|
-
/**
|
|
188
|
-
* Set to `true` to enable the tooltip in the sparkline.
|
|
189
|
-
* @default false
|
|
190
|
-
*/
|
|
191
|
-
showTooltip: PropTypes.bool,
|
|
192
|
-
/**
|
|
193
|
-
* The props used for each component slot.
|
|
194
|
-
* @default {}
|
|
195
|
-
*/
|
|
196
|
-
slotProps: PropTypes.object,
|
|
197
|
-
/**
|
|
198
|
-
* Overridable component slots.
|
|
199
|
-
* @default {}
|
|
200
|
-
*/
|
|
201
|
-
slots: PropTypes.object,
|
|
202
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
203
|
-
title: PropTypes.string,
|
|
204
|
-
tooltip: PropTypes.shape({
|
|
205
|
-
axisContent: PropTypes.elementType,
|
|
206
|
-
classes: PropTypes.object,
|
|
207
|
-
itemContent: PropTypes.elementType,
|
|
208
|
-
slotProps: PropTypes.object,
|
|
209
|
-
slots: PropTypes.object,
|
|
210
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
211
|
-
}),
|
|
212
|
-
/**
|
|
213
|
-
* Formatter used by the tooltip.
|
|
214
|
-
* @param {number} value The value to format.
|
|
215
|
-
* @returns {string} the formatted value.
|
|
216
|
-
* @default (value: number | null) => (value === null ? '' : value.toString())
|
|
217
|
-
*/
|
|
218
|
-
valueFormatter: PropTypes.func,
|
|
219
|
-
viewBox: PropTypes.shape({
|
|
220
|
-
height: PropTypes.number,
|
|
221
|
-
width: PropTypes.number,
|
|
222
|
-
x: PropTypes.number,
|
|
223
|
-
y: PropTypes.number
|
|
224
|
-
}),
|
|
225
|
-
/**
|
|
226
|
-
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
227
|
-
* @default undefined
|
|
228
|
-
*/
|
|
229
|
-
width: PropTypes.number,
|
|
230
|
-
/**
|
|
231
|
-
* The xAxis configuration.
|
|
232
|
-
* Notice it is a single configuration object, not an array of configuration.
|
|
233
|
-
*/
|
|
234
|
-
xAxis: PropTypes.shape({
|
|
235
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
236
|
-
classes: PropTypes.object,
|
|
237
|
-
data: PropTypes.array,
|
|
238
|
-
dataKey: PropTypes.string,
|
|
239
|
-
disableLine: PropTypes.bool,
|
|
240
|
-
disableTicks: PropTypes.bool,
|
|
241
|
-
fill: PropTypes.string,
|
|
242
|
-
hideTooltip: PropTypes.bool,
|
|
243
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
244
|
-
label: PropTypes.string,
|
|
245
|
-
labelFontSize: PropTypes.number,
|
|
246
|
-
labelStyle: PropTypes.object,
|
|
247
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
248
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
249
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
250
|
-
reverse: PropTypes.bool,
|
|
251
|
-
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
252
|
-
slotProps: PropTypes.object,
|
|
253
|
-
slots: PropTypes.object,
|
|
254
|
-
stroke: PropTypes.string,
|
|
255
|
-
tickFontSize: PropTypes.number,
|
|
256
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
257
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
258
|
-
tickLabelStyle: PropTypes.object,
|
|
259
|
-
tickMaxStep: PropTypes.number,
|
|
260
|
-
tickMinStep: PropTypes.number,
|
|
261
|
-
tickNumber: PropTypes.number,
|
|
262
|
-
tickSize: PropTypes.number,
|
|
263
|
-
valueFormatter: PropTypes.func
|
|
264
|
-
})
|
|
265
|
-
} : void 0;
|
|
266
|
-
export { SparkLineChart };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SparkLineChart';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export var blueberryTwilightPaletteLight = ['#02B2AF', '#2E96FF', '#B800D8', '#60009B', '#2731C8', '#03008D'];
|
|
2
|
-
export var blueberryTwilightPaletteDark = ['#02B2AF', '#72CCFF', '#DA00FF', '#9001CB', '#2E96FF', '#3B48E0'];
|
|
3
|
-
export var blueberryTwilightPalette = function blueberryTwilightPalette(mode) {
|
|
4
|
-
return mode === 'dark' ? blueberryTwilightPaletteDark : blueberryTwilightPaletteLight;
|
|
5
|
-
};
|
|
6
|
-
export var mangoFusionPaletteLight = ['#173A5E', '#00A3A0', '#C91B63', '#EF5350', '#FFA726', '#B800D8', '#60009B', '#2E96FF', '#2731C8', '#03008D'];
|
|
7
|
-
export var mangoFusionPaletteDark = ['#41698F', '#19D0CD', '#DE196B', '#FC5F5C', '#FFD771', '#DA00FF', '#9001CB', '#72CCFF', '#2E96FF', '#3B48E0'];
|
|
8
|
-
export var mangoFusionPalette = function mangoFusionPalette(mode) {
|
|
9
|
-
return mode === 'dark' ? mangoFusionPaletteDark : mangoFusionPaletteLight;
|
|
10
|
-
};
|
|
11
|
-
export var cheerfulFiestaPaletteDark = ['#0059B2', '#2E96FF', '#FFC24C', '#FF9F0E', '#F38200', '#2ABFDE', '#1F94AD', '#BD2C38', '#FF3143', '#FF8282'];
|
|
12
|
-
export var cheerfulFiestaPaletteLight = ['#003A75', '#007FFF', '#FFC24C', '#FF9D09', '#CA6C00', '#127D94', '#1F94AD', '#C82634', '#FF3143', '#FF7E7E'];
|
|
13
|
-
export var cheerfulFiestaPalette = function cheerfulFiestaPalette(mode) {
|
|
14
|
-
return mode === 'dark' ? cheerfulFiestaPaletteDark : cheerfulFiestaPaletteLight;
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './colorPalettes';
|
package/legacy/constants.js
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { scaleBand, scalePoint } from 'd3-scale';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { getExtremumX as getBarExtremumX, getExtremumY as getBarExtremumY } from '../BarChart/extremums';
|
|
8
|
-
import { getExtremumX as getScatterExtremumX, getExtremumY as getScatterExtremumY } from '../ScatterChart/extremums';
|
|
9
|
-
import { getExtremumX as getLineExtremumX, getExtremumY as getLineExtremumY } from '../LineChart/extremums';
|
|
10
|
-
import { isBandScaleConfig, isPointScaleConfig } from '../models/axis';
|
|
11
|
-
import { getScale } from '../internals/getScale';
|
|
12
|
-
import { DrawingContext } from './DrawingProvider';
|
|
13
|
-
import { SeriesContext } from './SeriesContextProvider';
|
|
14
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
15
|
-
import { getTickNumber } from '../hooks/useTicks';
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
var DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
18
|
-
var DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
19
|
-
|
|
20
|
-
// TODO: those might be better placed in a distinct file
|
|
21
|
-
var xExtremumGetters = {
|
|
22
|
-
bar: getBarExtremumX,
|
|
23
|
-
scatter: getScatterExtremumX,
|
|
24
|
-
line: getLineExtremumX
|
|
25
|
-
};
|
|
26
|
-
var yExtremumGetters = {
|
|
27
|
-
bar: getBarExtremumY,
|
|
28
|
-
scatter: getScatterExtremumY,
|
|
29
|
-
line: getLineExtremumY
|
|
30
|
-
};
|
|
31
|
-
export var CartesianContext = /*#__PURE__*/React.createContext({
|
|
32
|
-
xAxis: {},
|
|
33
|
-
yAxis: {},
|
|
34
|
-
xAxisIds: [],
|
|
35
|
-
yAxisIds: []
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* API:
|
|
40
|
-
*
|
|
41
|
-
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
42
|
-
*/
|
|
43
|
-
function CartesianContextProvider(props) {
|
|
44
|
-
var inXAxis = props.xAxis,
|
|
45
|
-
inYAxis = props.yAxis,
|
|
46
|
-
dataset = props.dataset,
|
|
47
|
-
children = props.children;
|
|
48
|
-
var formattedSeries = React.useContext(SeriesContext);
|
|
49
|
-
var drawingArea = React.useContext(DrawingContext);
|
|
50
|
-
var xAxis = React.useMemo(function () {
|
|
51
|
-
return inXAxis == null ? void 0 : inXAxis.map(function (axisConfig) {
|
|
52
|
-
var dataKey = axisConfig.dataKey;
|
|
53
|
-
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
54
|
-
return axisConfig;
|
|
55
|
-
}
|
|
56
|
-
if (dataset === undefined) {
|
|
57
|
-
throw Error('MUI X Charts: x-axis uses `dataKey` but no `dataset` is provided.');
|
|
58
|
-
}
|
|
59
|
-
return _extends({}, axisConfig, {
|
|
60
|
-
data: dataset.map(function (d) {
|
|
61
|
-
return d[dataKey];
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}, [inXAxis, dataset]);
|
|
66
|
-
var yAxis = React.useMemo(function () {
|
|
67
|
-
return inYAxis == null ? void 0 : inYAxis.map(function (axisConfig) {
|
|
68
|
-
var dataKey = axisConfig.dataKey;
|
|
69
|
-
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
70
|
-
return axisConfig;
|
|
71
|
-
}
|
|
72
|
-
if (dataset === undefined) {
|
|
73
|
-
throw Error('MUI X Charts: y-axis uses `dataKey` but no `dataset` is provided.');
|
|
74
|
-
}
|
|
75
|
-
return _extends({}, axisConfig, {
|
|
76
|
-
data: dataset.map(function (d) {
|
|
77
|
-
return d[dataKey];
|
|
78
|
-
})
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}, [inYAxis, dataset]);
|
|
82
|
-
var value = React.useMemo(function () {
|
|
83
|
-
var _xAxis$map, _yAxis$map;
|
|
84
|
-
var axisExtremumCallback = function axisExtremumCallback(acc, chartType, axis, getters, isDefaultAxis) {
|
|
85
|
-
var _ref, _formattedSeries$char;
|
|
86
|
-
var getter = getters[chartType];
|
|
87
|
-
var series = (_ref = (_formattedSeries$char = formattedSeries[chartType]) == null ? void 0 : _formattedSeries$char.series) != null ? _ref : {};
|
|
88
|
-
var _getter = getter({
|
|
89
|
-
series: series,
|
|
90
|
-
axis: axis,
|
|
91
|
-
isDefaultAxis: isDefaultAxis
|
|
92
|
-
}),
|
|
93
|
-
_getter2 = _slicedToArray(_getter, 2),
|
|
94
|
-
minChartTypeData = _getter2[0],
|
|
95
|
-
maxChartTypeData = _getter2[1];
|
|
96
|
-
var _acc = _slicedToArray(acc, 2),
|
|
97
|
-
minData = _acc[0],
|
|
98
|
-
maxData = _acc[1];
|
|
99
|
-
if (minData === null || maxData === null) {
|
|
100
|
-
return [minChartTypeData, maxChartTypeData];
|
|
101
|
-
}
|
|
102
|
-
if (minChartTypeData === null || maxChartTypeData === null) {
|
|
103
|
-
return [minData, maxData];
|
|
104
|
-
}
|
|
105
|
-
return [Math.min(minChartTypeData, minData), Math.max(maxChartTypeData, maxData)];
|
|
106
|
-
};
|
|
107
|
-
var getAxisExtremum = function getAxisExtremum(axis, getters, isDefaultAxis) {
|
|
108
|
-
var charTypes = Object.keys(getters);
|
|
109
|
-
return charTypes.reduce(function (acc, charType) {
|
|
110
|
-
return axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis);
|
|
111
|
-
}, [null, null]);
|
|
112
|
-
};
|
|
113
|
-
var allXAxis = [].concat(_toConsumableArray((_xAxis$map = xAxis == null ? void 0 : xAxis.map(function (axis, index) {
|
|
114
|
-
return _extends({
|
|
115
|
-
id: "deaultized-x-axis-".concat(index)
|
|
116
|
-
}, axis);
|
|
117
|
-
})) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (_ref2) {
|
|
118
|
-
var id = _ref2.id;
|
|
119
|
-
return id === DEFAULT_X_AXIS_KEY;
|
|
120
|
-
}) === -1 ? [{
|
|
121
|
-
id: DEFAULT_X_AXIS_KEY,
|
|
122
|
-
scaleType: 'linear'
|
|
123
|
-
}] : []));
|
|
124
|
-
var completedXAxis = {};
|
|
125
|
-
allXAxis.forEach(function (axis, axisIndex) {
|
|
126
|
-
var _axis$scaleType, _axis$min, _axis$max, _axis$min2, _axis$max2;
|
|
127
|
-
var isDefaultAxis = axisIndex === 0;
|
|
128
|
-
var _getAxisExtremum = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis),
|
|
129
|
-
_getAxisExtremum2 = _slicedToArray(_getAxisExtremum, 2),
|
|
130
|
-
minData = _getAxisExtremum2[0],
|
|
131
|
-
maxData = _getAxisExtremum2[1];
|
|
132
|
-
var range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
133
|
-
if (isBandScaleConfig(axis)) {
|
|
134
|
-
var _axis$categoryGapRati, _axis$barGapRatio;
|
|
135
|
-
var categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
|
|
136
|
-
var barGapRatio = (_axis$barGapRatio = axis.barGapRatio) != null ? _axis$barGapRatio : DEFAULT_BAR_GAP_RATIO;
|
|
137
|
-
completedXAxis[axis.id] = _extends({
|
|
138
|
-
categoryGapRatio: categoryGapRatio,
|
|
139
|
-
barGapRatio: barGapRatio
|
|
140
|
-
}, axis, {
|
|
141
|
-
scale: scaleBand(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
142
|
-
tickNumber: axis.data.length
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
if (isPointScaleConfig(axis)) {
|
|
146
|
-
completedXAxis[axis.id] = _extends({}, axis, {
|
|
147
|
-
scale: scalePoint(axis.data, range),
|
|
148
|
-
tickNumber: axis.data.length
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
152
|
-
// Could be merged with the two previous "if conditions" but then TS does not get that `axis.scaleType` can't be `band` or `point`.
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
var scaleType = (_axis$scaleType = axis.scaleType) != null ? _axis$scaleType : 'linear';
|
|
156
|
-
var extremums = [(_axis$min = axis.min) != null ? _axis$min : minData, (_axis$max = axis.max) != null ? _axis$max : maxData];
|
|
157
|
-
var tickNumber = getTickNumber(_extends({}, axis, {
|
|
158
|
-
range: range,
|
|
159
|
-
domain: extremums
|
|
160
|
-
}));
|
|
161
|
-
var niceScale = getScale(scaleType, extremums, range).nice(tickNumber);
|
|
162
|
-
var niceDomain = niceScale.domain();
|
|
163
|
-
var domain = [(_axis$min2 = axis.min) != null ? _axis$min2 : niceDomain[0], (_axis$max2 = axis.max) != null ? _axis$max2 : niceDomain[1]];
|
|
164
|
-
completedXAxis[axis.id] = _extends({}, axis, {
|
|
165
|
-
scaleType: scaleType,
|
|
166
|
-
scale: niceScale.domain(domain),
|
|
167
|
-
tickNumber: tickNumber
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
var allYAxis = [].concat(_toConsumableArray((_yAxis$map = yAxis == null ? void 0 : yAxis.map(function (axis, index) {
|
|
171
|
-
return _extends({
|
|
172
|
-
id: "deaultized-y-axis-".concat(index)
|
|
173
|
-
}, axis);
|
|
174
|
-
})) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (_ref3) {
|
|
175
|
-
var id = _ref3.id;
|
|
176
|
-
return id === DEFAULT_Y_AXIS_KEY;
|
|
177
|
-
}) === -1 ? [{
|
|
178
|
-
id: DEFAULT_Y_AXIS_KEY,
|
|
179
|
-
scaleType: 'linear'
|
|
180
|
-
}] : []));
|
|
181
|
-
var completedYAxis = {};
|
|
182
|
-
allYAxis.forEach(function (axis, axisIndex) {
|
|
183
|
-
var _axis$scaleType2, _axis$min3, _axis$max3, _axis$min4, _axis$max4;
|
|
184
|
-
var isDefaultAxis = axisIndex === 0;
|
|
185
|
-
var _getAxisExtremum3 = getAxisExtremum(axis, yExtremumGetters, isDefaultAxis),
|
|
186
|
-
_getAxisExtremum4 = _slicedToArray(_getAxisExtremum3, 2),
|
|
187
|
-
minData = _getAxisExtremum4[0],
|
|
188
|
-
maxData = _getAxisExtremum4[1];
|
|
189
|
-
var range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
190
|
-
if (isBandScaleConfig(axis)) {
|
|
191
|
-
var _axis$categoryGapRati2;
|
|
192
|
-
var categoryGapRatio = (_axis$categoryGapRati2 = axis.categoryGapRatio) != null ? _axis$categoryGapRati2 : DEFAULT_CATEGORY_GAP_RATIO;
|
|
193
|
-
completedYAxis[axis.id] = _extends({
|
|
194
|
-
categoryGapRatio: categoryGapRatio,
|
|
195
|
-
barGapRatio: 0
|
|
196
|
-
}, axis, {
|
|
197
|
-
scale: scaleBand(axis.data, [range[1], range[0]]).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
198
|
-
tickNumber: axis.data.length
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
if (isPointScaleConfig(axis)) {
|
|
202
|
-
completedYAxis[axis.id] = _extends({}, axis, {
|
|
203
|
-
scale: scalePoint(axis.data, [range[1], range[0]]),
|
|
204
|
-
tickNumber: axis.data.length
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
208
|
-
// Could be merged with the two previous "if conditions" but then TS does not get that `axis.scaleType` can't be `band` or `point`.
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
var scaleType = (_axis$scaleType2 = axis.scaleType) != null ? _axis$scaleType2 : 'linear';
|
|
212
|
-
var extremums = [(_axis$min3 = axis.min) != null ? _axis$min3 : minData, (_axis$max3 = axis.max) != null ? _axis$max3 : maxData];
|
|
213
|
-
var tickNumber = getTickNumber(_extends({}, axis, {
|
|
214
|
-
range: range,
|
|
215
|
-
domain: extremums
|
|
216
|
-
}));
|
|
217
|
-
var niceScale = getScale(scaleType, extremums, range).nice(tickNumber);
|
|
218
|
-
var niceDomain = niceScale.domain();
|
|
219
|
-
var domain = [(_axis$min4 = axis.min) != null ? _axis$min4 : niceDomain[0], (_axis$max4 = axis.max) != null ? _axis$max4 : niceDomain[1]];
|
|
220
|
-
completedYAxis[axis.id] = _extends({}, axis, {
|
|
221
|
-
scaleType: scaleType,
|
|
222
|
-
scale: niceScale.domain(domain),
|
|
223
|
-
tickNumber: tickNumber
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
return {
|
|
227
|
-
xAxis: completedXAxis,
|
|
228
|
-
yAxis: completedYAxis,
|
|
229
|
-
xAxisIds: allXAxis.map(function (_ref4) {
|
|
230
|
-
var id = _ref4.id;
|
|
231
|
-
return id;
|
|
232
|
-
}),
|
|
233
|
-
yAxisIds: allYAxis.map(function (_ref5) {
|
|
234
|
-
var id = _ref5.id;
|
|
235
|
-
return id;
|
|
236
|
-
})
|
|
237
|
-
};
|
|
238
|
-
}, [drawingArea.height, drawingArea.left, drawingArea.top, drawingArea.width, formattedSeries, xAxis, yAxis]);
|
|
239
|
-
|
|
240
|
-
// @ts-ignore
|
|
241
|
-
return /*#__PURE__*/_jsx(CartesianContext.Provider, {
|
|
242
|
-
value: value,
|
|
243
|
-
children: children
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
247
|
-
// ----------------------------- Warning --------------------------------
|
|
248
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
249
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
250
|
-
// ----------------------------------------------------------------------
|
|
251
|
-
children: PropTypes.node,
|
|
252
|
-
/**
|
|
253
|
-
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
254
|
-
*/
|
|
255
|
-
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
256
|
-
/**
|
|
257
|
-
* The configuration of the x-axes.
|
|
258
|
-
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
259
|
-
*/
|
|
260
|
-
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
261
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
262
|
-
classes: PropTypes.object,
|
|
263
|
-
data: PropTypes.array,
|
|
264
|
-
dataKey: PropTypes.string,
|
|
265
|
-
disableLine: PropTypes.bool,
|
|
266
|
-
disableTicks: PropTypes.bool,
|
|
267
|
-
fill: PropTypes.string,
|
|
268
|
-
hideTooltip: PropTypes.bool,
|
|
269
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
270
|
-
label: PropTypes.string,
|
|
271
|
-
labelFontSize: PropTypes.number,
|
|
272
|
-
labelStyle: PropTypes.object,
|
|
273
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
274
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
275
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
276
|
-
reverse: PropTypes.bool,
|
|
277
|
-
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
278
|
-
slotProps: PropTypes.object,
|
|
279
|
-
slots: PropTypes.object,
|
|
280
|
-
stroke: PropTypes.string,
|
|
281
|
-
tickFontSize: PropTypes.number,
|
|
282
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
283
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
284
|
-
tickLabelStyle: PropTypes.object,
|
|
285
|
-
tickMaxStep: PropTypes.number,
|
|
286
|
-
tickMinStep: PropTypes.number,
|
|
287
|
-
tickNumber: PropTypes.number,
|
|
288
|
-
tickSize: PropTypes.number,
|
|
289
|
-
valueFormatter: PropTypes.func
|
|
290
|
-
})),
|
|
291
|
-
/**
|
|
292
|
-
* The configuration of the y-axes.
|
|
293
|
-
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
294
|
-
*/
|
|
295
|
-
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
296
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
297
|
-
classes: PropTypes.object,
|
|
298
|
-
data: PropTypes.array,
|
|
299
|
-
dataKey: PropTypes.string,
|
|
300
|
-
disableLine: PropTypes.bool,
|
|
301
|
-
disableTicks: PropTypes.bool,
|
|
302
|
-
fill: PropTypes.string,
|
|
303
|
-
hideTooltip: PropTypes.bool,
|
|
304
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
305
|
-
label: PropTypes.string,
|
|
306
|
-
labelFontSize: PropTypes.number,
|
|
307
|
-
labelStyle: PropTypes.object,
|
|
308
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
309
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
310
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
311
|
-
reverse: PropTypes.bool,
|
|
312
|
-
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
313
|
-
slotProps: PropTypes.object,
|
|
314
|
-
slots: PropTypes.object,
|
|
315
|
-
stroke: PropTypes.string,
|
|
316
|
-
tickFontSize: PropTypes.number,
|
|
317
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
318
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
319
|
-
tickLabelStyle: PropTypes.object,
|
|
320
|
-
tickMaxStep: PropTypes.number,
|
|
321
|
-
tickMinStep: PropTypes.number,
|
|
322
|
-
tickNumber: PropTypes.number,
|
|
323
|
-
tickSize: PropTypes.number,
|
|
324
|
-
valueFormatter: PropTypes.func
|
|
325
|
-
}))
|
|
326
|
-
} : void 0;
|
|
327
|
-
export { CartesianContextProvider };
|