@mui/x-charts 7.6.2 → 7.7.1
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 +1 -1
- package/BarChart/BarChart.js +21 -104
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -3
- package/BarChart/BarLabel/BarLabelPlot.js +1 -24
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/checkScaleErrors.d.ts +5 -9
- package/BarChart/types.d.ts +2 -2
- package/BarChart/useBarChartProps.d.ts +102 -0
- package/BarChart/useBarChartProps.js +143 -0
- package/CHANGELOG.md +163 -0
- package/ChartContainer/ChartContainer.d.ts +4 -4
- package/ChartContainer/ChartContainer.js +64 -31
- package/ChartContainer/useChartContainerHooks.d.ts +11 -0
- package/ChartContainer/useChartContainerHooks.js +34 -0
- package/ChartContainer/usePluginsMerge.d.ts +1 -2
- package/ChartsAxis/ChartsAxis.js +2 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsGrid/ChartsGrid.js +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/index.d.ts +1 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/ChartsText/ChartsText.js +1 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +2 -2
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +25 -107
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/useLineChartProps.d.ts +117 -0
- package/LineChart/useLineChartProps.js +152 -0
- package/PieChart/PieChart.d.ts +2 -2
- package/PieChart/PieChart.js +1 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResizableContainer.js +32 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +25 -22
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +21 -76
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +86 -0
- package/ScatterChart/useScatterChartProps.js +116 -0
- package/SparkLineChart/SparkLineChart.d.ts +8 -3
- package/SparkLineChart/SparkLineChart.js +57 -1
- package/context/CartesianProvider/CartesianContext.d.ts +25 -0
- package/context/CartesianProvider/CartesianContext.js +21 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +34 -0
- package/context/CartesianProvider/CartesianProvider.js +44 -0
- package/context/CartesianProvider/computeValue.d.ts +19 -0
- package/context/CartesianProvider/computeValue.js +89 -0
- package/context/CartesianProvider/getAxisExtremum.d.ts +4 -0
- package/context/CartesianProvider/getAxisExtremum.js +28 -0
- package/context/CartesianProvider/index.d.ts +9 -0
- package/context/CartesianProvider/index.js +51 -0
- package/context/CartesianProvider/normalizeAxis.d.ts +5 -0
- package/context/CartesianProvider/normalizeAxis.js +23 -0
- package/context/CartesianProvider/useCartesianContext.d.ts +2 -0
- package/context/CartesianProvider/useCartesianContext.js +17 -0
- package/context/ColorProvider.d.ts +12 -0
- package/context/ColorProvider.js +25 -0
- package/esm/BarChart/BarChart.js +21 -104
- package/esm/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/BarChart/useBarChartProps.js +136 -0
- package/esm/ChartContainer/ChartContainer.js +65 -32
- package/esm/ChartContainer/useChartContainerHooks.js +24 -0
- package/esm/ChartsAxis/ChartsAxis.js +2 -2
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/esm/ChartsGrid/ChartsGrid.js +2 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/esm/ChartsText/ChartsText.js +1 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +25 -107
- package/esm/LineChart/LineHighlightPlot.js +2 -2
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +2 -2
- package/esm/LineChart/useLineChartProps.js +144 -0
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/esm/ScatterChart/ScatterChart.js +21 -76
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +108 -0
- package/esm/SparkLineChart/SparkLineChart.js +57 -1
- package/esm/context/CartesianProvider/CartesianContext.js +13 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +37 -0
- package/esm/context/CartesianProvider/computeValue.js +82 -0
- package/esm/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/esm/context/CartesianProvider/index.js +10 -0
- package/esm/context/CartesianProvider/normalizeAxis.js +15 -0
- package/esm/context/CartesianProvider/useCartesianContext.js +8 -0
- package/esm/context/ColorProvider.js +16 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useAxisEvents.js +2 -2
- package/esm/hooks/useColor.js +9 -0
- package/esm/hooks/useColorScale.js +27 -0
- package/esm/hooks/useReducedMotion.js +7 -0
- package/esm/hooks/useScale.js +3 -4
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/esm/internals/index.js +31 -1
- package/esm/internals/warning.js +13 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useColor.d.ts +4 -0
- package/hooks/useColor.js +17 -0
- package/hooks/useColorScale.d.ts +4 -0
- package/hooks/useColorScale.js +37 -0
- package/hooks/useDrawingArea.d.ts +2 -8
- package/hooks/useReducedMotion.js +7 -0
- package/hooks/useScale.js +3 -6
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/internals/defaultizeColor.d.ts +8 -8
- package/internals/index.d.ts +22 -0
- package/internals/index.js +231 -0
- package/internals/warning.d.ts +1 -0
- package/internals/warning.js +19 -0
- package/models/axis.d.ts +1 -2
- package/models/plugin.d.ts +4 -1
- package/modern/BarChart/BarChart.js +21 -104
- package/modern/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/BarChart/useBarChartProps.js +136 -0
- package/modern/ChartContainer/ChartContainer.js +65 -32
- package/modern/ChartContainer/useChartContainerHooks.js +24 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/modern/ChartsGrid/ChartsGrid.js +2 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/modern/ChartsText/ChartsText.js +1 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +25 -107
- package/modern/LineChart/LineHighlightPlot.js +2 -2
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +2 -2
- package/modern/LineChart/useLineChartProps.js +144 -0
- package/modern/PieChart/PieChart.js +1 -1
- package/modern/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/modern/ScatterChart/ScatterChart.js +21 -76
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/useScatterChartProps.js +108 -0
- package/modern/SparkLineChart/SparkLineChart.js +57 -1
- package/modern/context/CartesianProvider/CartesianContext.js +13 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +37 -0
- package/modern/context/CartesianProvider/computeValue.js +82 -0
- package/modern/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/modern/context/CartesianProvider/index.js +10 -0
- package/modern/context/CartesianProvider/normalizeAxis.js +15 -0
- package/modern/context/CartesianProvider/useCartesianContext.js +8 -0
- package/modern/context/ColorProvider.js +16 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useAxisEvents.js +2 -2
- package/modern/hooks/useColor.js +9 -0
- package/modern/hooks/useColorScale.js +27 -0
- package/modern/hooks/useReducedMotion.js +7 -0
- package/modern/hooks/useScale.js +3 -4
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/modern/internals/index.js +31 -1
- package/modern/internals/warning.js +13 -0
- package/package.json +4 -4
- package/themeAugmentation/components.d.ts +12 -12
- package/context/CartesianContextProvider.d.ts +0 -53
- package/context/CartesianContextProvider.js +0 -233
- package/esm/context/CartesianContextProvider.js +0 -224
- package/esm/internals/colorGetter.js +0 -22
- package/internals/colorGetter.d.ts +0 -7
- package/internals/colorGetter.js +0 -29
- package/modern/context/CartesianContextProvider.js +0 -224
- package/modern/internals/colorGetter.js +0 -22
|
@@ -13,11 +13,12 @@ var _ResponsiveChartContainer = require("../ResponsiveChartContainer");
|
|
|
13
13
|
var _ChartsAxis = require("../ChartsAxis");
|
|
14
14
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
15
15
|
var _ChartsLegend = require("../ChartsLegend");
|
|
16
|
-
var _ChartsOverlay = require("../ChartsOverlay
|
|
16
|
+
var _ChartsOverlay = require("../ChartsOverlay");
|
|
17
17
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
18
18
|
var _ChartsVoronoiHandler = require("../ChartsVoronoiHandler/ChartsVoronoiHandler");
|
|
19
19
|
var _ChartsGrid = require("../ChartsGrid");
|
|
20
20
|
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
21
|
+
var _useScatterChartProps = require("./useScatterChartProps");
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -33,81 +34,25 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
33
34
|
*/
|
|
34
35
|
const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, ref) {
|
|
35
36
|
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
onItemClick,
|
|
56
|
-
children,
|
|
57
|
-
slots,
|
|
58
|
-
slotProps,
|
|
59
|
-
loading,
|
|
60
|
-
highlightedItem,
|
|
61
|
-
onHighlightChange
|
|
62
|
-
} = props;
|
|
63
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
64
|
-
ref: ref,
|
|
65
|
-
series: series.map(s => (0, _extends2.default)({
|
|
66
|
-
type: 'scatter'
|
|
67
|
-
}, s)),
|
|
68
|
-
width: width,
|
|
69
|
-
height: height,
|
|
70
|
-
margin: margin,
|
|
71
|
-
colors: colors,
|
|
72
|
-
xAxis: xAxis,
|
|
73
|
-
yAxis: yAxis,
|
|
74
|
-
sx: sx,
|
|
75
|
-
highlightedItem: highlightedItem,
|
|
76
|
-
onHighlightChange: onHighlightChange,
|
|
77
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ZAxisContextProvider.ZAxisContextProvider, {
|
|
78
|
-
zAxis: zAxis,
|
|
79
|
-
children: [!disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, {
|
|
80
|
-
voronoiMaxRadius: voronoiMaxRadius,
|
|
81
|
-
onItemClick: onItemClick
|
|
82
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
83
|
-
topAxis: topAxis,
|
|
84
|
-
leftAxis: leftAxis,
|
|
85
|
-
rightAxis: rightAxis,
|
|
86
|
-
bottomAxis: bottomAxis,
|
|
87
|
-
slots: slots,
|
|
88
|
-
slotProps: slotProps
|
|
89
|
-
}), grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, {
|
|
90
|
-
vertical: grid.vertical,
|
|
91
|
-
horizontal: grid.horizontal
|
|
92
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, {
|
|
93
|
-
slots: slots,
|
|
94
|
-
slotProps: slotProps,
|
|
95
|
-
onItemClick: disableVoronoi ? onItemClick : undefined
|
|
96
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
97
|
-
loading: loading,
|
|
98
|
-
slots: slots,
|
|
99
|
-
slotProps: slotProps
|
|
100
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
101
|
-
slots: slots,
|
|
102
|
-
slotProps: slotProps
|
|
103
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({
|
|
104
|
-
x: "none",
|
|
105
|
-
y: "none"
|
|
106
|
-
}, axisHighlight)), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({
|
|
107
|
-
trigger: "item"
|
|
108
|
-
}, tooltip)), children]
|
|
109
|
-
})
|
|
110
|
-
});
|
|
37
|
+
chartContainerProps,
|
|
38
|
+
zAxisProps,
|
|
39
|
+
voronoiHandlerProps,
|
|
40
|
+
chartsAxisProps,
|
|
41
|
+
gridProps,
|
|
42
|
+
scatterPlotProps,
|
|
43
|
+
overlayProps,
|
|
44
|
+
legendProps,
|
|
45
|
+
axisHighlightProps,
|
|
46
|
+
tooltipProps,
|
|
47
|
+
children
|
|
48
|
+
} = (0, _useScatterChartProps.useScatterChartProps)(props);
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveChartContainer.ResponsiveChartContainer, (0, _extends2.default)({
|
|
50
|
+
ref: ref
|
|
51
|
+
}, chartContainerProps, {
|
|
52
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ZAxisContextProvider.ZAxisContextProvider, (0, _extends2.default)({}, zAxisProps, {
|
|
53
|
+
children: [!props.disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, (0, _extends2.default)({}, voronoiHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), props.grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), children]
|
|
54
|
+
}))
|
|
55
|
+
}));
|
|
111
56
|
});
|
|
112
57
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
113
58
|
// ----------------------------- Warning --------------------------------
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _Scatter = require("./Scatter");
|
|
12
|
-
var
|
|
12
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
13
13
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
14
14
|
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
15
15
|
var _useSeries = require("../hooks/useSeries");
|
|
@@ -33,7 +33,7 @@ function ScatterPlot(props) {
|
|
|
33
33
|
onItemClick
|
|
34
34
|
} = props;
|
|
35
35
|
const seriesData = (0, _useSeries.useScatterSeries)();
|
|
36
|
-
const axisData =
|
|
36
|
+
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
37
37
|
const {
|
|
38
38
|
zAxis,
|
|
39
39
|
zAxisIds
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ScatterChartProps } from './ScatterChart';
|
|
3
|
+
/**
|
|
4
|
+
* A helper function that extracts ScatterChartProps from the input props
|
|
5
|
+
* and returns an object with props for the children components of ScatterChart.
|
|
6
|
+
*
|
|
7
|
+
* @param props The input props for ScatterChart
|
|
8
|
+
* @returns An object with props for the children components of ScatterChart
|
|
9
|
+
*/
|
|
10
|
+
export declare const useScatterChartProps: (props: ScatterChartProps) => {
|
|
11
|
+
chartContainerProps: {
|
|
12
|
+
series: {
|
|
13
|
+
color?: string | undefined;
|
|
14
|
+
data: import("..").ScatterValueType[];
|
|
15
|
+
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
16
|
+
id?: import("../internals").SeriesId | undefined;
|
|
17
|
+
valueFormatter?: import("../internals").SeriesValueFormatter<import("..").ScatterValueType> | undefined;
|
|
18
|
+
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
19
|
+
xAxisKey?: string | undefined;
|
|
20
|
+
yAxisKey?: string | undefined;
|
|
21
|
+
markerSize?: number | undefined;
|
|
22
|
+
disableHover?: boolean | undefined;
|
|
23
|
+
zAxisKey?: string | undefined;
|
|
24
|
+
type: "scatter";
|
|
25
|
+
}[];
|
|
26
|
+
width: number | undefined;
|
|
27
|
+
height: number | undefined;
|
|
28
|
+
margin: Partial<import("..").CardinalDirections<number>> | undefined;
|
|
29
|
+
colors: import("..").ChartsColorPalette | undefined;
|
|
30
|
+
xAxis: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsXAxisProps>, "id">[] | undefined;
|
|
31
|
+
yAxis: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsYAxisProps>, "id">[] | undefined;
|
|
32
|
+
sx: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
33
|
+
highlightedItem: import("..").HighlightItemData | null | undefined;
|
|
34
|
+
onHighlightChange: ((highlightedItem: import("..").HighlightItemData | null) => void) | undefined;
|
|
35
|
+
};
|
|
36
|
+
zAxisProps: {
|
|
37
|
+
zAxis: import("../internals").MakeOptional<import("../internals").ZAxisConfig<any>, "id">[] | undefined;
|
|
38
|
+
};
|
|
39
|
+
voronoiHandlerProps: {
|
|
40
|
+
voronoiMaxRadius: number | undefined;
|
|
41
|
+
onItemClick: ((event: MouseEvent, scatterItemIdentifier: import("..").ScatterItemIdentifier) => void) | undefined;
|
|
42
|
+
};
|
|
43
|
+
chartsAxisProps: {
|
|
44
|
+
topAxis: string | import("..").ChartsXAxisProps | null | undefined;
|
|
45
|
+
leftAxis: string | import("..").ChartsYAxisProps | null | undefined;
|
|
46
|
+
rightAxis: string | import("..").ChartsYAxisProps | null | undefined;
|
|
47
|
+
bottomAxis: string | import("..").ChartsXAxisProps | null | undefined;
|
|
48
|
+
slots: import("./ScatterChart").ScatterChartSlots | undefined;
|
|
49
|
+
slotProps: import("./ScatterChart").ScatterChartSlotProps | undefined;
|
|
50
|
+
};
|
|
51
|
+
gridProps: {
|
|
52
|
+
vertical: boolean | undefined;
|
|
53
|
+
horizontal: boolean | undefined;
|
|
54
|
+
};
|
|
55
|
+
scatterPlotProps: {
|
|
56
|
+
onItemClick: ((event: import("react").MouseEvent<SVGElement, MouseEvent>, scatterItemIdentifier: import("..").ScatterItemIdentifier) => void) | undefined;
|
|
57
|
+
slots: import("./ScatterChart").ScatterChartSlots | undefined;
|
|
58
|
+
slotProps: import("./ScatterChart").ScatterChartSlotProps | undefined;
|
|
59
|
+
};
|
|
60
|
+
overlayProps: {
|
|
61
|
+
loading: boolean | undefined;
|
|
62
|
+
slots: import("./ScatterChart").ScatterChartSlots | undefined;
|
|
63
|
+
slotProps: import("./ScatterChart").ScatterChartSlotProps | undefined;
|
|
64
|
+
};
|
|
65
|
+
legendProps: {
|
|
66
|
+
slots: import("./ScatterChart").ScatterChartSlots | undefined;
|
|
67
|
+
slotProps: import("./ScatterChart").ScatterChartSlotProps | undefined;
|
|
68
|
+
position?: import("..").AnchorPosition | undefined;
|
|
69
|
+
classes?: Partial<import("..").ChartsLegendClasses> | undefined;
|
|
70
|
+
hidden?: boolean | undefined;
|
|
71
|
+
direction?: import("..").Direction | undefined;
|
|
72
|
+
};
|
|
73
|
+
axisHighlightProps: {
|
|
74
|
+
x: "none" | "line" | "band";
|
|
75
|
+
y: "none" | "line" | "band";
|
|
76
|
+
};
|
|
77
|
+
tooltipProps: {
|
|
78
|
+
slots: import("./ScatterChart").ScatterChartSlots | undefined;
|
|
79
|
+
slotProps: import("./ScatterChart").ScatterChartSlotProps | undefined;
|
|
80
|
+
trigger: import("../ChartsTooltip/utils").TriggerOptions;
|
|
81
|
+
itemContent?: import("react").ElementType<import("..").ChartsItemContentProps<any>, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
82
|
+
axisContent?: import("react").ElementType<import("..").ChartsAxisContentProps, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
83
|
+
classes?: Partial<import("..").ChartsTooltipClasses> | undefined;
|
|
84
|
+
};
|
|
85
|
+
children: import("react").ReactNode;
|
|
86
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useScatterChartProps = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
/**
|
|
10
|
+
* A helper function that extracts ScatterChartProps from the input props
|
|
11
|
+
* and returns an object with props for the children components of ScatterChart.
|
|
12
|
+
*
|
|
13
|
+
* @param props The input props for ScatterChart
|
|
14
|
+
* @returns An object with props for the children components of ScatterChart
|
|
15
|
+
*/
|
|
16
|
+
const useScatterChartProps = props => {
|
|
17
|
+
const {
|
|
18
|
+
xAxis,
|
|
19
|
+
yAxis,
|
|
20
|
+
zAxis,
|
|
21
|
+
series,
|
|
22
|
+
tooltip,
|
|
23
|
+
axisHighlight,
|
|
24
|
+
voronoiMaxRadius,
|
|
25
|
+
disableVoronoi,
|
|
26
|
+
legend,
|
|
27
|
+
width,
|
|
28
|
+
height,
|
|
29
|
+
margin,
|
|
30
|
+
colors,
|
|
31
|
+
sx,
|
|
32
|
+
grid,
|
|
33
|
+
topAxis,
|
|
34
|
+
leftAxis,
|
|
35
|
+
rightAxis,
|
|
36
|
+
bottomAxis,
|
|
37
|
+
onItemClick,
|
|
38
|
+
children,
|
|
39
|
+
slots,
|
|
40
|
+
slotProps,
|
|
41
|
+
loading,
|
|
42
|
+
highlightedItem,
|
|
43
|
+
onHighlightChange
|
|
44
|
+
} = props;
|
|
45
|
+
const chartContainerProps = {
|
|
46
|
+
series: series.map(s => (0, _extends2.default)({
|
|
47
|
+
type: 'scatter'
|
|
48
|
+
}, s)),
|
|
49
|
+
width,
|
|
50
|
+
height,
|
|
51
|
+
margin,
|
|
52
|
+
colors,
|
|
53
|
+
xAxis,
|
|
54
|
+
yAxis,
|
|
55
|
+
sx,
|
|
56
|
+
highlightedItem,
|
|
57
|
+
onHighlightChange
|
|
58
|
+
};
|
|
59
|
+
const zAxisProps = {
|
|
60
|
+
zAxis
|
|
61
|
+
};
|
|
62
|
+
const voronoiHandlerProps = {
|
|
63
|
+
voronoiMaxRadius,
|
|
64
|
+
onItemClick: onItemClick
|
|
65
|
+
};
|
|
66
|
+
const chartsAxisProps = {
|
|
67
|
+
topAxis,
|
|
68
|
+
leftAxis,
|
|
69
|
+
rightAxis,
|
|
70
|
+
bottomAxis,
|
|
71
|
+
slots,
|
|
72
|
+
slotProps
|
|
73
|
+
};
|
|
74
|
+
const gridProps = {
|
|
75
|
+
vertical: grid?.vertical,
|
|
76
|
+
horizontal: grid?.horizontal
|
|
77
|
+
};
|
|
78
|
+
const scatterPlotProps = {
|
|
79
|
+
onItemClick: disableVoronoi ? onItemClick : undefined,
|
|
80
|
+
slots,
|
|
81
|
+
slotProps
|
|
82
|
+
};
|
|
83
|
+
const overlayProps = {
|
|
84
|
+
loading,
|
|
85
|
+
slots,
|
|
86
|
+
slotProps
|
|
87
|
+
};
|
|
88
|
+
const legendProps = (0, _extends2.default)({}, legend, {
|
|
89
|
+
slots,
|
|
90
|
+
slotProps
|
|
91
|
+
});
|
|
92
|
+
const axisHighlightProps = (0, _extends2.default)({
|
|
93
|
+
y: 'none',
|
|
94
|
+
x: 'none'
|
|
95
|
+
}, axisHighlight);
|
|
96
|
+
const tooltipProps = (0, _extends2.default)({
|
|
97
|
+
trigger: 'item'
|
|
98
|
+
}, tooltip, {
|
|
99
|
+
slots,
|
|
100
|
+
slotProps
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
chartContainerProps,
|
|
104
|
+
zAxisProps,
|
|
105
|
+
voronoiHandlerProps,
|
|
106
|
+
chartsAxisProps,
|
|
107
|
+
gridProps,
|
|
108
|
+
scatterPlotProps,
|
|
109
|
+
overlayProps,
|
|
110
|
+
legendProps,
|
|
111
|
+
axisHighlightProps,
|
|
112
|
+
tooltipProps,
|
|
113
|
+
children
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
exports.useScatterChartProps = useScatterChartProps;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
|
|
3
3
|
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
4
4
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
5
|
-
import { AxisConfig, ChartsXAxisProps, ScaleName } from '../models/axis';
|
|
5
|
+
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../models/axis';
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
8
|
import { CardinalDirections } from '../models/layout';
|
|
@@ -15,12 +15,17 @@ export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkP
|
|
|
15
15
|
}
|
|
16
16
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {
|
|
17
17
|
}
|
|
18
|
-
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'margin' | 'plugins'> {
|
|
18
|
+
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'margin' | 'plugins'> {
|
|
19
19
|
/**
|
|
20
20
|
* The xAxis configuration.
|
|
21
|
-
* Notice it is a single
|
|
21
|
+
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
22
22
|
*/
|
|
23
23
|
xAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>;
|
|
24
|
+
/**
|
|
25
|
+
* The yAxis configuration.
|
|
26
|
+
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
27
|
+
*/
|
|
28
|
+
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>;
|
|
24
29
|
tooltip?: ChartsTooltipProps;
|
|
25
30
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
26
31
|
/**
|
|
@@ -36,6 +36,7 @@ const SPARKLINE_DEFAULT_MARGIN = {
|
|
|
36
36
|
const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
37
37
|
const {
|
|
38
38
|
xAxis,
|
|
39
|
+
yAxis,
|
|
39
40
|
width,
|
|
40
41
|
height,
|
|
41
42
|
margin = SPARKLINE_DEFAULT_MARGIN,
|
|
@@ -82,6 +83,9 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
82
83
|
}, (_, index) => index),
|
|
83
84
|
hideTooltip: xAxis === undefined
|
|
84
85
|
}, xAxis)],
|
|
86
|
+
yAxis: [(0, _extends2.default)({
|
|
87
|
+
id: _constants.DEFAULT_X_AXIS_KEY
|
|
88
|
+
}, yAxis)],
|
|
85
89
|
colors: colors,
|
|
86
90
|
sx: sx,
|
|
87
91
|
disableAxisListener: (!showTooltip || tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
@@ -242,7 +246,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
242
246
|
width: _propTypes.default.number,
|
|
243
247
|
/**
|
|
244
248
|
* The xAxis configuration.
|
|
245
|
-
* Notice it is a single
|
|
249
|
+
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
246
250
|
*/
|
|
247
251
|
xAxis: _propTypes.default.shape({
|
|
248
252
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -291,5 +295,57 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
291
295
|
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
292
296
|
tickSize: _propTypes.default.number,
|
|
293
297
|
valueFormatter: _propTypes.default.func
|
|
298
|
+
}),
|
|
299
|
+
/**
|
|
300
|
+
* The yAxis configuration.
|
|
301
|
+
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
302
|
+
*/
|
|
303
|
+
yAxis: _propTypes.default.shape({
|
|
304
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
305
|
+
classes: _propTypes.default.object,
|
|
306
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
307
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
308
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
309
|
+
unknownColor: _propTypes.default.string,
|
|
310
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
311
|
+
}), _propTypes.default.shape({
|
|
312
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
313
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
314
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
315
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
316
|
+
}), _propTypes.default.shape({
|
|
317
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
318
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
319
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
320
|
+
})]),
|
|
321
|
+
data: _propTypes.default.array,
|
|
322
|
+
dataKey: _propTypes.default.string,
|
|
323
|
+
disableLine: _propTypes.default.bool,
|
|
324
|
+
disableTicks: _propTypes.default.bool,
|
|
325
|
+
fill: _propTypes.default.string,
|
|
326
|
+
hideTooltip: _propTypes.default.bool,
|
|
327
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
328
|
+
label: _propTypes.default.string,
|
|
329
|
+
labelFontSize: _propTypes.default.number,
|
|
330
|
+
labelStyle: _propTypes.default.object,
|
|
331
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
332
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
333
|
+
position: _propTypes.default.oneOf(['left', 'right']),
|
|
334
|
+
reverse: _propTypes.default.bool,
|
|
335
|
+
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
336
|
+
slotProps: _propTypes.default.object,
|
|
337
|
+
slots: _propTypes.default.object,
|
|
338
|
+
stroke: _propTypes.default.string,
|
|
339
|
+
tickFontSize: _propTypes.default.number,
|
|
340
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
341
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
342
|
+
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
343
|
+
tickLabelStyle: _propTypes.default.object,
|
|
344
|
+
tickMaxStep: _propTypes.default.number,
|
|
345
|
+
tickMinStep: _propTypes.default.number,
|
|
346
|
+
tickNumber: _propTypes.default.number,
|
|
347
|
+
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
348
|
+
tickSize: _propTypes.default.number,
|
|
349
|
+
valueFormatter: _propTypes.default.func
|
|
294
350
|
})
|
|
295
351
|
} : void 0;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Initializable } from '../context.types';
|
|
3
|
+
import { AxisDefaultized, ScaleName, ChartsXAxisProps, ChartsYAxisProps, AxisId } from '../../models/axis';
|
|
4
|
+
export type DefaultizedAxisConfig<AxisProps> = {
|
|
5
|
+
[axisKey: AxisId]: AxisDefaultized<ScaleName, any, AxisProps>;
|
|
6
|
+
};
|
|
7
|
+
export type CartesianContextState = {
|
|
8
|
+
/**
|
|
9
|
+
* Mapping from x-axis key to scaling configuration.
|
|
10
|
+
*/
|
|
11
|
+
xAxis: DefaultizedAxisConfig<ChartsXAxisProps>;
|
|
12
|
+
/**
|
|
13
|
+
* Mapping from y-axis key to scaling configuration.
|
|
14
|
+
*/
|
|
15
|
+
yAxis: DefaultizedAxisConfig<ChartsYAxisProps>;
|
|
16
|
+
/**
|
|
17
|
+
* The x-axes IDs sorted by order they got provided.
|
|
18
|
+
*/
|
|
19
|
+
xAxisIds: AxisId[];
|
|
20
|
+
/**
|
|
21
|
+
* The y-axes IDs sorted by order they got provided.
|
|
22
|
+
*/
|
|
23
|
+
yAxisIds: AxisId[];
|
|
24
|
+
};
|
|
25
|
+
export declare const CartesianContext: React.Context<Initializable<CartesianContextState>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CartesianContext = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
const CartesianContext = exports.CartesianContext = /*#__PURE__*/React.createContext({
|
|
11
|
+
isInitialized: false,
|
|
12
|
+
data: {
|
|
13
|
+
xAxis: {},
|
|
14
|
+
yAxis: {},
|
|
15
|
+
xAxisIds: [],
|
|
16
|
+
yAxisIds: []
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
20
|
+
CartesianContext.displayName = 'CartesianContext';
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../../models/axis';
|
|
3
|
+
import { DatasetType } from '../../models/seriesType/config';
|
|
4
|
+
import { MakeOptional } from '../../models/helpers';
|
|
5
|
+
import { ExtremumGettersConfig } from '../../models';
|
|
6
|
+
export type CartesianContextProviderProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The configuration of the x-axes.
|
|
9
|
+
* If not provided, a default axis config is used.
|
|
10
|
+
* An array of [[AxisConfig]] objects.
|
|
11
|
+
*/
|
|
12
|
+
xAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>[];
|
|
13
|
+
/**
|
|
14
|
+
* The configuration of the y-axes.
|
|
15
|
+
* If not provided, a default axis config is used.
|
|
16
|
+
* An array of [[AxisConfig]] objects.
|
|
17
|
+
*/
|
|
18
|
+
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[];
|
|
19
|
+
/**
|
|
20
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
21
|
+
*/
|
|
22
|
+
dataset?: DatasetType;
|
|
23
|
+
/**
|
|
24
|
+
* An object with x-axis extremum getters per series type.
|
|
25
|
+
*/
|
|
26
|
+
xExtremumGetters: ExtremumGettersConfig;
|
|
27
|
+
/**
|
|
28
|
+
* An object with y-axis extremum getters per series type.
|
|
29
|
+
*/
|
|
30
|
+
yExtremumGetters: ExtremumGettersConfig;
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
};
|
|
33
|
+
declare function CartesianContextProvider(props: CartesianContextProviderProps): React.JSX.Element;
|
|
34
|
+
export { CartesianContextProvider };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CartesianContextProvider = CartesianContextProvider;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _useDrawingArea = require("../../hooks/useDrawingArea");
|
|
9
|
+
var _useSeries = require("../../hooks/useSeries");
|
|
10
|
+
var _CartesianContext = require("./CartesianContext");
|
|
11
|
+
var _normalizeAxis = require("./normalizeAxis");
|
|
12
|
+
var _computeValue = require("./computeValue");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function CartesianContextProvider(props) {
|
|
17
|
+
const {
|
|
18
|
+
xAxis: inXAxis,
|
|
19
|
+
yAxis: inYAxis,
|
|
20
|
+
dataset,
|
|
21
|
+
xExtremumGetters,
|
|
22
|
+
yExtremumGetters,
|
|
23
|
+
children
|
|
24
|
+
} = props;
|
|
25
|
+
const formattedSeries = (0, _useSeries.useSeries)();
|
|
26
|
+
const drawingArea = (0, _useDrawingArea.useDrawingArea)();
|
|
27
|
+
const xAxis = React.useMemo(() => (0, _normalizeAxis.normalizeAxis)(inXAxis, dataset, 'x'), [inXAxis, dataset]);
|
|
28
|
+
const yAxis = React.useMemo(() => (0, _normalizeAxis.normalizeAxis)(inYAxis, dataset, 'y'), [inYAxis, dataset]);
|
|
29
|
+
const xValues = React.useMemo(() => (0, _computeValue.computeValue)(drawingArea, formattedSeries, xAxis, xExtremumGetters, 'x'), [drawingArea, formattedSeries, xAxis, xExtremumGetters]);
|
|
30
|
+
const yValues = React.useMemo(() => (0, _computeValue.computeValue)(drawingArea, formattedSeries, yAxis, yExtremumGetters, 'y'), [drawingArea, formattedSeries, yAxis, yExtremumGetters]);
|
|
31
|
+
const value = React.useMemo(() => ({
|
|
32
|
+
isInitialized: true,
|
|
33
|
+
data: {
|
|
34
|
+
xAxis: xValues.axis,
|
|
35
|
+
yAxis: yValues.axis,
|
|
36
|
+
xAxisIds: xValues.axisIds,
|
|
37
|
+
yAxisIds: yValues.axisIds
|
|
38
|
+
}
|
|
39
|
+
}), [xValues, yValues]);
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianContext.CartesianContext.Provider, {
|
|
41
|
+
value: value,
|
|
42
|
+
children: children
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxisConfig, ScaleName } from '../../models';
|
|
2
|
+
import { ChartsXAxisProps, ChartsAxisProps, ChartsYAxisProps } from '../../models/axis';
|
|
3
|
+
import { CartesianChartSeriesType, ExtremumGetter } from '../../models/seriesType/config';
|
|
4
|
+
import { DefaultizedAxisConfig } from './CartesianContext';
|
|
5
|
+
import { DrawingArea } from '../DrawingProvider';
|
|
6
|
+
import { FormattedSeries } from '../SeriesContextProvider';
|
|
7
|
+
import { MakeOptional } from '../../models/helpers';
|
|
8
|
+
export declare function computeValue(drawingArea: DrawingArea, formattedSeries: FormattedSeries, axis: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[] | undefined, extremumGetters: {
|
|
9
|
+
[K in CartesianChartSeriesType]?: ExtremumGetter<K>;
|
|
10
|
+
}, axisName: 'y'): {
|
|
11
|
+
axis: DefaultizedAxisConfig<ChartsYAxisProps>;
|
|
12
|
+
axisIds: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare function computeValue(drawingArea: DrawingArea, formattedSeries: FormattedSeries, inAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>[] | undefined, extremumGetters: {
|
|
15
|
+
[K in CartesianChartSeriesType]?: ExtremumGetter<K>;
|
|
16
|
+
}, axisName: 'x'): {
|
|
17
|
+
axis: DefaultizedAxisConfig<ChartsAxisProps>;
|
|
18
|
+
axisIds: string[];
|
|
19
|
+
};
|