@mui/x-charts 7.3.0 → 7.3.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 -0
- package/BarChart/BarChart.js +8 -97
- package/BarChart/BarElement.d.ts +63 -62
- package/BarChart/BarElement.js +1 -2
- package/BarChart/BarPlot.js +3 -3
- package/CHANGELOG.md +79 -2
- package/ChartContainer/ChartContainer.js +3 -1
- package/ChartsAxis/ChartsAxis.js +7 -99
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +1 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsSurface.js +1 -1
- package/ChartsText/ChartsText.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +17 -4
- package/ChartsTooltip/ChartsItemTooltipContent.js +20 -4
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -7
- package/ChartsTooltip/ChartsTooltipTable.js +8 -9
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -5
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -4
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
- package/ChartsXAxis/ChartsXAxis.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/Gauge/Gauge.js +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeProvider.js +1 -1
- package/Gauge/GaugeReferenceArc.js +1 -1
- package/Gauge/GaugeValueArc.js +1 -1
- package/Gauge/GaugeValueText.js +1 -1
- package/LineChart/AnimatedArea.d.ts +63 -62
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.d.ts +63 -62
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.js +1 -1
- package/LineChart/AreaPlot.js +1 -1
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +8 -97
- package/LineChart/LineElement.js +1 -1
- package/LineChart/LineHighlightElement.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +1 -1
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkPlot.js +1 -1
- package/PieChart/PieArc.d.ts +1 -0
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieArcLabelPlot.js +1 -1
- package/PieChart/PieArcPlot.js +1 -1
- package/PieChart/PieChart.d.ts +1 -0
- package/PieChart/PieChart.js +8 -97
- package/PieChart/PiePlot.js +1 -1
- package/PieChart/dataTransform/transition.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +1 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +1 -1
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/ScatterChart.d.ts +3 -1
- package/ScatterChart/ScatterChart.js +63 -124
- package/ScatterChart/ScatterPlot.js +9 -2
- package/ScatterChart/getColor.d.ts +2 -1
- package/ScatterChart/getColor.js +18 -1
- package/SparkLineChart/SparkLineChart.js +1 -1
- package/context/CartesianContextProvider.d.ts +2 -1
- package/context/CartesianContextProvider.js +1 -1
- package/context/DrawingProvider.js +1 -1
- package/context/HighlightProvider.js +1 -1
- package/context/InteractionProvider.js +1 -1
- package/context/SeriesContextProvider.js +1 -1
- package/context/ZAxisContextProvider.d.ts +33 -0
- package/context/ZAxisContextProvider.js +98 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +8 -1
- package/esm/BarChart/BarChart.js +8 -98
- package/esm/BarChart/BarElement.js +0 -1
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/ChartContainer/ChartContainer.js +3 -2
- package/esm/ChartsAxis/ChartsAxis.js +7 -100
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/esm/ChartsGrid/ChartsGrid.js +1 -2
- package/esm/ChartsLegend/DefaultChartsLegend.js +1 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/esm/ChartsSurface.js +1 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +16 -3
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
- package/esm/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -6
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -2
- package/esm/Gauge/Gauge.js +1 -2
- package/esm/LineChart/AnimatedArea.js +1 -2
- package/esm/LineChart/AnimatedLine.js +1 -2
- package/esm/LineChart/LineChart.js +8 -98
- package/esm/PieChart/PieChart.js +8 -98
- package/esm/PieChart/PiePlot.js +1 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/esm/ScatterChart/ScatterChart.js +63 -125
- package/esm/ScatterChart/ScatterPlot.js +8 -1
- package/esm/ScatterChart/getColor.js +18 -1
- package/esm/SparkLineChart/SparkLineChart.js +1 -2
- package/esm/context/ZAxisContextProvider.js +89 -0
- package/esm/context/index.js +1 -1
- package/esm/internals/colorGetter.js +2 -2
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -2
- package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -2
- package/esm/models/z-axis.js +1 -0
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useChartDimensions.js +1 -1
- package/hooks/useChartId.js +1 -1
- package/hooks/useDrawingArea.js +1 -1
- package/hooks/useInteractionItemProps.js +1 -1
- package/hooks/useMounted.js +1 -1
- package/hooks/useScale.js +1 -1
- package/hooks/useSeries.js +1 -1
- package/hooks/useSvgRef.js +1 -1
- package/hooks/useTicks.js +1 -1
- package/index.js +1 -1
- package/internals/colorGetter.d.ts +3 -1
- package/internals/colorGetter.js +2 -2
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -1
- package/internals/defaultizeColor.d.ts +1 -0
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +1 -1
- package/models/colorMapping.d.ts +3 -2
- package/models/seriesType/pie.d.ts +5 -0
- package/models/seriesType/scatter.d.ts +5 -0
- package/models/z-axis.d.ts +14 -0
- package/models/z-axis.js +5 -0
- package/modern/BarChart/BarChart.js +8 -98
- package/modern/BarChart/BarElement.js +0 -1
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/ChartContainer/ChartContainer.js +3 -2
- package/modern/ChartsAxis/ChartsAxis.js +7 -100
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/modern/ChartsGrid/ChartsGrid.js +1 -2
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/modern/ChartsSurface.js +1 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +16 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
- package/modern/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -6
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -2
- package/modern/Gauge/Gauge.js +1 -2
- package/modern/LineChart/AnimatedArea.js +1 -2
- package/modern/LineChart/AnimatedLine.js +1 -2
- package/modern/LineChart/LineChart.js +8 -98
- package/modern/PieChart/PieChart.js +8 -98
- package/modern/PieChart/PiePlot.js +1 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +63 -125
- package/modern/ScatterChart/ScatterPlot.js +8 -1
- package/modern/ScatterChart/getColor.js +18 -1
- package/modern/SparkLineChart/SparkLineChart.js +1 -2
- package/modern/context/ZAxisContextProvider.js +89 -0
- package/modern/context/index.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/colorGetter.js +2 -2
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -2
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -2
- package/modern/models/z-axis.js +1 -0
- package/package.json +3 -5
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { getColorScale, getOrdinalColorScale } from '../internals/colorScale';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export const ZAxisContext = /*#__PURE__*/React.createContext({
|
|
7
|
+
zAxis: {},
|
|
8
|
+
zAxisIds: []
|
|
9
|
+
});
|
|
10
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11
|
+
ZAxisContext.displayName = 'ZAxisContext';
|
|
12
|
+
}
|
|
13
|
+
function ZAxisContextProvider(props) {
|
|
14
|
+
const {
|
|
15
|
+
zAxis: inZAxis,
|
|
16
|
+
dataset,
|
|
17
|
+
children
|
|
18
|
+
} = props;
|
|
19
|
+
const zAxis = React.useMemo(() => inZAxis?.map(axisConfig => {
|
|
20
|
+
const dataKey = axisConfig.dataKey;
|
|
21
|
+
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
22
|
+
return axisConfig;
|
|
23
|
+
}
|
|
24
|
+
if (dataset === undefined) {
|
|
25
|
+
throw Error('MUI X Charts: z-axis uses `dataKey` but no `dataset` is provided.');
|
|
26
|
+
}
|
|
27
|
+
return _extends({}, axisConfig, {
|
|
28
|
+
data: dataset.map(d => d[dataKey])
|
|
29
|
+
});
|
|
30
|
+
}), [inZAxis, dataset]);
|
|
31
|
+
const value = React.useMemo(() => {
|
|
32
|
+
const allZAxis = zAxis?.map((axis, index) => _extends({
|
|
33
|
+
id: `defaultized-z-axis-${index}`
|
|
34
|
+
}, axis)) ?? [];
|
|
35
|
+
const completedZAxis = {};
|
|
36
|
+
allZAxis.forEach(axis => {
|
|
37
|
+
completedZAxis[axis.id] = _extends({}, axis, {
|
|
38
|
+
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' && axis.data ? getOrdinalColorScale(_extends({
|
|
39
|
+
values: axis.data
|
|
40
|
+
}, axis.colorMap)) : getColorScale(axis.colorMap))
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
zAxis: completedZAxis,
|
|
45
|
+
zAxisIds: allZAxis.map(({
|
|
46
|
+
id
|
|
47
|
+
}) => id)
|
|
48
|
+
};
|
|
49
|
+
}, [zAxis]);
|
|
50
|
+
return /*#__PURE__*/_jsx(ZAxisContext.Provider, {
|
|
51
|
+
value: value,
|
|
52
|
+
children: children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
process.env.NODE_ENV !== "production" ? ZAxisContextProvider.propTypes = {
|
|
56
|
+
// ----------------------------- Warning --------------------------------
|
|
57
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
58
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
59
|
+
// ----------------------------------------------------------------------
|
|
60
|
+
children: PropTypes.node,
|
|
61
|
+
/**
|
|
62
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
63
|
+
*/
|
|
64
|
+
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
65
|
+
/**
|
|
66
|
+
* The configuration of the z-axes.
|
|
67
|
+
*/
|
|
68
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
69
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
70
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
71
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
72
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
73
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
74
|
+
}), PropTypes.shape({
|
|
75
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
76
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
77
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
78
|
+
}), PropTypes.shape({
|
|
79
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
80
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
81
|
+
unknownColor: PropTypes.string,
|
|
82
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
83
|
+
})]),
|
|
84
|
+
data: PropTypes.array,
|
|
85
|
+
dataKey: PropTypes.string,
|
|
86
|
+
id: PropTypes.string
|
|
87
|
+
}))
|
|
88
|
+
} : void 0;
|
|
89
|
+
export { ZAxisContextProvider };
|
package/esm/context/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { ZAxisContextProvider } from './ZAxisContextProvider';
|
|
@@ -2,7 +2,7 @@ import getBarColor from '../BarChart/getColor';
|
|
|
2
2
|
import getLineColor from '../LineChart/getColor';
|
|
3
3
|
import getScatterColor from '../ScatterChart/getColor';
|
|
4
4
|
import getPieColor from '../PieChart/getColor';
|
|
5
|
-
function getColor(series, xAxis, yAxis) {
|
|
5
|
+
function getColor(series, xAxis, yAxis, zAxis) {
|
|
6
6
|
if (xAxis !== undefined && yAxis !== undefined) {
|
|
7
7
|
if (series.type === 'bar') {
|
|
8
8
|
return getBarColor(series, xAxis, yAxis);
|
|
@@ -11,7 +11,7 @@ function getColor(series, xAxis, yAxis) {
|
|
|
11
11
|
return getLineColor(series, xAxis, yAxis);
|
|
12
12
|
}
|
|
13
13
|
if (series.type === 'scatter') {
|
|
14
|
-
return getScatterColor(series, xAxis, yAxis);
|
|
14
|
+
return getScatterColor(series, xAxis, yAxis, zAxis);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
if (series.type === 'pie') {
|
|
@@ -4,8 +4,7 @@ import { DrawingContext } from '../../../context/DrawingProvider';
|
|
|
4
4
|
import { useDrawingArea } from '../../../hooks';
|
|
5
5
|
import ChartsPiecewiseGradient from './ChartsPiecewiseGradient';
|
|
6
6
|
import ChartsContinuousGradient from './ChartsContinuousGradient';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
export function useChartGradient() {
|
|
10
9
|
const {
|
|
11
10
|
chartId
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
3
|
export default function ChartsPiecewiseGradient(props) {
|
|
5
4
|
const {
|
|
6
5
|
isReveresed,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/hooks/useAxisEvents.js
CHANGED
|
@@ -12,7 +12,7 @@ var _utils = require("../internals/utils");
|
|
|
12
12
|
var _useSvgRef = require("./useSvgRef");
|
|
13
13
|
var _useDrawingArea = require("./useDrawingArea");
|
|
14
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 &&
|
|
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
16
|
function getAsANumber(value) {
|
|
17
17
|
return value instanceof Date ? value.getTime() : value;
|
|
18
18
|
}
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _constants = require("../constants");
|
|
11
11
|
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); }
|
|
12
|
-
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 &&
|
|
12
|
+
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; }
|
|
13
13
|
const useChartDimensions = (width, height, margin) => {
|
|
14
14
|
const defaultizedMargin = (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, margin);
|
|
15
15
|
const drawingArea = React.useMemo(() => ({
|
package/hooks/useChartId.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.useChartId = useChartId;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
9
9
|
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); }
|
|
10
|
-
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 &&
|
|
10
|
+
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; }
|
|
11
11
|
function useChartId() {
|
|
12
12
|
const {
|
|
13
13
|
chartId
|
package/hooks/useDrawingArea.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.useDrawingArea = useDrawingArea;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
9
9
|
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); }
|
|
10
|
-
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 &&
|
|
10
|
+
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; }
|
|
11
11
|
function useDrawingArea() {
|
|
12
12
|
const {
|
|
13
13
|
left,
|
|
@@ -8,7 +8,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
9
9
|
var _HighlightProvider = require("../context/HighlightProvider");
|
|
10
10
|
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); }
|
|
11
|
-
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 &&
|
|
11
|
+
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; }
|
|
12
12
|
const useInteractionItemProps = (scope, skip) => {
|
|
13
13
|
const {
|
|
14
14
|
dispatch: dispatchInteraction
|
package/hooks/useMounted.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.useMounted = useMounted;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
10
10
|
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); }
|
|
11
|
-
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 &&
|
|
11
|
+
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; }
|
|
12
12
|
function useMounted(defer = false) {
|
|
13
13
|
const [mountedState, setMountedState] = React.useState(false);
|
|
14
14
|
(0, _useEnhancedEffect.default)(() => {
|
package/hooks/useScale.js
CHANGED
|
@@ -10,7 +10,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
11
11
|
var _isBandScale = require("../internals/isBandScale");
|
|
12
12
|
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); }
|
|
13
|
-
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 &&
|
|
13
|
+
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; }
|
|
14
14
|
/**
|
|
15
15
|
* For a given scale return a function that map value to their position.
|
|
16
16
|
* Usefull when dealing with specific scale such as band.
|
package/hooks/useSeries.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.useSeries = useSeries;
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
13
13
|
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); }
|
|
14
|
-
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 &&
|
|
14
|
+
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; }
|
|
15
15
|
/**
|
|
16
16
|
* Get access to the internal state of series.
|
|
17
17
|
* Structured by type of series:
|
package/hooks/useSvgRef.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.useSvgRef = useSvgRef;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
9
9
|
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); }
|
|
10
|
-
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 &&
|
|
10
|
+
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; }
|
|
11
11
|
function useSvgRef() {
|
|
12
12
|
const svgRef = React.useContext(_DrawingProvider.SvgContext);
|
|
13
13
|
if (svgRef === undefined) {
|
package/hooks/useTicks.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.useTicks = useTicks;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _isBandScale = require("../internals/isBandScale");
|
|
10
10
|
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); }
|
|
11
|
-
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 &&
|
|
11
|
+
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; }
|
|
12
12
|
function getTickNumber(params) {
|
|
13
13
|
const {
|
|
14
14
|
tickMaxStep,
|
package/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DefaultizedBarSeriesType, DefaultizedLineSeriesType, DefaultizedPieSeriesType, DefaultizedScatterSeriesType } from '../models';
|
|
2
2
|
import { AxisDefaultized } from '../models/axis';
|
|
3
|
+
import { ZAxisDefaultized } from '../models/z-axis';
|
|
3
4
|
declare function getColor(series: DefaultizedPieSeriesType): (dataIndex: number) => string;
|
|
4
|
-
declare function getColor(series: DefaultizedBarSeriesType | DefaultizedLineSeriesType
|
|
5
|
+
declare function getColor(series: DefaultizedBarSeriesType | DefaultizedLineSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized): (dataIndex: number) => string;
|
|
6
|
+
declare function getColor(series: DefaultizedScatterSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized, zAxis?: ZAxisDefaultized): (dataIndex: number) => string;
|
|
5
7
|
export default getColor;
|
package/internals/colorGetter.js
CHANGED
|
@@ -9,7 +9,7 @@ var _getColor = _interopRequireDefault(require("../BarChart/getColor"));
|
|
|
9
9
|
var _getColor2 = _interopRequireDefault(require("../LineChart/getColor"));
|
|
10
10
|
var _getColor3 = _interopRequireDefault(require("../ScatterChart/getColor"));
|
|
11
11
|
var _getColor4 = _interopRequireDefault(require("../PieChart/getColor"));
|
|
12
|
-
function getColor(series, xAxis, yAxis) {
|
|
12
|
+
function getColor(series, xAxis, yAxis, zAxis) {
|
|
13
13
|
if (xAxis !== undefined && yAxis !== undefined) {
|
|
14
14
|
if (series.type === 'bar') {
|
|
15
15
|
return (0, _getColor.default)(series, xAxis, yAxis);
|
|
@@ -18,7 +18,7 @@ function getColor(series, xAxis, yAxis) {
|
|
|
18
18
|
return (0, _getColor2.default)(series, xAxis, yAxis);
|
|
19
19
|
}
|
|
20
20
|
if (series.type === 'scatter') {
|
|
21
|
-
return (0, _getColor3.default)(series, xAxis, yAxis);
|
|
21
|
+
return (0, _getColor3.default)(series, xAxis, yAxis, zAxis);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
if (series.type === 'pie') {
|
|
@@ -14,7 +14,7 @@ var _ChartsPiecewiseGradient = _interopRequireDefault(require("./ChartsPiecewise
|
|
|
14
14
|
var _ChartsContinuousGradient = _interopRequireDefault(require("./ChartsContinuousGradient"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
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); }
|
|
17
|
-
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 &&
|
|
17
|
+
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; }
|
|
18
18
|
function useChartGradient() {
|
|
19
19
|
const {
|
|
20
20
|
chartId
|
|
@@ -8,7 +8,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _d3Interpolate = require("d3-interpolate");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
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); }
|
|
11
|
-
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 &&
|
|
11
|
+
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; }
|
|
12
12
|
const PX_PRECISION = 10;
|
|
13
13
|
function ChartsContinuousGradient(props) {
|
|
14
14
|
const {
|
|
@@ -7,7 +7,7 @@ exports.default = ChartsPiecewiseGradient;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
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); }
|
|
10
|
-
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 &&
|
|
10
|
+
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; }
|
|
11
11
|
function ChartsPiecewiseGradient(props) {
|
|
12
12
|
const {
|
|
13
13
|
isReveresed,
|
|
@@ -62,6 +62,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
62
62
|
markerSize?: number | undefined;
|
|
63
63
|
label?: string | undefined;
|
|
64
64
|
disableHover?: boolean | undefined;
|
|
65
|
+
zAxisKey?: string | undefined;
|
|
65
66
|
id?: import("../models/seriesType/common").SeriesId | undefined;
|
|
66
67
|
color: string;
|
|
67
68
|
valueFormatter?: import("../models/seriesType/common").SeriesValueFormatter<import("../models/seriesType").ScatterValueType> | undefined;
|
|
@@ -8,7 +8,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _d3Interpolate = require("d3-interpolate");
|
|
9
9
|
var _web = require("@react-spring/web");
|
|
10
10
|
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); }
|
|
11
|
-
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 &&
|
|
11
|
+
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; }
|
|
12
12
|
function usePrevious(value) {
|
|
13
13
|
const ref = React.useRef(null);
|
|
14
14
|
React.useEffect(() => {
|
package/models/colorMapping.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface ContinuousColorConfig<Value = number | Date> {
|
|
|
11
11
|
*/
|
|
12
12
|
max?: Value;
|
|
13
13
|
/**
|
|
14
|
-
* The colors to render.
|
|
14
|
+
* The colors to render. It can be an array with the extremum colors, or an interpolation function.
|
|
15
15
|
*/
|
|
16
16
|
color: [string, string] | ((t: number) => string);
|
|
17
17
|
}
|
|
@@ -23,7 +23,7 @@ export interface PiecewiseColorConfig<Value = number | Date> {
|
|
|
23
23
|
thresholds: Value[];
|
|
24
24
|
/**
|
|
25
25
|
* The colors used for each band defined by `thresholds`.
|
|
26
|
-
* Should contain N+1 colors
|
|
26
|
+
* Should contain N+1 colors, where N is the number of thresholds.
|
|
27
27
|
*/
|
|
28
28
|
colors: string[];
|
|
29
29
|
}
|
|
@@ -36,6 +36,7 @@ export interface OrdinalColorConfig<Value = number | Date | string> {
|
|
|
36
36
|
values?: Value[];
|
|
37
37
|
/**
|
|
38
38
|
* The color palette.
|
|
39
|
+
* Items equal to `values[k]` will get the color of `colors[k]`.
|
|
39
40
|
*/
|
|
40
41
|
colors: string[];
|
|
41
42
|
/**
|
|
@@ -60,6 +60,11 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
60
60
|
* @default 0
|
|
61
61
|
*/
|
|
62
62
|
paddingAngle?: number;
|
|
63
|
+
/**
|
|
64
|
+
* The sorting strategy used to order pie slices.
|
|
65
|
+
* Can be 'none', 'asc', 'desc', or a sorting function.
|
|
66
|
+
* @default 'none'
|
|
67
|
+
*/
|
|
63
68
|
sortingValues?: ChartsPieSorting;
|
|
64
69
|
/**
|
|
65
70
|
* The label displayed into the arc.
|
|
@@ -3,6 +3,7 @@ import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, SeriesId
|
|
|
3
3
|
export type ScatterValueType = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
|
+
z?: any;
|
|
6
7
|
/**
|
|
7
8
|
* A unique identifier for the scatter point
|
|
8
9
|
*/
|
|
@@ -18,6 +19,10 @@ export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType>, C
|
|
|
18
19
|
* @default false
|
|
19
20
|
*/
|
|
20
21
|
disableHover?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The id of the z-axis used to render the series.
|
|
24
|
+
*/
|
|
25
|
+
zAxisKey?: string;
|
|
21
26
|
}
|
|
22
27
|
/**
|
|
23
28
|
* An object that allows to identify a single scatter item.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ScaleOrdinal, ScaleSequential, ScaleThreshold } from 'd3-scale';
|
|
2
|
+
import { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from './colorMapping';
|
|
3
|
+
export interface ZAxisConfig<V = any> {
|
|
4
|
+
id: string;
|
|
5
|
+
data?: V[];
|
|
6
|
+
/**
|
|
7
|
+
* The key used to retrieve `data` from the `dataset` prop.
|
|
8
|
+
*/
|
|
9
|
+
dataKey?: string;
|
|
10
|
+
colorMap?: OrdinalColorConfig | ContinuousColorConfig | PiecewiseColorConfig;
|
|
11
|
+
}
|
|
12
|
+
export interface ZAxisDefaultized extends ZAxisConfig {
|
|
13
|
+
colorScale?: ScaleOrdinal<string | number | Date, string, string | null> | ScaleOrdinal<number, string, string | null> | ScaleSequential<string, string | null> | ScaleThreshold<number | Date, string | null>;
|
|
14
|
+
}
|
package/models/z-axis.js
ADDED
|
@@ -12,8 +12,7 @@ import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
|
12
12
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
13
13
|
import { ChartsGrid } from '../ChartsGrid';
|
|
14
14
|
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
/**
|
|
18
17
|
* Demos:
|
|
19
18
|
*
|
|
@@ -137,30 +136,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
137
136
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
138
137
|
* @default xAxisIds[0] The id of the first provided axis
|
|
139
138
|
*/
|
|
140
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.
|
|
141
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
142
|
-
classes: PropTypes.object,
|
|
143
|
-
disableLine: PropTypes.bool,
|
|
144
|
-
disableTicks: PropTypes.bool,
|
|
145
|
-
fill: PropTypes.string,
|
|
146
|
-
label: PropTypes.string,
|
|
147
|
-
labelFontSize: PropTypes.number,
|
|
148
|
-
labelStyle: PropTypes.object,
|
|
149
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
150
|
-
slotProps: PropTypes.object,
|
|
151
|
-
slots: PropTypes.object,
|
|
152
|
-
stroke: PropTypes.string,
|
|
153
|
-
tickFontSize: PropTypes.number,
|
|
154
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
155
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
156
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
157
|
-
tickLabelStyle: PropTypes.object,
|
|
158
|
-
tickMaxStep: PropTypes.number,
|
|
159
|
-
tickMinStep: PropTypes.number,
|
|
160
|
-
tickNumber: PropTypes.number,
|
|
161
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
162
|
-
tickSize: PropTypes.number
|
|
163
|
-
}), PropTypes.string]),
|
|
139
|
+
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
164
140
|
children: PropTypes.node,
|
|
165
141
|
className: PropTypes.string,
|
|
166
142
|
/**
|
|
@@ -200,30 +176,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
200
176
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
201
177
|
* @default yAxisIds[0] The id of the first provided axis
|
|
202
178
|
*/
|
|
203
|
-
leftAxis: PropTypes.oneOfType([PropTypes.
|
|
204
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
205
|
-
classes: PropTypes.object,
|
|
206
|
-
disableLine: PropTypes.bool,
|
|
207
|
-
disableTicks: PropTypes.bool,
|
|
208
|
-
fill: PropTypes.string,
|
|
209
|
-
label: PropTypes.string,
|
|
210
|
-
labelFontSize: PropTypes.number,
|
|
211
|
-
labelStyle: PropTypes.object,
|
|
212
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
213
|
-
slotProps: PropTypes.object,
|
|
214
|
-
slots: PropTypes.object,
|
|
215
|
-
stroke: PropTypes.string,
|
|
216
|
-
tickFontSize: PropTypes.number,
|
|
217
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
218
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
219
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
220
|
-
tickLabelStyle: PropTypes.object,
|
|
221
|
-
tickMaxStep: PropTypes.number,
|
|
222
|
-
tickMinStep: PropTypes.number,
|
|
223
|
-
tickNumber: PropTypes.number,
|
|
224
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
225
|
-
tickSize: PropTypes.number
|
|
226
|
-
}), PropTypes.string]),
|
|
179
|
+
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
227
180
|
/**
|
|
228
181
|
* @deprecated Consider using `slotProps.legend` instead.
|
|
229
182
|
*/
|
|
@@ -268,32 +221,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
268
221
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
269
222
|
* @default null
|
|
270
223
|
*/
|
|
271
|
-
rightAxis: PropTypes.oneOfType([PropTypes.
|
|
272
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
273
|
-
classes: PropTypes.object,
|
|
274
|
-
disableLine: PropTypes.bool,
|
|
275
|
-
disableTicks: PropTypes.bool,
|
|
276
|
-
fill: PropTypes.string,
|
|
277
|
-
label: PropTypes.string,
|
|
278
|
-
labelFontSize: PropTypes.number,
|
|
279
|
-
labelStyle: PropTypes.object,
|
|
280
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
281
|
-
slotProps: PropTypes.object,
|
|
282
|
-
slots: PropTypes.object,
|
|
283
|
-
stroke: PropTypes.string,
|
|
284
|
-
tickFontSize: PropTypes.number,
|
|
285
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
286
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
287
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
288
|
-
tickLabelStyle: PropTypes.object,
|
|
289
|
-
tickMaxStep: PropTypes.number,
|
|
290
|
-
tickMinStep: PropTypes.number,
|
|
291
|
-
tickNumber: PropTypes.number,
|
|
292
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
293
|
-
tickSize: PropTypes.number
|
|
294
|
-
}), PropTypes.string]),
|
|
224
|
+
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
295
225
|
/**
|
|
296
226
|
* The series to display in the bar chart.
|
|
227
|
+
* An array of [[BarSeriesType]] objects.
|
|
297
228
|
*/
|
|
298
229
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
299
230
|
/**
|
|
@@ -330,30 +261,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
330
261
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
331
262
|
* @default null
|
|
332
263
|
*/
|
|
333
|
-
topAxis: PropTypes.oneOfType([PropTypes.
|
|
334
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
335
|
-
classes: PropTypes.object,
|
|
336
|
-
disableLine: PropTypes.bool,
|
|
337
|
-
disableTicks: PropTypes.bool,
|
|
338
|
-
fill: PropTypes.string,
|
|
339
|
-
label: PropTypes.string,
|
|
340
|
-
labelFontSize: PropTypes.number,
|
|
341
|
-
labelStyle: PropTypes.object,
|
|
342
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
343
|
-
slotProps: PropTypes.object,
|
|
344
|
-
slots: PropTypes.object,
|
|
345
|
-
stroke: PropTypes.string,
|
|
346
|
-
tickFontSize: PropTypes.number,
|
|
347
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
348
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
349
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
350
|
-
tickLabelStyle: PropTypes.object,
|
|
351
|
-
tickMaxStep: PropTypes.number,
|
|
352
|
-
tickMinStep: PropTypes.number,
|
|
353
|
-
tickNumber: PropTypes.number,
|
|
354
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
355
|
-
tickSize: PropTypes.number
|
|
356
|
-
}), PropTypes.string]),
|
|
264
|
+
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
357
265
|
viewBox: PropTypes.shape({
|
|
358
266
|
height: PropTypes.number,
|
|
359
267
|
width: PropTypes.number,
|
|
@@ -367,6 +275,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
367
275
|
/**
|
|
368
276
|
* The configuration of the x-axes.
|
|
369
277
|
* If not provided, a default axis config is used.
|
|
278
|
+
* An array of [[AxisConfig]] objects.
|
|
370
279
|
*/
|
|
371
280
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
372
281
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -419,6 +328,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
419
328
|
/**
|
|
420
329
|
* The configuration of the y-axes.
|
|
421
330
|
* If not provided, a default axis config is used.
|
|
331
|
+
* An array of [[AxisConfig]] objects.
|
|
422
332
|
*/
|
|
423
333
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
424
334
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -35,7 +35,6 @@ export const BarElementPath = styled(animated.rect, {
|
|
|
35
35
|
ownerState
|
|
36
36
|
}) => ({
|
|
37
37
|
stroke: 'none',
|
|
38
|
-
shapeRendering: 'crispEdges',
|
|
39
38
|
fill: ownerState.isHighlighted ? d3Color(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
|
|
40
39
|
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
41
40
|
opacity: ownerState.isFaded && 0.3 || 1
|
|
@@ -109,8 +109,8 @@ const useAggregatedData = () => {
|
|
|
109
109
|
} = series[seriesId];
|
|
110
110
|
return stackedData.map((values, dataIndex) => {
|
|
111
111
|
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
112
|
-
const minValueCoord = Math.min(...valueCoordinates);
|
|
113
|
-
const maxValueCoord = Math.max(...valueCoordinates);
|
|
112
|
+
const minValueCoord = Math.round(Math.min(...valueCoordinates));
|
|
113
|
+
const maxValueCoord = Math.round(Math.max(...valueCoordinates));
|
|
114
114
|
return {
|
|
115
115
|
seriesId,
|
|
116
116
|
dataIndex,
|