@mui/x-charts 7.6.1 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +1 -1
- package/BarChart/BarChart.js +2 -2
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/formatter.js +2 -2
- package/BarChart/getColor.d.ts +1 -1
- package/BarChart/getColor.js +4 -4
- package/BarChart/plugin.d.ts +2 -0
- package/BarChart/plugin.js +17 -0
- package/CHANGELOG.md +147 -0
- package/ChartContainer/ChartContainer.d.ts +15 -3
- package/ChartContainer/ChartContainer.js +70 -22
- package/ChartContainer/defaultPlugins.d.ts +2 -0
- package/ChartContainer/defaultPlugins.js +11 -0
- package/ChartContainer/usePluginsMerge.d.ts +10 -0
- package/ChartContainer/usePluginsMerge.js +39 -0
- package/ChartsLegend/ChartsLegend.js +2 -2
- package/ChartsLegend/utils.js +4 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
- 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 +9 -15
- package/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +5 -4
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/utils.d.ts +1 -7
- package/ChartsTooltip/utils.js +2 -10
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +17 -19
- package/ChartsYAxis/ChartsYAxis.js +17 -19
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +3 -3
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/formatter.js +2 -2
- package/LineChart/getColor.d.ts +1 -1
- package/LineChart/getColor.js +2 -2
- package/LineChart/plugin.d.ts +2 -0
- package/LineChart/plugin.js +17 -0
- package/PieChart/PieChart.d.ts +2 -2
- package/PieChart/PieChart.js +3 -3
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/plugin.d.ts +2 -0
- package/PieChart/plugin.js +14 -0
- package/ResponsiveChartContainer/ResizableContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResizableContainer.js +32 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +32 -24
- package/ScatterChart/ScatterChart.d.ts +2 -2
- package/ScatterChart/ScatterChart.js +3 -3
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/formatter.js +2 -3
- package/ScatterChart/getColor.d.ts +1 -1
- package/ScatterChart/getColor.js +2 -2
- package/ScatterChart/plugin.d.ts +2 -0
- package/ScatterChart/plugin.js +17 -0
- package/SparkLineChart/SparkLineChart.d.ts +9 -4
- package/SparkLineChart/SparkLineChart.js +58 -2
- package/context/CartesianContextProvider.d.ts +21 -10
- package/context/CartesianContextProvider.js +7 -20
- package/context/ColorProvider.d.ts +12 -0
- package/context/ColorProvider.js +25 -0
- package/context/DrawingProvider.d.ts +3 -1
- package/context/DrawingProvider.js +9 -2
- package/context/HighlightedProvider/HighlightedContext.d.ts +2 -1
- package/context/HighlightedProvider/HighlightedContext.js +8 -5
- package/context/HighlightedProvider/HighlightedProvider.js +15 -12
- package/context/HighlightedProvider/useHighlighted.js +6 -3
- package/context/HighlightedProvider/useItemHighlighted.js +2 -8
- package/context/SeriesContextProvider.d.ts +16 -5
- package/context/SeriesContextProvider.js +14 -17
- package/context/context.types.d.ts +4 -0
- package/context/context.types.js +5 -0
- package/esm/BarChart/BarChart.js +2 -2
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/BarChart/formatter.js +1 -1
- package/esm/BarChart/getColor.js +4 -4
- package/esm/BarChart/plugin.js +10 -0
- package/esm/ChartContainer/ChartContainer.js +71 -23
- package/esm/ChartContainer/defaultPlugins.js +5 -0
- package/esm/ChartContainer/usePluginsMerge.js +31 -0
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/utils.js +4 -1
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
- 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 +5 -4
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/utils.js +2 -8
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +17 -19
- package/esm/ChartsYAxis/ChartsYAxis.js +17 -19
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +3 -3
- package/esm/LineChart/LineHighlightPlot.js +2 -2
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +2 -2
- package/esm/LineChart/formatter.js +1 -1
- package/esm/LineChart/getColor.js +2 -2
- package/esm/LineChart/plugin.js +10 -0
- package/esm/PieChart/PieChart.js +3 -3
- package/esm/PieChart/PiePlot.js +2 -2
- package/esm/PieChart/plugin.js +7 -0
- package/esm/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +31 -23
- package/esm/ScatterChart/ScatterChart.js +3 -3
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/formatter.js +1 -1
- package/esm/ScatterChart/getColor.js +2 -2
- package/esm/ScatterChart/plugin.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +58 -2
- package/esm/context/CartesianContextProvider.js +7 -20
- package/esm/context/ColorProvider.js +16 -0
- package/esm/context/DrawingProvider.js +9 -2
- package/esm/context/HighlightedProvider/HighlightedContext.js +8 -5
- package/esm/context/HighlightedProvider/HighlightedProvider.js +15 -12
- package/esm/context/HighlightedProvider/useHighlighted.js +6 -3
- package/esm/context/HighlightedProvider/useItemHighlighted.js +2 -6
- package/esm/context/SeriesContextProvider.js +14 -17
- package/esm/context/context.types.js +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useColor.js +9 -0
- package/esm/hooks/useColorScale.js +27 -0
- package/esm/hooks/useInteractionItemProps.js +2 -2
- package/esm/hooks/useReducedMotion.js +7 -0
- package/esm/hooks/useSeries.js +6 -3
- package/esm/hooks/useSvgRef.js +6 -3
- package/esm/internals/configInit.js +20 -0
- package/esm/internals/defaultizeValueFormatter.js +2 -3
- package/esm/internals/index.js +27 -0
- package/esm/internals/isCartesian.js +7 -0
- package/esm/internals/warning.js +13 -0
- package/esm/models/index.js +1 -0
- package/esm/models/plugin.js +1 -0
- package/esm/models/seriesType/index.js +6 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- 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/useInteractionItemProps.js +1 -1
- package/hooks/useReducedMotion.js +7 -0
- package/hooks/useSeries.d.ts +6 -11
- package/hooks/useSeries.js +6 -3
- package/hooks/useSvgRef.js +6 -3
- package/hooks/useTicks.d.ts +4 -2
- package/index.js +1 -1
- package/internals/configInit.d.ts +9 -0
- package/internals/configInit.js +26 -0
- package/internals/defaultizeColor.d.ts +8 -8
- package/internals/defaultizeValueFormatter.d.ts +1 -2
- package/internals/defaultizeValueFormatter.js +2 -3
- package/internals/index.d.ts +17 -0
- package/internals/index.js +203 -0
- package/internals/isCartesian.d.ts +7 -0
- package/internals/isCartesian.js +14 -0
- package/internals/package.json +6 -0
- package/internals/warning.d.ts +1 -0
- package/internals/warning.js +19 -0
- package/models/axis.d.ts +4 -5
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/plugin.d.ts +16 -0
- package/models/plugin.js +5 -0
- package/models/seriesType/config.d.ts +30 -5
- package/models/seriesType/index.d.ts +8 -11
- package/models/seriesType/index.js +6 -0
- package/modern/BarChart/BarChart.js +2 -2
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/BarChart/formatter.js +1 -1
- package/modern/BarChart/getColor.js +4 -4
- package/modern/BarChart/plugin.js +10 -0
- package/modern/ChartContainer/ChartContainer.js +71 -23
- package/modern/ChartContainer/defaultPlugins.js +5 -0
- package/modern/ChartContainer/usePluginsMerge.js +31 -0
- package/modern/ChartsLegend/ChartsLegend.js +2 -2
- package/modern/ChartsLegend/utils.js +4 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
- 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 +5 -4
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/utils.js +2 -8
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +17 -19
- package/modern/ChartsYAxis/ChartsYAxis.js +17 -19
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +3 -3
- package/modern/LineChart/LineHighlightPlot.js +2 -2
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +2 -2
- package/modern/LineChart/formatter.js +1 -1
- package/modern/LineChart/getColor.js +2 -2
- package/modern/LineChart/plugin.js +10 -0
- package/modern/PieChart/PieChart.js +3 -3
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/PieChart/plugin.js +7 -0
- package/modern/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +31 -23
- package/modern/ScatterChart/ScatterChart.js +3 -3
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/formatter.js +1 -1
- package/modern/ScatterChart/getColor.js +2 -2
- package/modern/ScatterChart/plugin.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +58 -2
- package/modern/context/CartesianContextProvider.js +7 -20
- package/modern/context/ColorProvider.js +16 -0
- package/modern/context/DrawingProvider.js +9 -2
- package/modern/context/HighlightedProvider/HighlightedContext.js +8 -5
- package/modern/context/HighlightedProvider/HighlightedProvider.js +15 -12
- package/modern/context/HighlightedProvider/useHighlighted.js +6 -3
- package/modern/context/HighlightedProvider/useItemHighlighted.js +2 -6
- package/modern/context/SeriesContextProvider.js +14 -17
- package/modern/context/context.types.js +1 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useColor.js +9 -0
- package/modern/hooks/useColorScale.js +27 -0
- package/modern/hooks/useInteractionItemProps.js +2 -2
- package/modern/hooks/useReducedMotion.js +7 -0
- package/modern/hooks/useSeries.js +6 -3
- package/modern/hooks/useSvgRef.js +6 -3
- package/modern/index.js +1 -1
- package/modern/internals/configInit.js +20 -0
- package/modern/internals/defaultizeValueFormatter.js +2 -3
- package/modern/internals/index.js +27 -0
- package/modern/internals/isCartesian.js +7 -0
- package/modern/internals/warning.js +13 -0
- package/modern/models/index.js +1 -0
- package/modern/models/plugin.js +1 -0
- package/modern/models/seriesType/index.js +6 -0
- package/package.json +2 -2
- package/themeAugmentation/components.d.ts +12 -12
- package/esm/internals/colorGetter.js +0 -22
- package/internals/colorGetter.d.ts +0 -7
- package/internals/colorGetter.js +0 -29
- package/modern/internals/colorGetter.js +0 -22
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let instance;
|
|
2
|
+
class CartesianSeriesTypes {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.types = new Set();
|
|
5
|
+
if (instance) {
|
|
6
|
+
throw new Error('You can only create one instance!');
|
|
7
|
+
}
|
|
8
|
+
instance = this.types;
|
|
9
|
+
}
|
|
10
|
+
addType(value) {
|
|
11
|
+
this.types.add(value);
|
|
12
|
+
}
|
|
13
|
+
getTypes() {
|
|
14
|
+
return this.types;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const cartesianSeriesTypes = new CartesianSeriesTypes();
|
|
18
|
+
cartesianSeriesTypes.addType('bar');
|
|
19
|
+
cartesianSeriesTypes.addType('line');
|
|
20
|
+
cartesianSeriesTypes.addType('scatter');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
2
|
+
export function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
3
3
|
const defaultizedSeries = {};
|
|
4
4
|
Object.keys(series).forEach(seriesId => {
|
|
5
5
|
defaultizedSeries[seriesId] = _extends({}, series[seriesId], {
|
|
@@ -7,5 +7,4 @@ function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
return defaultizedSeries;
|
|
10
|
-
}
|
|
11
|
-
export default defaultizeValueFormatter;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Components
|
|
2
|
+
export * from './components/ChartsAxesGradients';
|
|
3
|
+
export * from '../ResponsiveChartContainer/useChartContainerDimensions';
|
|
4
|
+
export * from '../ResponsiveChartContainer/ResizableContainer';
|
|
5
|
+
|
|
6
|
+
// hooks
|
|
7
|
+
export { useReducedMotion } from '../hooks/useReducedMotion';
|
|
8
|
+
export { useSeries } from '../hooks/useSeries';
|
|
9
|
+
|
|
10
|
+
// utils
|
|
11
|
+
export * from './defaultizeValueFormatter';
|
|
12
|
+
export * from './configInit';
|
|
13
|
+
|
|
14
|
+
// contexts
|
|
15
|
+
|
|
16
|
+
export * from '../context/CartesianContextProvider';
|
|
17
|
+
export * from '../context/DrawingProvider';
|
|
18
|
+
export * from '../context/InteractionProvider';
|
|
19
|
+
export * from '../context/SeriesContextProvider';
|
|
20
|
+
export * from '../context/ZAxisContextProvider';
|
|
21
|
+
|
|
22
|
+
// series configuration
|
|
23
|
+
export * from '../models/seriesType/config';
|
|
24
|
+
export * from '../models/seriesType/common';
|
|
25
|
+
export * from '../models/helpers';
|
|
26
|
+
export * from '../models/z-axis';
|
|
27
|
+
export * from '../models/axis';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function buildWarning(message, gravity = 'warning') {
|
|
2
|
+
let alreadyWarned = false;
|
|
3
|
+
return (...args) => {
|
|
4
|
+
if (!alreadyWarned) {
|
|
5
|
+
alreadyWarned = true;
|
|
6
|
+
if (gravity === 'error') {
|
|
7
|
+
console.error(message(...args));
|
|
8
|
+
} else {
|
|
9
|
+
console.warn(message(...args));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
package/esm/models/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
// Series definition
|
|
2
|
+
|
|
3
|
+
// item identifier
|
|
4
|
+
|
|
1
5
|
export * from './line';
|
|
2
6
|
export * from './bar';
|
|
3
7
|
export * from './scatter';
|
|
4
8
|
export * from './pie';
|
|
9
|
+
// Helpers
|
|
10
|
+
|
|
5
11
|
export function isDefaultizedBarSeries(series) {
|
|
6
12
|
return series.type === 'bar';
|
|
7
13
|
}
|
package/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './useDrawingArea';
|
|
2
2
|
export * from './useChartId';
|
|
3
3
|
export * from './useScale';
|
|
4
|
+
export * from './useColorScale';
|
|
4
5
|
export * from './useSvgRef';
|
|
5
6
|
export { useSeries as unstable_useSeries, usePieSeries as unstable_usePieSeries, useLineSeries as unstable_useLineSeries, useBarSeries as unstable_useBarSeries, useScatterSeries as unstable_useScatterSeries, } from './useSeries';
|
package/hooks/index.js
CHANGED
|
@@ -76,6 +76,18 @@ Object.keys(_useScale).forEach(function (key) {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
|
+
var _useColorScale = require("./useColorScale");
|
|
80
|
+
Object.keys(_useColorScale).forEach(function (key) {
|
|
81
|
+
if (key === "default" || key === "__esModule") return;
|
|
82
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
83
|
+
if (key in exports && exports[key] === _useColorScale[key]) return;
|
|
84
|
+
Object.defineProperty(exports, key, {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _useColorScale[key];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
79
91
|
var _useSvgRef = require("./useSvgRef");
|
|
80
92
|
Object.keys(_useSvgRef).forEach(function (key) {
|
|
81
93
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChartSeriesType } from '../internals';
|
|
2
|
+
import { ColorProcessorsConfig } from '../models/plugin';
|
|
3
|
+
export declare function useColorProcessor<T extends ChartSeriesType>(seriesType: T): ColorProcessorsConfig<ChartSeriesType>;
|
|
4
|
+
export declare function useColorProcessor(): ColorProcessorsConfig<ChartSeriesType>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useColorProcessor = useColorProcessor;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _ColorProvider = require("../context/ColorProvider");
|
|
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 && {}.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
|
+
function useColorProcessor(seriesType) {
|
|
12
|
+
const colorProcessors = React.useContext(_ColorProvider.ColorContext);
|
|
13
|
+
if (!seriesType) {
|
|
14
|
+
return colorProcessors;
|
|
15
|
+
}
|
|
16
|
+
return colorProcessors[seriesType];
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AxisScaleComputedConfig, ScaleName } from '../models/axis';
|
|
2
|
+
export declare function useXColorScale<S extends ScaleName>(identifier?: number | string): AxisScaleComputedConfig[S]['colorScale'] | undefined;
|
|
3
|
+
export declare function useYColorScale<S extends ScaleName>(identifier?: number | string): AxisScaleComputedConfig[S]['colorScale'] | undefined;
|
|
4
|
+
export declare function useZColorScale<S extends ScaleName>(identifier?: number | string): AxisScaleComputedConfig[S]['colorScale'] | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useXColorScale = useXColorScale;
|
|
7
|
+
exports.useYColorScale = useYColorScale;
|
|
8
|
+
exports.useZColorScale = useZColorScale;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
11
|
+
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
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 && {}.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
|
+
function useXColorScale(identifier) {
|
|
15
|
+
const {
|
|
16
|
+
xAxis,
|
|
17
|
+
xAxisIds
|
|
18
|
+
} = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
19
|
+
const id = typeof identifier === 'string' ? identifier : xAxisIds[identifier ?? 0];
|
|
20
|
+
return xAxis[id].colorScale;
|
|
21
|
+
}
|
|
22
|
+
function useYColorScale(identifier) {
|
|
23
|
+
const {
|
|
24
|
+
yAxis,
|
|
25
|
+
yAxisIds
|
|
26
|
+
} = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
27
|
+
const id = typeof identifier === 'string' ? identifier : yAxisIds[identifier ?? 0];
|
|
28
|
+
return yAxis[id].colorScale;
|
|
29
|
+
}
|
|
30
|
+
function useZColorScale(identifier) {
|
|
31
|
+
const {
|
|
32
|
+
zAxis,
|
|
33
|
+
zAxisIds
|
|
34
|
+
} = React.useContext(_ZAxisContextProvider.ZAxisContext);
|
|
35
|
+
const id = typeof identifier === 'string' ? identifier : zAxisIds[identifier ?? 0];
|
|
36
|
+
return zAxis[id]?.colorScale;
|
|
37
|
+
}
|
|
@@ -16,6 +16,13 @@ const useReducedMotion = () => {
|
|
|
16
16
|
// Taken from: https://github.com/pmndrs/react-spring/blob/02ec877bbfab0df46da0e4a47d5f68d3e731206a/packages/shared/src/hooks/useReducedMotion.ts#L13
|
|
17
17
|
|
|
18
18
|
(0, _web.useIsomorphicLayoutEffect)(() => {
|
|
19
|
+
if (!window.matchMedia) {
|
|
20
|
+
// skip animation in environments where `window.matchMedia` would not be available (i.e. test/jsdom)
|
|
21
|
+
_web.Globals.assign({
|
|
22
|
+
skipAnimation: true
|
|
23
|
+
});
|
|
24
|
+
return () => {};
|
|
25
|
+
}
|
|
19
26
|
const mql = window.matchMedia('(prefers-reduced-motion)');
|
|
20
27
|
const handleMediaChange = e => {
|
|
21
28
|
_web.Globals.assign({
|
package/hooks/useSeries.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { FormattedSeries } from '../context/SeriesContextProvider';
|
|
1
2
|
/**
|
|
2
3
|
* Get access to the internal state of series.
|
|
3
4
|
* Structured by type of series:
|
|
4
5
|
* { seriesType?: { series: { id1: precessedValue, ... }, seriesOrder: [id1, ...] } }
|
|
5
6
|
* @returns FormattedSeries series
|
|
6
7
|
*/
|
|
7
|
-
export declare function useSeries():
|
|
8
|
+
export declare function useSeries(): FormattedSeries;
|
|
8
9
|
/**
|
|
9
10
|
* Get access to the internal state of pie series.
|
|
10
11
|
* The returned object contains:
|
|
@@ -12,10 +13,7 @@ export declare function useSeries(): import("../context/SeriesContextProvider").
|
|
|
12
13
|
* - seriesOrder: the array of series ids.
|
|
13
14
|
* @returns { series: Record<SeriesId, DefaultizedPieSeriesType>; seriesOrder: SeriesId[]; } | undefined pieSeries
|
|
14
15
|
*/
|
|
15
|
-
export declare function usePieSeries():
|
|
16
|
-
series: Record<import("../models/seriesType/common").SeriesId, import("..").DefaultizedPieSeriesType>;
|
|
17
|
-
seriesOrder: import("../models/seriesType/common").SeriesId[];
|
|
18
|
-
} | undefined;
|
|
16
|
+
export declare function usePieSeries(): FormattedSeries['pie'];
|
|
19
17
|
/**
|
|
20
18
|
* Get access to the internal state of line series.
|
|
21
19
|
* The returned object contains:
|
|
@@ -23,7 +21,7 @@ export declare function usePieSeries(): {
|
|
|
23
21
|
* - seriesOrder: the array of series ids.
|
|
24
22
|
* @returns { series: Record<SeriesId, DefaultizedLineSeriesType>; seriesOrder: SeriesId[]; } | undefined lineSeries
|
|
25
23
|
*/
|
|
26
|
-
export declare function useLineSeries():
|
|
24
|
+
export declare function useLineSeries(): FormattedSeries['line'];
|
|
27
25
|
/**
|
|
28
26
|
* Get access to the internal state of bar series.
|
|
29
27
|
* The returned object contains:
|
|
@@ -31,7 +29,7 @@ export declare function useLineSeries(): import("../models/seriesType/config").F
|
|
|
31
29
|
* - seriesOrder: the array of series ids.
|
|
32
30
|
* @returns { series: Record<SeriesId, DefaultizedBarSeriesType>; seriesOrder: SeriesId[]; } | undefined barSeries
|
|
33
31
|
*/
|
|
34
|
-
export declare function useBarSeries():
|
|
32
|
+
export declare function useBarSeries(): FormattedSeries['bar'];
|
|
35
33
|
/**
|
|
36
34
|
* Get access to the internal state of scatter series.
|
|
37
35
|
* The returned object contains:
|
|
@@ -39,7 +37,4 @@ export declare function useBarSeries(): import("../models/seriesType/config").Fo
|
|
|
39
37
|
* - seriesOrder: the array of series ids.
|
|
40
38
|
* @returns { series: Record<SeriesId, DefaultizedScatterSeriesType>; seriesOrder: SeriesId[]; } | undefined scatterSeries
|
|
41
39
|
*/
|
|
42
|
-
export declare function useScatterSeries():
|
|
43
|
-
series: Record<import("../models/seriesType/common").SeriesId, import("..").DefaultizedScatterSeriesType>;
|
|
44
|
-
seriesOrder: import("../models/seriesType/common").SeriesId[];
|
|
45
|
-
} | undefined;
|
|
40
|
+
export declare function useScatterSeries(): FormattedSeries['scatter'];
|
package/hooks/useSeries.js
CHANGED
|
@@ -19,11 +19,14 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
19
19
|
* @returns FormattedSeries series
|
|
20
20
|
*/
|
|
21
21
|
function useSeries() {
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const {
|
|
23
|
+
isInitialized,
|
|
24
|
+
data
|
|
25
|
+
} = React.useContext(_SeriesContextProvider.SeriesContext);
|
|
26
|
+
if (!isInitialized) {
|
|
24
27
|
throw new Error(['MUI X: Could not find the series ref context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
25
28
|
}
|
|
26
|
-
return
|
|
29
|
+
return data;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
/**
|
package/hooks/useSvgRef.js
CHANGED
|
@@ -9,9 +9,12 @@ 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
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
|
-
const
|
|
13
|
-
|
|
12
|
+
const {
|
|
13
|
+
isInitialized,
|
|
14
|
+
data
|
|
15
|
+
} = React.useContext(_DrawingProvider.SvgContext);
|
|
16
|
+
if (!isInitialized) {
|
|
14
17
|
throw new Error(['MUI X: Could not find the svg ref context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
15
18
|
}
|
|
16
|
-
return
|
|
19
|
+
return data;
|
|
17
20
|
}
|
package/hooks/useTicks.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ export interface TickParams {
|
|
|
18
18
|
*/
|
|
19
19
|
tickNumber?: number;
|
|
20
20
|
/**
|
|
21
|
-
* Defines which ticks are displayed.
|
|
21
|
+
* Defines which ticks are displayed.
|
|
22
|
+
* Its value can be:
|
|
22
23
|
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
23
|
-
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has
|
|
24
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has "point" scale.
|
|
24
25
|
* - an array containing the values where ticks should be displayed.
|
|
26
|
+
* @see See {@link https://mui.com/x/react-charts/axis/#fixed-tick-positions}
|
|
25
27
|
* @default 'auto'
|
|
26
28
|
*/
|
|
27
29
|
tickInterval?: 'auto' | ((value: any, index: number) => boolean) | any[];
|
package/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChartSeriesType } from '../models/seriesType/config';
|
|
2
|
+
declare class CartesianSeriesTypes {
|
|
3
|
+
types: Set<ChartSeriesType>;
|
|
4
|
+
constructor();
|
|
5
|
+
addType(value: ChartSeriesType): void;
|
|
6
|
+
getTypes(): Set<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
|
|
7
|
+
}
|
|
8
|
+
export declare const cartesianSeriesTypes: CartesianSeriesTypes;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.cartesianSeriesTypes = void 0;
|
|
7
|
+
let instance;
|
|
8
|
+
class CartesianSeriesTypes {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.types = new Set();
|
|
11
|
+
if (instance) {
|
|
12
|
+
throw new Error('You can only create one instance!');
|
|
13
|
+
}
|
|
14
|
+
instance = this.types;
|
|
15
|
+
}
|
|
16
|
+
addType(value) {
|
|
17
|
+
this.types.add(value);
|
|
18
|
+
}
|
|
19
|
+
getTypes() {
|
|
20
|
+
return this.types;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const cartesianSeriesTypes = exports.cartesianSeriesTypes = new CartesianSeriesTypes();
|
|
24
|
+
cartesianSeriesTypes.addType('bar');
|
|
25
|
+
cartesianSeriesTypes.addType('line');
|
|
26
|
+
cartesianSeriesTypes.addType('scatter');
|
|
@@ -39,9 +39,9 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
39
39
|
arcLabelRadius?: number | undefined;
|
|
40
40
|
color?: string | undefined;
|
|
41
41
|
} | undefined;
|
|
42
|
-
id?: import("
|
|
42
|
+
id?: import(".").SeriesId | undefined;
|
|
43
43
|
color?: string | undefined;
|
|
44
|
-
valueFormatter?: import("
|
|
44
|
+
valueFormatter?: import(".").SeriesValueFormatter<import(".").MakeOptional<import("../models/seriesType").PieValueType, "id">> | undefined;
|
|
45
45
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
46
46
|
} | {
|
|
47
47
|
type: "bar";
|
|
@@ -50,9 +50,9 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
50
50
|
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
51
51
|
layout?: "horizontal" | "vertical" | undefined;
|
|
52
52
|
stackOffset?: import("..").StackOffsetType | undefined;
|
|
53
|
-
id?: import("
|
|
53
|
+
id?: import(".").SeriesId | undefined;
|
|
54
54
|
color: string;
|
|
55
|
-
valueFormatter?: import("
|
|
55
|
+
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
56
56
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
57
57
|
xAxisKey?: string | undefined;
|
|
58
58
|
yAxisKey?: string | undefined;
|
|
@@ -70,9 +70,9 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
70
70
|
disableHighlight?: boolean | undefined;
|
|
71
71
|
connectNulls?: boolean | undefined;
|
|
72
72
|
stackOffset?: import("..").StackOffsetType | undefined;
|
|
73
|
-
id?: import("
|
|
73
|
+
id?: import(".").SeriesId | undefined;
|
|
74
74
|
color: string;
|
|
75
|
-
valueFormatter?: import("
|
|
75
|
+
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
76
76
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
77
77
|
xAxisKey?: string | undefined;
|
|
78
78
|
yAxisKey?: string | undefined;
|
|
@@ -84,9 +84,9 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
84
84
|
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
85
85
|
disableHover?: boolean | undefined;
|
|
86
86
|
zAxisKey?: string | undefined;
|
|
87
|
-
id?: import("
|
|
87
|
+
id?: import(".").SeriesId | undefined;
|
|
88
88
|
color: string;
|
|
89
|
-
valueFormatter?: import("
|
|
89
|
+
valueFormatter?: import(".").SeriesValueFormatter<import("../models/seriesType").ScatterValueType> | undefined;
|
|
90
90
|
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
91
91
|
xAxisKey?: string | undefined;
|
|
92
92
|
yAxisKey?: string | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SeriesId, SeriesValueFormatter } from '../models/seriesType/common';
|
|
2
|
-
declare function defaultizeValueFormatter<TValue, ISeries extends {
|
|
2
|
+
export declare function defaultizeValueFormatter<TValue, ISeries extends {
|
|
3
3
|
valueFormatter?: SeriesValueFormatter<TValue>;
|
|
4
4
|
}>(series: Record<SeriesId, ISeries>, defaultValueFormatter: SeriesValueFormatter<TValue>): Record<SeriesId, ISeries & {
|
|
5
5
|
valueFormatter: SeriesValueFormatter<TValue>;
|
|
6
6
|
}>;
|
|
7
|
-
export default defaultizeValueFormatter;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.defaultizeValueFormatter = defaultizeValueFormatter;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
10
10
|
const defaultizedSeries = {};
|
|
@@ -14,5 +14,4 @@ function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
16
|
return defaultizedSeries;
|
|
17
|
-
}
|
|
18
|
-
var _default = exports.default = defaultizeValueFormatter;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './components/ChartsAxesGradients';
|
|
2
|
+
export * from '../ResponsiveChartContainer/useChartContainerDimensions';
|
|
3
|
+
export * from '../ResponsiveChartContainer/ResizableContainer';
|
|
4
|
+
export { useReducedMotion } from '../hooks/useReducedMotion';
|
|
5
|
+
export { useSeries } from '../hooks/useSeries';
|
|
6
|
+
export * from './defaultizeValueFormatter';
|
|
7
|
+
export * from './configInit';
|
|
8
|
+
export * from '../context/CartesianContextProvider';
|
|
9
|
+
export * from '../context/DrawingProvider';
|
|
10
|
+
export * from '../context/InteractionProvider';
|
|
11
|
+
export * from '../context/SeriesContextProvider';
|
|
12
|
+
export * from '../context/ZAxisContextProvider';
|
|
13
|
+
export * from '../models/seriesType/config';
|
|
14
|
+
export * from '../models/seriesType/common';
|
|
15
|
+
export * from '../models/helpers';
|
|
16
|
+
export * from '../models/z-axis';
|
|
17
|
+
export * from '../models/axis';
|