@mui/x-charts 7.11.1 → 7.12.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.js +0 -2
- package/BarChart/BarElement.d.ts +20 -20
- package/BarChart/BarElement.js +3 -3
- package/BarChart/BarLabel/BarLabel.d.ts +20 -20
- package/BarChart/BarLabel/BarLabelItem.js +2 -2
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/extremums.d.ts +1 -1
- package/BarChart/formatter.d.ts +2 -2
- package/BarChart/formatter.js +1 -1
- package/BarChart/getColor.d.ts +3 -3
- package/BarChart/getColor.js +4 -3
- package/BarChart/legend.d.ts +1 -1
- package/BarChart/plugin.d.ts +2 -2
- package/CHANGELOG.md +178 -4
- package/ChartContainer/ChartContainer.d.ts +4 -15
- package/ChartContainer/ChartContainer.js +7 -9
- package/ChartContainer/useChartContainerProps.d.ts +56 -57
- package/ChartContainer/useChartContainerProps.js +16 -19
- package/ChartContainer/useDefaultizeAxis.d.ts +25 -26
- package/ChartsLegend/ChartsLegend.js +6 -6
- package/ChartsLegend/DefaultChartsLegend.d.ts +1 -1
- package/ChartsLegend/LegendPerItem.js +2 -2
- package/ChartsLegend/utils.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
- package/ChartsTooltip/ChartsItemTooltipContent.js +4 -4
- package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +10 -10
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
- package/ChartsXAxis/ChartsXAxis.js +5 -5
- package/ChartsYAxis/ChartsYAxis.js +6 -6
- package/Gauge/GaugeReferenceArc.js +1 -1
- package/Gauge/GaugeValueArc.js +1 -1
- package/LineChart/AnimatedArea.d.ts +20 -20
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.d.ts +20 -20
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.js +2 -2
- package/LineChart/AreaPlot.js +1 -1
- package/LineChart/LineChart.js +0 -2
- package/LineChart/LineElement.js +2 -2
- package/LineChart/LinePlot.js +1 -1
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/extremums.d.ts +1 -1
- package/LineChart/formatter.d.ts +2 -2
- package/LineChart/formatter.js +1 -1
- package/LineChart/getColor.d.ts +3 -3
- package/LineChart/getColor.js +4 -3
- package/LineChart/legend.d.ts +1 -1
- package/LineChart/plugin.d.ts +2 -2
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieChart.js +0 -2
- package/PieChart/formatter.d.ts +2 -2
- package/PieChart/formatter.js +1 -1
- package/PieChart/getColor.d.ts +3 -2
- package/PieChart/getColor.js +4 -3
- package/PieChart/legend.d.ts +1 -1
- package/PieChart/plugin.d.ts +2 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +2 -3
- package/ScatterChart/ScatterChart.js +0 -2
- package/ScatterChart/extremums.d.ts +1 -1
- package/ScatterChart/formatter.d.ts +2 -2
- package/ScatterChart/getColor.d.ts +3 -4
- package/ScatterChart/getColor.js +4 -3
- package/ScatterChart/legend.d.ts +1 -1
- package/ScatterChart/plugin.d.ts +2 -2
- package/SparkLineChart/SparkLineChart.js +0 -2
- package/context/CartesianProvider/CartesianProvider.d.ts +0 -9
- package/context/CartesianProvider/CartesianProvider.js +4 -2
- package/context/CartesianProvider/computeValue.d.ts +3 -2
- package/context/CartesianProvider/computeValue.js +1 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +25 -26
- package/context/CartesianProvider/getAxisExtremum.d.ts +3 -3
- package/context/PluginProvider/ColorProcessor.types.d.ts +8 -0
- package/context/PluginProvider/ExtremumGetter.types.d.ts +14 -0
- package/context/PluginProvider/ExtremumGetter.types.js +5 -0
- package/context/PluginProvider/Plugin.types.d.ts +25 -0
- package/context/PluginProvider/Plugin.types.js +5 -0
- package/context/PluginProvider/PluginContext.d.ts +4 -0
- package/context/PluginProvider/PluginContext.js +21 -0
- package/context/PluginProvider/PluginProvider.d.ts +4 -0
- package/context/{ColorProvider.js → PluginProvider/PluginProvider.js} +12 -11
- package/context/PluginProvider/SeriesFormatter.types.d.ts +21 -0
- package/context/PluginProvider/SeriesFormatter.types.js +5 -0
- package/context/PluginProvider/index.d.ts +10 -0
- package/context/PluginProvider/index.js +115 -0
- package/context/PluginProvider/mergePlugins.d.ts +36 -0
- package/context/PluginProvider/mergePlugins.js +37 -0
- package/context/PluginProvider/useColorProcessor.d.ts +4 -0
- package/context/PluginProvider/useColorProcessor.js +23 -0
- package/context/PluginProvider/useSeriesFormatter.d.ts +4 -0
- package/context/PluginProvider/useSeriesFormatter.js +23 -0
- package/context/PluginProvider/useXExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useXExtremumGetter.js +23 -0
- package/context/PluginProvider/useYExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useYExtremumGetter.js +23 -0
- package/context/SeriesProvider/Series.types.d.ts +26 -0
- package/context/SeriesProvider/Series.types.js +5 -0
- package/context/SeriesProvider/SeriesContext.d.ts +4 -0
- package/{hooks/useColor.js → context/SeriesProvider/SeriesContext.js} +7 -8
- package/context/SeriesProvider/SeriesProvider.d.ts +5 -0
- package/context/SeriesProvider/SeriesProvider.js +38 -0
- package/context/SeriesProvider/index.d.ts +12 -0
- package/context/SeriesProvider/index.js +49 -0
- package/context/SeriesProvider/processSeries.d.ts +18 -0
- package/context/SeriesProvider/processSeries.js +55 -0
- package/esm/BarChart/BarChart.js +0 -2
- package/esm/BarChart/BarElement.js +2 -2
- package/esm/BarChart/BarLabel/BarLabelItem.js +1 -1
- package/esm/BarChart/BarPlot.js +1 -2
- package/esm/BarChart/formatter.js +1 -1
- package/esm/BarChart/getColor.js +3 -2
- package/esm/ChartContainer/ChartContainer.js +7 -9
- package/esm/ChartContainer/useChartContainerProps.js +14 -19
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/LegendPerItem.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/Gauge/GaugeReferenceArc.js +1 -1
- package/esm/Gauge/GaugeValueArc.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaElement.js +1 -1
- package/esm/LineChart/AreaPlot.js +1 -1
- package/esm/LineChart/LineChart.js +0 -2
- package/esm/LineChart/LineElement.js +1 -1
- package/esm/LineChart/LinePlot.js +1 -1
- package/esm/LineChart/MarkElement.js +1 -1
- package/esm/LineChart/formatter.js +1 -1
- package/esm/LineChart/getColor.js +3 -2
- package/esm/PieChart/PieArc.js +1 -1
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieChart.js +0 -2
- package/esm/PieChart/formatter.js +1 -1
- package/esm/PieChart/getColor.js +3 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/esm/ScatterChart/ScatterChart.js +0 -2
- package/esm/ScatterChart/getColor.js +3 -2
- package/esm/SparkLineChart/SparkLineChart.js +0 -2
- package/esm/context/CartesianProvider/CartesianProvider.js +4 -2
- package/esm/context/CartesianProvider/computeValue.js +1 -1
- package/esm/context/PluginProvider/Plugin.types.js +1 -0
- package/esm/context/PluginProvider/PluginContext.js +13 -0
- package/esm/context/PluginProvider/PluginProvider.js +19 -0
- package/esm/context/PluginProvider/SeriesFormatter.types.js +1 -0
- package/esm/context/PluginProvider/index.js +10 -0
- package/esm/context/PluginProvider/mergePlugins.js +30 -0
- package/esm/context/PluginProvider/useColorProcessor.js +15 -0
- package/esm/context/PluginProvider/useSeriesFormatter.js +15 -0
- package/esm/context/PluginProvider/useXExtremumGetter.js +15 -0
- package/esm/context/PluginProvider/useYExtremumGetter.js +15 -0
- package/esm/context/SeriesProvider/Series.types.js +1 -0
- package/esm/context/SeriesProvider/SeriesContext.js +8 -0
- package/esm/context/SeriesProvider/SeriesProvider.js +31 -0
- package/esm/context/SeriesProvider/index.js +8 -0
- package/{modern/context/SeriesContextProvider.js → esm/context/SeriesProvider/processSeries.js} +9 -34
- package/esm/hooks/useReducedMotion.js +2 -2
- package/esm/hooks/useSeries.js +1 -1
- package/esm/internals/colorScale.js +1 -1
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/esm/internals/getCurve.js +1 -1
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.js +2 -2
- package/esm/internals/stackSeries.js +1 -1
- package/esm/internals/useAnimatedPath.js +1 -1
- package/esm/models/index.js +0 -1
- package/hooks/useReducedMotion.js +2 -2
- package/hooks/useSeries.d.ts +1 -1
- package/hooks/useSeries.js +2 -2
- package/hooks/useTicks.d.ts +1 -1
- package/index.js +1 -1
- package/internals/colorScale.d.ts +3 -3
- package/internals/colorScale.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/getCurve.d.ts +1 -1
- package/internals/getCurve.js +1 -1
- package/internals/getScale.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +16 -16
- package/internals/isBandScale.d.ts +1 -1
- package/internals/stackSeries.d.ts +1 -1
- package/internals/stackSeries.js +1 -1
- package/internals/useAnimatedPath.js +1 -1
- package/models/axis.d.ts +2 -2
- package/models/index.d.ts +0 -1
- package/models/index.js +0 -11
- package/models/seriesType/config.d.ts +0 -26
- package/models/seriesType/pie.d.ts +1 -1
- package/models/z-axis.d.ts +1 -1
- package/modern/BarChart/BarChart.js +0 -2
- package/modern/BarChart/BarElement.js +2 -2
- package/modern/BarChart/BarLabel/BarLabelItem.js +1 -1
- package/modern/BarChart/BarPlot.js +1 -2
- package/modern/BarChart/formatter.js +1 -1
- package/modern/BarChart/getColor.js +3 -2
- package/modern/ChartContainer/ChartContainer.js +7 -9
- package/modern/ChartContainer/useChartContainerProps.js +14 -19
- package/modern/ChartsLegend/ChartsLegend.js +2 -2
- package/modern/ChartsLegend/LegendPerItem.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltip.js +3 -3
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/Gauge/GaugeReferenceArc.js +1 -1
- package/modern/Gauge/GaugeValueArc.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaElement.js +1 -1
- package/modern/LineChart/AreaPlot.js +1 -1
- package/modern/LineChart/LineChart.js +0 -2
- package/modern/LineChart/LineElement.js +1 -1
- package/modern/LineChart/LinePlot.js +1 -1
- package/modern/LineChart/MarkElement.js +1 -1
- package/modern/LineChart/formatter.js +1 -1
- package/modern/LineChart/getColor.js +3 -2
- package/modern/PieChart/PieArc.js +1 -1
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieChart.js +0 -2
- package/modern/PieChart/formatter.js +1 -1
- package/modern/PieChart/getColor.js +3 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/modern/ScatterChart/ScatterChart.js +0 -2
- package/modern/ScatterChart/getColor.js +3 -2
- package/modern/SparkLineChart/SparkLineChart.js +0 -2
- package/modern/context/CartesianProvider/CartesianProvider.js +4 -2
- package/modern/context/CartesianProvider/computeValue.js +1 -1
- package/modern/context/PluginProvider/ColorProcessor.types.js +1 -0
- package/modern/context/PluginProvider/ExtremumGetter.types.js +1 -0
- package/modern/context/PluginProvider/Plugin.types.js +1 -0
- package/modern/context/PluginProvider/PluginContext.js +13 -0
- package/modern/context/PluginProvider/PluginProvider.js +19 -0
- package/modern/context/PluginProvider/SeriesFormatter.types.js +1 -0
- package/modern/context/PluginProvider/index.js +10 -0
- package/modern/context/PluginProvider/mergePlugins.js +30 -0
- package/modern/context/PluginProvider/useColorProcessor.js +15 -0
- package/modern/context/PluginProvider/useSeriesFormatter.js +15 -0
- package/modern/context/PluginProvider/useXExtremumGetter.js +15 -0
- package/modern/context/PluginProvider/useYExtremumGetter.js +15 -0
- package/modern/context/SeriesProvider/Series.types.js +1 -0
- package/modern/context/SeriesProvider/SeriesContext.js +8 -0
- package/modern/context/SeriesProvider/SeriesProvider.js +31 -0
- package/modern/context/SeriesProvider/index.js +8 -0
- package/{esm/context/SeriesContextProvider.js → modern/context/SeriesProvider/processSeries.js} +9 -34
- package/modern/hooks/useReducedMotion.js +2 -2
- package/modern/hooks/useSeries.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/colorScale.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/modern/internals/getCurve.js +1 -1
- package/modern/internals/getScale.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/internals/stackSeries.js +1 -1
- package/modern/internals/useAnimatedPath.js +1 -1
- package/modern/models/index.js +0 -1
- package/package.json +6 -23
- package/ChartContainer/defaultPlugins.d.ts +0 -2
- package/ChartContainer/defaultPlugins.js +0 -11
- package/ChartContainer/useChartContainerHooks.d.ts +0 -11
- package/ChartContainer/useChartContainerHooks.js +0 -34
- package/ChartContainer/usePluginsMerge.d.ts +0 -9
- package/ChartContainer/usePluginsMerge.js +0 -39
- package/context/ColorProvider.d.ts +0 -12
- package/context/SeriesContextProvider.d.ts +0 -36
- package/context/SeriesContextProvider.js +0 -81
- package/esm/ChartContainer/defaultPlugins.js +0 -5
- package/esm/ChartContainer/useChartContainerHooks.js +0 -24
- package/esm/ChartContainer/usePluginsMerge.js +0 -31
- package/esm/context/ColorProvider.js +0 -16
- package/esm/hooks/useColor.js +0 -9
- package/hooks/useColor.d.ts +0 -4
- package/models/plugin.d.ts +0 -19
- package/modern/ChartContainer/defaultPlugins.js +0 -5
- package/modern/ChartContainer/useChartContainerHooks.js +0 -24
- package/modern/ChartContainer/usePluginsMerge.js +0 -31
- package/modern/context/ColorProvider.js +0 -16
- package/modern/hooks/useColor.js +0 -9
- /package/{models/plugin.js → context/PluginProvider/ColorProcessor.types.js} +0 -0
- /package/esm/{models/plugin.js → context/PluginProvider/ColorProcessor.types.js} +0 -0
- /package/{modern/models/plugin.js → esm/context/PluginProvider/ExtremumGetter.types.js} +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useChartContainerHooks = void 0;
|
|
8
|
-
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _usePluginsMerge = require("./usePluginsMerge");
|
|
11
|
-
var _useReducedMotion = require("../hooks/useReducedMotion");
|
|
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
|
-
const useChartContainerHooks = (ref, plugins) => {
|
|
15
|
-
const svgRef = React.useRef(null);
|
|
16
|
-
const chartSurfaceRef = (0, _useForkRef.default)(ref, svgRef);
|
|
17
|
-
const {
|
|
18
|
-
xExtremumGetters,
|
|
19
|
-
yExtremumGetters,
|
|
20
|
-
seriesFormatters,
|
|
21
|
-
colorProcessors
|
|
22
|
-
} = (0, _usePluginsMerge.usePluginsMerge)(plugins);
|
|
23
|
-
(0, _useReducedMotion.useReducedMotion)(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
svgRef,
|
|
27
|
-
chartSurfaceRef,
|
|
28
|
-
xExtremumGetters,
|
|
29
|
-
yExtremumGetters,
|
|
30
|
-
seriesFormatters,
|
|
31
|
-
colorProcessors
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
exports.useChartContainerHooks = useChartContainerHooks;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ChartsPluginType, ColorProcessorsConfig, ExtremumGettersConfig } from '../models';
|
|
2
|
-
import { ChartSeriesType } from '../models/seriesType/config';
|
|
3
|
-
import { SeriesFormatterConfig } from '../context/SeriesContextProvider';
|
|
4
|
-
export declare function usePluginsMerge<T extends ChartSeriesType>(plugins?: ChartsPluginType<T>[]): {
|
|
5
|
-
seriesFormatters: SeriesFormatterConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
|
|
6
|
-
colorProcessors: ColorProcessorsConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
|
|
7
|
-
xExtremumGetters: ExtremumGettersConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
|
|
8
|
-
yExtremumGetters: ExtremumGettersConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
|
|
9
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePluginsMerge = usePluginsMerge;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _defaultPlugins = require("./defaultPlugins");
|
|
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 usePluginsMerge(plugins) {
|
|
12
|
-
const defaultizedPlugins = plugins ?? _defaultPlugins.defaultPlugins;
|
|
13
|
-
return React.useMemo(() => {
|
|
14
|
-
const seriesFormatters = {};
|
|
15
|
-
const colorProcessors = {};
|
|
16
|
-
const xExtremumGetters = {};
|
|
17
|
-
const yExtremumGetters = {};
|
|
18
|
-
for (let i = 0; i < defaultizedPlugins.length; i += 1) {
|
|
19
|
-
const plugin = defaultizedPlugins[i];
|
|
20
|
-
|
|
21
|
-
// To remove those any we will need to solve this union discrimination issue:
|
|
22
|
-
// https://www.typescriptlang.org/play/?#code/FDAuE8AcFMAIDkCuBbARtATgYQPYDsAzASwHNYBeWAb2FlgGsi8ATALlgHI8V0MOBuWrBwwMAQ1A4M7ABQAPdtzSYAlBQB8sJb0EBfEBBiwAyqAxMSuQqQrUhjFuw4BnMxYFCRmCVNkLYruZ4JGrkmoEWeiAAxviuWqhWxCTsSMrY+Mm2VAxMbLAARNqYBQA0wqI+0rByGrAATLAAVDWw+rF48YFJpOymQZaZNpQ5DvkFEcFlFd6S1bVhsAAG9S0AJFRyukttMXGgsB3JzrYA2niJQyTl3VcAugZQcADylXPOALJikJAW2ULFDAAflSPEwPRIpw4XnEcw4d1KQkmJBBJjcwQhUJhVXhiN0gmAHXi2LmXx+FnYr1mUk+31+wWy+JABCksBkABtoAcjjYcARDldnGoaCA6AB6MWwADqUnoJxw9FgRH5AHc4L9ooroGJogALQ5iZxwPJEABuRGYiDE7PASJVRFAerZPJIADoxsKhHRooa4FwwXxWF66DNYVIyfTIS73Xk7rZoySpIIQyHUBhtfRkyGfUbOMiOEGU3RExgIxZTtGxnHKAm3kng8xoAQxIh2aBC0W0xms-pvftqLkWOUS2141chBLYABJDimuB4HBKxtiWBiVA4RAHXU4FWwSSwTkHAAqxlgiBYmFcYhYAusbrGq5vtepGFX6YPTHo0GYnjrpbp5ZVrYJZ6EAA
|
|
23
|
-
seriesFormatters[plugin.seriesType] = plugin.seriesFormatter;
|
|
24
|
-
colorProcessors[plugin.seriesType] = plugin.colorProcessor;
|
|
25
|
-
if (plugin.xExtremumGetter) {
|
|
26
|
-
xExtremumGetters[plugin.seriesType] = plugin.xExtremumGetter;
|
|
27
|
-
}
|
|
28
|
-
if (plugin.yExtremumGetter) {
|
|
29
|
-
yExtremumGetters[plugin.seriesType] = plugin.yExtremumGetter;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
seriesFormatters,
|
|
34
|
-
colorProcessors,
|
|
35
|
-
xExtremumGetters,
|
|
36
|
-
yExtremumGetters
|
|
37
|
-
};
|
|
38
|
-
}, [defaultizedPlugins]);
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ColorProcessorsConfig } from '../models';
|
|
3
|
-
import { ChartSeriesType } from '../models/seriesType/config';
|
|
4
|
-
export interface ColorProviderProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
/**
|
|
7
|
-
* A mapping defining for each series type how to get item colors.
|
|
8
|
-
*/
|
|
9
|
-
colorProcessors: ColorProcessorsConfig<ChartSeriesType>;
|
|
10
|
-
}
|
|
11
|
-
export declare const ColorContext: React.Context<ColorProcessorsConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>>;
|
|
12
|
-
export declare function ColorProvider(props: ColorProviderProps): React.JSX.Element;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { AllSeriesType } from '../models/seriesType';
|
|
3
|
-
import { ChartSeriesType, DatasetType, FormatterParams, FormatterResult } from '../models/seriesType/config';
|
|
4
|
-
import { ChartsColorPalette } from '../colorPalettes';
|
|
5
|
-
import { Initializable } from './context.types';
|
|
6
|
-
export type SeriesFormatterType<T extends ChartSeriesType> = (series: AllSeriesType<T>[], colors: string[], dataset?: DatasetType) => {
|
|
7
|
-
[type in T]?: FormatterResult<type>;
|
|
8
|
-
};
|
|
9
|
-
export type SeriesContextProviderProps<T extends ChartSeriesType = ChartSeriesType> = {
|
|
10
|
-
dataset?: DatasetType;
|
|
11
|
-
/**
|
|
12
|
-
* The array of series to display.
|
|
13
|
-
* Each type of series has its own specificity.
|
|
14
|
-
* Please refer to the appropriate docs page to learn more about it.
|
|
15
|
-
*/
|
|
16
|
-
series: AllSeriesType<T>[];
|
|
17
|
-
/**
|
|
18
|
-
* Color palette used to colorize multiple series.
|
|
19
|
-
* @default blueberryTwilightPalette
|
|
20
|
-
*/
|
|
21
|
-
colors?: ChartsColorPalette;
|
|
22
|
-
/**
|
|
23
|
-
* Preprocessors for each series types.
|
|
24
|
-
*/
|
|
25
|
-
seriesFormatters: SeriesFormatterConfig<T>;
|
|
26
|
-
children: React.ReactNode;
|
|
27
|
-
};
|
|
28
|
-
export type FormattedSeries = {
|
|
29
|
-
[type in ChartSeriesType]?: FormatterResult<type>;
|
|
30
|
-
};
|
|
31
|
-
export declare const SeriesContext: React.Context<Initializable<FormattedSeries>>;
|
|
32
|
-
export type SeriesFormatterConfig<T extends ChartSeriesType = ChartSeriesType> = {
|
|
33
|
-
[K in T]?: (series: FormatterParams<K>, dataset?: DatasetType) => any;
|
|
34
|
-
};
|
|
35
|
-
declare function SeriesContextProvider<T extends ChartSeriesType>(props: SeriesContextProviderProps<T>): React.JSX.Element;
|
|
36
|
-
export { SeriesContextProvider };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.SeriesContext = void 0;
|
|
8
|
-
exports.SeriesContextProvider = SeriesContextProvider;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _styles = require("@mui/material/styles");
|
|
12
|
-
var _defaultizeColor = require("../internals/defaultizeColor");
|
|
13
|
-
var _colorPalettes = require("../colorPalettes");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
17
|
-
const SeriesContext = exports.SeriesContext = /*#__PURE__*/React.createContext({
|
|
18
|
-
isInitialized: false,
|
|
19
|
-
data: {}
|
|
20
|
-
});
|
|
21
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
22
|
-
SeriesContext.displayName = 'SeriesContext';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* This methods is the interface between what the developer is providing and what components receives
|
|
26
|
-
* To simplify the components behaviors, it groups series by type, such that LinePlots props are not updated if some line data are modified
|
|
27
|
-
* It also add defaultized values such as the ids, colors
|
|
28
|
-
* @param series The array of series provided by devs
|
|
29
|
-
* @param colors The color palette used to defaultize series colors
|
|
30
|
-
* @returns An object structuring all the series by type.
|
|
31
|
-
*/
|
|
32
|
-
const preprocessSeries = (series, colors, seriesFormatters, dataset) => {
|
|
33
|
-
// Group series by type
|
|
34
|
-
const seriesGroups = {};
|
|
35
|
-
series.forEach((seriesData, seriesIndex) => {
|
|
36
|
-
const {
|
|
37
|
-
id = `auto-generated-id-${seriesIndex}`,
|
|
38
|
-
type
|
|
39
|
-
} = seriesData;
|
|
40
|
-
if (seriesGroups[type] === undefined) {
|
|
41
|
-
seriesGroups[type] = {
|
|
42
|
-
series: {},
|
|
43
|
-
seriesOrder: []
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
if (seriesGroups[type]?.series[id] !== undefined) {
|
|
47
|
-
throw new Error(`MUI X: series' id "${id}" is not unique.`);
|
|
48
|
-
}
|
|
49
|
-
seriesGroups[type].series[id] = (0, _extends2.default)({
|
|
50
|
-
id
|
|
51
|
-
}, (0, _defaultizeColor.defaultizeColor)(seriesData, seriesIndex, colors));
|
|
52
|
-
seriesGroups[type].seriesOrder.push(id);
|
|
53
|
-
});
|
|
54
|
-
const formattedSeries = {};
|
|
55
|
-
// Apply formatter on a type group
|
|
56
|
-
Object.keys(seriesFormatters).forEach(type => {
|
|
57
|
-
const group = seriesGroups[type];
|
|
58
|
-
if (group !== undefined) {
|
|
59
|
-
formattedSeries[type] = seriesFormatters[type]?.(group, dataset) ?? seriesGroups[type];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
return formattedSeries;
|
|
63
|
-
};
|
|
64
|
-
function SeriesContextProvider(props) {
|
|
65
|
-
const {
|
|
66
|
-
series,
|
|
67
|
-
dataset,
|
|
68
|
-
colors = _colorPalettes.blueberryTwilightPalette,
|
|
69
|
-
seriesFormatters,
|
|
70
|
-
children
|
|
71
|
-
} = props;
|
|
72
|
-
const theme = (0, _styles.useTheme)();
|
|
73
|
-
const formattedSeries = React.useMemo(() => ({
|
|
74
|
-
isInitialized: true,
|
|
75
|
-
data: preprocessSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, seriesFormatters, dataset)
|
|
76
|
-
}), [series, colors, theme.palette.mode, seriesFormatters, dataset]);
|
|
77
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SeriesContext.Provider, {
|
|
78
|
-
value: formattedSeries,
|
|
79
|
-
children: children
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { plugin as barPlugin } from '../BarChart/plugin';
|
|
2
|
-
import { plugin as scatterPlugin } from '../ScatterChart/plugin';
|
|
3
|
-
import { plugin as linePlugin } from '../LineChart/plugin';
|
|
4
|
-
import { plugin as piePlugin } from '../PieChart/plugin';
|
|
5
|
-
export const defaultPlugins = [barPlugin, scatterPlugin, linePlugin, piePlugin];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { usePluginsMerge } from './usePluginsMerge';
|
|
4
|
-
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
5
|
-
export const useChartContainerHooks = (ref, plugins) => {
|
|
6
|
-
const svgRef = React.useRef(null);
|
|
7
|
-
const chartSurfaceRef = useForkRef(ref, svgRef);
|
|
8
|
-
const {
|
|
9
|
-
xExtremumGetters,
|
|
10
|
-
yExtremumGetters,
|
|
11
|
-
seriesFormatters,
|
|
12
|
-
colorProcessors
|
|
13
|
-
} = usePluginsMerge(plugins);
|
|
14
|
-
useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
svgRef,
|
|
18
|
-
chartSurfaceRef,
|
|
19
|
-
xExtremumGetters,
|
|
20
|
-
yExtremumGetters,
|
|
21
|
-
seriesFormatters,
|
|
22
|
-
colorProcessors
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { defaultPlugins } from './defaultPlugins';
|
|
3
|
-
export function usePluginsMerge(plugins) {
|
|
4
|
-
const defaultizedPlugins = plugins ?? defaultPlugins;
|
|
5
|
-
return React.useMemo(() => {
|
|
6
|
-
const seriesFormatters = {};
|
|
7
|
-
const colorProcessors = {};
|
|
8
|
-
const xExtremumGetters = {};
|
|
9
|
-
const yExtremumGetters = {};
|
|
10
|
-
for (let i = 0; i < defaultizedPlugins.length; i += 1) {
|
|
11
|
-
const plugin = defaultizedPlugins[i];
|
|
12
|
-
|
|
13
|
-
// To remove those any we will need to solve this union discrimination issue:
|
|
14
|
-
// https://www.typescriptlang.org/play/?#code/FDAuE8AcFMAIDkCuBbARtATgYQPYDsAzASwHNYBeWAb2FlgGsi8ATALlgHI8V0MOBuWrBwwMAQ1A4M7ABQAPdtzSYAlBQB8sJb0EBfEBBiwAyqAxMSuQqQrUhjFuw4BnMxYFCRmCVNkLYruZ4JGrkmoEWeiAAxviuWqhWxCTsSMrY+Mm2VAxMbLAARNqYBQA0wqI+0rByGrAATLAAVDWw+rF48YFJpOymQZaZNpQ5DvkFEcFlFd6S1bVhsAAG9S0AJFRyukttMXGgsB3JzrYA2niJQyTl3VcAugZQcADylXPOALJikJAW2ULFDAAflSPEwPRIpw4XnEcw4d1KQkmJBBJjcwQhUJhVXhiN0gmAHXi2LmXx+FnYr1mUk+31+wWy+JABCksBkABtoAcjjYcARDldnGoaCA6AB6MWwADqUnoJxw9FgRH5AHc4L9ooroGJogALQ5iZxwPJEABuRGYiDE7PASJVRFAerZPJIADoxsKhHRooa4FwwXxWF66DNYVIyfTIS73Xk7rZoySpIIQyHUBhtfRkyGfUbOMiOEGU3RExgIxZTtGxnHKAm3kng8xoAQxIh2aBC0W0xms-pvftqLkWOUS2141chBLYABJDimuB4HBKxtiWBiVA4RAHXU4FWwSSwTkHAAqxlgiBYmFcYhYAusbrGq5vtepGFX6YPTHo0GYnjrpbp5ZVrYJZ6EAA
|
|
15
|
-
seriesFormatters[plugin.seriesType] = plugin.seriesFormatter;
|
|
16
|
-
colorProcessors[plugin.seriesType] = plugin.colorProcessor;
|
|
17
|
-
if (plugin.xExtremumGetter) {
|
|
18
|
-
xExtremumGetters[plugin.seriesType] = plugin.xExtremumGetter;
|
|
19
|
-
}
|
|
20
|
-
if (plugin.yExtremumGetter) {
|
|
21
|
-
yExtremumGetters[plugin.seriesType] = plugin.yExtremumGetter;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
seriesFormatters,
|
|
26
|
-
colorProcessors,
|
|
27
|
-
xExtremumGetters,
|
|
28
|
-
yExtremumGetters
|
|
29
|
-
};
|
|
30
|
-
}, [defaultizedPlugins]);
|
|
31
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
export const ColorContext = /*#__PURE__*/React.createContext({});
|
|
4
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5
|
-
ColorContext.displayName = 'ColorContext';
|
|
6
|
-
}
|
|
7
|
-
export function ColorProvider(props) {
|
|
8
|
-
const {
|
|
9
|
-
colorProcessors,
|
|
10
|
-
children
|
|
11
|
-
} = props;
|
|
12
|
-
return /*#__PURE__*/_jsx(ColorContext.Provider, {
|
|
13
|
-
value: colorProcessors,
|
|
14
|
-
children: children
|
|
15
|
-
});
|
|
16
|
-
}
|
package/esm/hooks/useColor.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ColorContext } from '../context/ColorProvider';
|
|
3
|
-
export function useColorProcessor(seriesType) {
|
|
4
|
-
const colorProcessors = React.useContext(ColorContext);
|
|
5
|
-
if (!seriesType) {
|
|
6
|
-
return colorProcessors;
|
|
7
|
-
}
|
|
8
|
-
return colorProcessors[seriesType];
|
|
9
|
-
}
|
package/hooks/useColor.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ChartSeriesType } from '../models/seriesType/config';
|
|
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>;
|
package/models/plugin.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CartesianChartSeriesType, ChartSeriesType, ExtremumGetter, Formatter } from './seriesType/config';
|
|
2
|
-
import { AxisDefaultized } from './axis';
|
|
3
|
-
import { DefaultizedSeriesType } from './seriesType';
|
|
4
|
-
import { ZAxisDefaultized } from './z-axis';
|
|
5
|
-
type ColorProcessor<T extends ChartSeriesType> = (series: DefaultizedSeriesType<T>, xAxis?: AxisDefaultized, yAxis?: AxisDefaultized, zAxis?: ZAxisDefaultized) => (dataIndex: number) => string;
|
|
6
|
-
export type ColorProcessorsConfig<T extends ChartSeriesType> = {
|
|
7
|
-
[Key in T]?: ColorProcessor<Key>;
|
|
8
|
-
};
|
|
9
|
-
export type ChartsPluginType<T> = T extends ChartSeriesType ? {
|
|
10
|
-
seriesType: T;
|
|
11
|
-
seriesFormatter: Formatter<T>;
|
|
12
|
-
colorProcessor: ColorProcessor<T>;
|
|
13
|
-
xExtremumGetter?: ExtremumGetter<T>;
|
|
14
|
-
yExtremumGetter?: ExtremumGetter<T>;
|
|
15
|
-
} : never;
|
|
16
|
-
export type ExtremumGettersConfig<T extends ChartSeriesType = CartesianChartSeriesType> = {
|
|
17
|
-
[K in T]?: ExtremumGetter<K>;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { plugin as barPlugin } from '../BarChart/plugin';
|
|
2
|
-
import { plugin as scatterPlugin } from '../ScatterChart/plugin';
|
|
3
|
-
import { plugin as linePlugin } from '../LineChart/plugin';
|
|
4
|
-
import { plugin as piePlugin } from '../PieChart/plugin';
|
|
5
|
-
export const defaultPlugins = [barPlugin, scatterPlugin, linePlugin, piePlugin];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { usePluginsMerge } from './usePluginsMerge';
|
|
4
|
-
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
5
|
-
export const useChartContainerHooks = (ref, plugins) => {
|
|
6
|
-
const svgRef = React.useRef(null);
|
|
7
|
-
const chartSurfaceRef = useForkRef(ref, svgRef);
|
|
8
|
-
const {
|
|
9
|
-
xExtremumGetters,
|
|
10
|
-
yExtremumGetters,
|
|
11
|
-
seriesFormatters,
|
|
12
|
-
colorProcessors
|
|
13
|
-
} = usePluginsMerge(plugins);
|
|
14
|
-
useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
svgRef,
|
|
18
|
-
chartSurfaceRef,
|
|
19
|
-
xExtremumGetters,
|
|
20
|
-
yExtremumGetters,
|
|
21
|
-
seriesFormatters,
|
|
22
|
-
colorProcessors
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { defaultPlugins } from './defaultPlugins';
|
|
3
|
-
export function usePluginsMerge(plugins) {
|
|
4
|
-
const defaultizedPlugins = plugins ?? defaultPlugins;
|
|
5
|
-
return React.useMemo(() => {
|
|
6
|
-
const seriesFormatters = {};
|
|
7
|
-
const colorProcessors = {};
|
|
8
|
-
const xExtremumGetters = {};
|
|
9
|
-
const yExtremumGetters = {};
|
|
10
|
-
for (let i = 0; i < defaultizedPlugins.length; i += 1) {
|
|
11
|
-
const plugin = defaultizedPlugins[i];
|
|
12
|
-
|
|
13
|
-
// To remove those any we will need to solve this union discrimination issue:
|
|
14
|
-
// https://www.typescriptlang.org/play/?#code/FDAuE8AcFMAIDkCuBbARtATgYQPYDsAzASwHNYBeWAb2FlgGsi8ATALlgHI8V0MOBuWrBwwMAQ1A4M7ABQAPdtzSYAlBQB8sJb0EBfEBBiwAyqAxMSuQqQrUhjFuw4BnMxYFCRmCVNkLYruZ4JGrkmoEWeiAAxviuWqhWxCTsSMrY+Mm2VAxMbLAARNqYBQA0wqI+0rByGrAATLAAVDWw+rF48YFJpOymQZaZNpQ5DvkFEcFlFd6S1bVhsAAG9S0AJFRyukttMXGgsB3JzrYA2niJQyTl3VcAugZQcADylXPOALJikJAW2ULFDAAflSPEwPRIpw4XnEcw4d1KQkmJBBJjcwQhUJhVXhiN0gmAHXi2LmXx+FnYr1mUk+31+wWy+JABCksBkABtoAcjjYcARDldnGoaCA6AB6MWwADqUnoJxw9FgRH5AHc4L9ooroGJogALQ5iZxwPJEABuRGYiDE7PASJVRFAerZPJIADoxsKhHRooa4FwwXxWF66DNYVIyfTIS73Xk7rZoySpIIQyHUBhtfRkyGfUbOMiOEGU3RExgIxZTtGxnHKAm3kng8xoAQxIh2aBC0W0xms-pvftqLkWOUS2141chBLYABJDimuB4HBKxtiWBiVA4RAHXU4FWwSSwTkHAAqxlgiBYmFcYhYAusbrGq5vtepGFX6YPTHo0GYnjrpbp5ZVrYJZ6EAA
|
|
15
|
-
seriesFormatters[plugin.seriesType] = plugin.seriesFormatter;
|
|
16
|
-
colorProcessors[plugin.seriesType] = plugin.colorProcessor;
|
|
17
|
-
if (plugin.xExtremumGetter) {
|
|
18
|
-
xExtremumGetters[plugin.seriesType] = plugin.xExtremumGetter;
|
|
19
|
-
}
|
|
20
|
-
if (plugin.yExtremumGetter) {
|
|
21
|
-
yExtremumGetters[plugin.seriesType] = plugin.yExtremumGetter;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return {
|
|
25
|
-
seriesFormatters,
|
|
26
|
-
colorProcessors,
|
|
27
|
-
xExtremumGetters,
|
|
28
|
-
yExtremumGetters
|
|
29
|
-
};
|
|
30
|
-
}, [defaultizedPlugins]);
|
|
31
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
export const ColorContext = /*#__PURE__*/React.createContext({});
|
|
4
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5
|
-
ColorContext.displayName = 'ColorContext';
|
|
6
|
-
}
|
|
7
|
-
export function ColorProvider(props) {
|
|
8
|
-
const {
|
|
9
|
-
colorProcessors,
|
|
10
|
-
children
|
|
11
|
-
} = props;
|
|
12
|
-
return /*#__PURE__*/_jsx(ColorContext.Provider, {
|
|
13
|
-
value: colorProcessors,
|
|
14
|
-
children: children
|
|
15
|
-
});
|
|
16
|
-
}
|
package/modern/hooks/useColor.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ColorContext } from '../context/ColorProvider';
|
|
3
|
-
export function useColorProcessor(seriesType) {
|
|
4
|
-
const colorProcessors = React.useContext(ColorContext);
|
|
5
|
-
if (!seriesType) {
|
|
6
|
-
return colorProcessors;
|
|
7
|
-
}
|
|
8
|
-
return colorProcessors[seriesType];
|
|
9
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|