@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,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useReducedMotion: true,
|
|
8
|
+
useSeries: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "useReducedMotion", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useReducedMotion.useReducedMotion;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "useSeries", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _useSeries.useSeries;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _ChartsAxesGradients = require("./components/ChartsAxesGradients");
|
|
23
|
+
Object.keys(_ChartsAxesGradients).forEach(function (key) {
|
|
24
|
+
if (key === "default" || key === "__esModule") return;
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
26
|
+
if (key in exports && exports[key] === _ChartsAxesGradients[key]) return;
|
|
27
|
+
Object.defineProperty(exports, key, {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _ChartsAxesGradients[key];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var _useChartContainerDimensions = require("../ResponsiveChartContainer/useChartContainerDimensions");
|
|
35
|
+
Object.keys(_useChartContainerDimensions).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
38
|
+
if (key in exports && exports[key] === _useChartContainerDimensions[key]) return;
|
|
39
|
+
Object.defineProperty(exports, key, {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _useChartContainerDimensions[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
var _ResizableContainer = require("../ResponsiveChartContainer/ResizableContainer");
|
|
47
|
+
Object.keys(_ResizableContainer).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
+
if (key in exports && exports[key] === _ResizableContainer[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _ResizableContainer[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
var _useReducedMotion = require("../hooks/useReducedMotion");
|
|
59
|
+
var _useSeries = require("../hooks/useSeries");
|
|
60
|
+
var _defaultizeValueFormatter = require("./defaultizeValueFormatter");
|
|
61
|
+
Object.keys(_defaultizeValueFormatter).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
64
|
+
if (key in exports && exports[key] === _defaultizeValueFormatter[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _defaultizeValueFormatter[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _configInit = require("./configInit");
|
|
73
|
+
Object.keys(_configInit).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
76
|
+
if (key in exports && exports[key] === _configInit[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _configInit[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
85
|
+
Object.keys(_CartesianContextProvider).forEach(function (key) {
|
|
86
|
+
if (key === "default" || key === "__esModule") return;
|
|
87
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
88
|
+
if (key in exports && exports[key] === _CartesianContextProvider[key]) return;
|
|
89
|
+
Object.defineProperty(exports, key, {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () {
|
|
92
|
+
return _CartesianContextProvider[key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
var _DrawingProvider = require("../context/DrawingProvider");
|
|
97
|
+
Object.keys(_DrawingProvider).forEach(function (key) {
|
|
98
|
+
if (key === "default" || key === "__esModule") return;
|
|
99
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
100
|
+
if (key in exports && exports[key] === _DrawingProvider[key]) return;
|
|
101
|
+
Object.defineProperty(exports, key, {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: function () {
|
|
104
|
+
return _DrawingProvider[key];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
var _InteractionProvider = require("../context/InteractionProvider");
|
|
109
|
+
Object.keys(_InteractionProvider).forEach(function (key) {
|
|
110
|
+
if (key === "default" || key === "__esModule") return;
|
|
111
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
112
|
+
if (key in exports && exports[key] === _InteractionProvider[key]) return;
|
|
113
|
+
Object.defineProperty(exports, key, {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () {
|
|
116
|
+
return _InteractionProvider[key];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
121
|
+
Object.keys(_SeriesContextProvider).forEach(function (key) {
|
|
122
|
+
if (key === "default" || key === "__esModule") return;
|
|
123
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
124
|
+
if (key in exports && exports[key] === _SeriesContextProvider[key]) return;
|
|
125
|
+
Object.defineProperty(exports, key, {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function () {
|
|
128
|
+
return _SeriesContextProvider[key];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
133
|
+
Object.keys(_ZAxisContextProvider).forEach(function (key) {
|
|
134
|
+
if (key === "default" || key === "__esModule") return;
|
|
135
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
136
|
+
if (key in exports && exports[key] === _ZAxisContextProvider[key]) return;
|
|
137
|
+
Object.defineProperty(exports, key, {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () {
|
|
140
|
+
return _ZAxisContextProvider[key];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
var _config = require("../models/seriesType/config");
|
|
145
|
+
Object.keys(_config).forEach(function (key) {
|
|
146
|
+
if (key === "default" || key === "__esModule") return;
|
|
147
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
148
|
+
if (key in exports && exports[key] === _config[key]) return;
|
|
149
|
+
Object.defineProperty(exports, key, {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () {
|
|
152
|
+
return _config[key];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
var _common = require("../models/seriesType/common");
|
|
157
|
+
Object.keys(_common).forEach(function (key) {
|
|
158
|
+
if (key === "default" || key === "__esModule") return;
|
|
159
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
160
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
161
|
+
Object.defineProperty(exports, key, {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: function () {
|
|
164
|
+
return _common[key];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
var _helpers = require("../models/helpers");
|
|
169
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
170
|
+
if (key === "default" || key === "__esModule") return;
|
|
171
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
172
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
173
|
+
Object.defineProperty(exports, key, {
|
|
174
|
+
enumerable: true,
|
|
175
|
+
get: function () {
|
|
176
|
+
return _helpers[key];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
var _zAxis = require("../models/z-axis");
|
|
181
|
+
Object.keys(_zAxis).forEach(function (key) {
|
|
182
|
+
if (key === "default" || key === "__esModule") return;
|
|
183
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
184
|
+
if (key in exports && exports[key] === _zAxis[key]) return;
|
|
185
|
+
Object.defineProperty(exports, key, {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
get: function () {
|
|
188
|
+
return _zAxis[key];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
var _axis = require("../models/axis");
|
|
193
|
+
Object.keys(_axis).forEach(function (key) {
|
|
194
|
+
if (key === "default" || key === "__esModule") return;
|
|
195
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
196
|
+
if (key in exports && exports[key] === _axis[key]) return;
|
|
197
|
+
Object.defineProperty(exports, key, {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function () {
|
|
200
|
+
return _axis[key];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChartSeriesType, CartesianChartSeriesType, ChartSeriesDefaultized } from '../models/seriesType/config';
|
|
2
|
+
export declare function isCartesianSeriesType(seriesType: string): seriesType is CartesianChartSeriesType;
|
|
3
|
+
export declare function isCartesianSeries(series: ChartSeriesDefaultized<ChartSeriesType> & {
|
|
4
|
+
getColor: (dataIndex: number) => string;
|
|
5
|
+
}): series is ChartSeriesDefaultized<CartesianChartSeriesType> & {
|
|
6
|
+
getColor: (dataIndex: number) => string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isCartesianSeries = isCartesianSeries;
|
|
7
|
+
exports.isCartesianSeriesType = isCartesianSeriesType;
|
|
8
|
+
var _configInit = require("./configInit");
|
|
9
|
+
function isCartesianSeriesType(seriesType) {
|
|
10
|
+
return _configInit.cartesianSeriesTypes.getTypes().has(seriesType);
|
|
11
|
+
}
|
|
12
|
+
function isCartesianSeries(series) {
|
|
13
|
+
return isCartesianSeriesType(series.type);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildWarning(message: (...args: any) => string, gravity?: 'warning' | 'error'): (...args: any) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildWarning = buildWarning;
|
|
7
|
+
function buildWarning(message, gravity = 'warning') {
|
|
8
|
+
let alreadyWarned = false;
|
|
9
|
+
return (...args) => {
|
|
10
|
+
if (!alreadyWarned) {
|
|
11
|
+
alreadyWarned = true;
|
|
12
|
+
if (gravity === 'error') {
|
|
13
|
+
console.error(message(...args));
|
|
14
|
+
} else {
|
|
15
|
+
console.warn(message(...args));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
package/models/axis.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ export interface AxisScaleConfig {
|
|
|
182
182
|
colorMap?: ContinuousColorConfig | PiecewiseColorConfig;
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
|
-
interface AxisScaleComputedConfig {
|
|
185
|
+
export interface AxisScaleComputedConfig {
|
|
186
186
|
band: {
|
|
187
187
|
colorScale?: ScaleOrdinal<string | number | Date, string, string | null> | ScaleOrdinal<number, string, string | null> | ScaleSequential<string, string | null> | ScaleThreshold<number | Date, string | null>;
|
|
188
188
|
};
|
|
@@ -216,7 +216,7 @@ export type AxisValueFormatterContext = {
|
|
|
216
216
|
*/
|
|
217
217
|
location: 'tick' | 'tooltip';
|
|
218
218
|
};
|
|
219
|
-
export type AxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
219
|
+
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
|
|
220
220
|
/**
|
|
221
221
|
* Id used to identify the axis.
|
|
222
222
|
*/
|
|
@@ -254,8 +254,8 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
254
254
|
* If `true`, Reverse the axis scaleBand.
|
|
255
255
|
*/
|
|
256
256
|
reverse?: boolean;
|
|
257
|
-
} & Partial<
|
|
258
|
-
export type AxisDefaultized<S extends ScaleName = ScaleName, V = any> = Omit<AxisConfig<S, V>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
257
|
+
} & Partial<AxisProps> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams;
|
|
258
|
+
export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps = ChartsXAxisProps | ChartsYAxisProps> = Omit<AxisConfig<S, V, AxisProps>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
259
259
|
/**
|
|
260
260
|
* An indication of the expected number of ticks.
|
|
261
261
|
*/
|
|
@@ -267,4 +267,3 @@ export declare function isBandScaleConfig(scaleConfig: AxisConfig<ScaleName>): s
|
|
|
267
267
|
export declare function isPointScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'point'> & {
|
|
268
268
|
scaleType: 'point';
|
|
269
269
|
};
|
|
270
|
-
export {};
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -35,4 +35,15 @@ Object.keys(_stacking).forEach(function (key) {
|
|
|
35
35
|
return _stacking[key];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
});
|
|
39
|
+
var _plugin = require("./plugin");
|
|
40
|
+
Object.keys(_plugin).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _plugin[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _plugin[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
38
49
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { 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 {};
|
package/models/plugin.js
ADDED
|
@@ -6,29 +6,44 @@ import { AxisConfig } from '../axis';
|
|
|
6
6
|
import { DefaultizedProps, MakeOptional } from '../helpers';
|
|
7
7
|
import { StackingGroupsType } from '../../internals/stackSeries';
|
|
8
8
|
import { SeriesId } from './common';
|
|
9
|
-
interface ChartsSeriesConfig {
|
|
9
|
+
export interface ChartsSeriesConfig {
|
|
10
10
|
bar: {
|
|
11
|
+
/**
|
|
12
|
+
* Series type when passed to the formatter (some ids are given default values to simplify the DX)
|
|
13
|
+
*/
|
|
11
14
|
seriesInput: DefaultizedProps<BarSeriesType, 'id'> & {
|
|
12
15
|
color: string;
|
|
13
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Series type when stored in the context (with all the preprocessing added))
|
|
19
|
+
*/
|
|
14
20
|
series: DefaultizedBarSeriesType;
|
|
15
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Series typing such that the one user need to provide
|
|
23
|
+
*/
|
|
24
|
+
seriesProp: BarSeriesType;
|
|
16
25
|
itemIdentifier: BarItemIdentifier;
|
|
26
|
+
canBeStacked: true;
|
|
27
|
+
cartesian: true;
|
|
17
28
|
};
|
|
18
29
|
line: {
|
|
19
30
|
seriesInput: DefaultizedProps<LineSeriesType, 'id'> & {
|
|
20
31
|
color: string;
|
|
21
32
|
};
|
|
22
33
|
series: DefaultizedLineSeriesType;
|
|
23
|
-
|
|
34
|
+
seriesProp: LineSeriesType;
|
|
24
35
|
itemIdentifier: LineItemIdentifier;
|
|
36
|
+
canBeStacked: true;
|
|
37
|
+
cartesian: true;
|
|
25
38
|
};
|
|
26
39
|
scatter: {
|
|
27
40
|
seriesInput: DefaultizedProps<ScatterSeriesType, 'id'> & {
|
|
28
41
|
color: string;
|
|
29
42
|
};
|
|
30
43
|
series: DefaultizedScatterSeriesType;
|
|
44
|
+
seriesProp: ScatterSeriesType;
|
|
31
45
|
itemIdentifier: ScatterItemIdentifier;
|
|
46
|
+
cartesian: true;
|
|
32
47
|
};
|
|
33
48
|
pie: {
|
|
34
49
|
seriesInput: Omit<DefaultizedProps<PieSeriesType, 'id'>, 'data'> & {
|
|
@@ -37,11 +52,21 @@ interface ChartsSeriesConfig {
|
|
|
37
52
|
})[];
|
|
38
53
|
};
|
|
39
54
|
series: DefaultizedPieSeriesType;
|
|
55
|
+
seriesProp: PieSeriesType<MakeOptional<PieValueType, 'id'>>;
|
|
40
56
|
itemIdentifier: PieItemIdentifier;
|
|
41
57
|
};
|
|
42
58
|
}
|
|
43
|
-
export type
|
|
44
|
-
export type
|
|
59
|
+
export type ChartSeriesType = keyof ChartsSeriesConfig;
|
|
60
|
+
export type CartesianChartSeriesType = keyof Pick<ChartsSeriesConfig, {
|
|
61
|
+
[Key in ChartSeriesType]: ChartsSeriesConfig[Key] extends {
|
|
62
|
+
cartesian: true;
|
|
63
|
+
} ? Key : never;
|
|
64
|
+
}[ChartSeriesType]>;
|
|
65
|
+
export type StackableChartSeriesType = keyof Pick<ChartsSeriesConfig, {
|
|
66
|
+
[Key in ChartSeriesType]: ChartsSeriesConfig[Key] extends {
|
|
67
|
+
canBeStacked: true;
|
|
68
|
+
} ? Key : never;
|
|
69
|
+
}[ChartSeriesType]>;
|
|
45
70
|
export type ChartSeries<T extends ChartSeriesType> = ChartsSeriesConfig[T] extends {
|
|
46
71
|
canBeStacked: true;
|
|
47
72
|
} ? ChartsSeriesConfig[T]['seriesInput'] & {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type
|
|
9
|
-
type DefaultizedSeriesType = DefaultizedCartesianSeriesType | DefaultizedPieSeriesType;
|
|
10
|
-
type StackableSeriesType = DefaultizedBarSeriesType | DefaultizedLineSeriesType;
|
|
11
|
-
export type SeriesItemIdentifier = BarItemIdentifier | LineItemIdentifier | ScatterItemIdentifier | PieItemIdentifier;
|
|
1
|
+
import { BarSeriesType, DefaultizedBarSeriesType } from './bar';
|
|
2
|
+
import { CartesianChartSeriesType, ChartSeriesType, ChartsSeriesConfig, StackableChartSeriesType } from './config';
|
|
3
|
+
type AllSeriesType<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['seriesProp'];
|
|
4
|
+
type CartesianSeriesType = AllSeriesType<CartesianChartSeriesType>;
|
|
5
|
+
type DefaultizedSeriesType<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['series'];
|
|
6
|
+
type DefaultizedCartesianSeriesType = DefaultizedSeriesType<CartesianChartSeriesType>;
|
|
7
|
+
type StackableSeriesType = DefaultizedSeriesType<StackableChartSeriesType>;
|
|
8
|
+
export type SeriesItemIdentifier<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
12
9
|
export * from './line';
|
|
13
10
|
export * from './bar';
|
|
14
11
|
export * from './scatter';
|
|
@@ -351,7 +351,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
351
351
|
labelStyle: PropTypes.object,
|
|
352
352
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
353
353
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
354
|
-
position: PropTypes.oneOf(['bottom', '
|
|
354
|
+
position: PropTypes.oneOf(['bottom', 'top']),
|
|
355
355
|
reverse: PropTypes.bool,
|
|
356
356
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
357
357
|
slotProps: PropTypes.object,
|
|
@@ -404,7 +404,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
404
404
|
labelStyle: PropTypes.object,
|
|
405
405
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
406
406
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
407
|
-
position: PropTypes.oneOf(['
|
|
407
|
+
position: PropTypes.oneOf(['left', 'right']),
|
|
408
408
|
reverse: PropTypes.bool,
|
|
409
409
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
410
410
|
slotProps: PropTypes.object,
|
|
@@ -4,7 +4,6 @@ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
7
|
-
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
8
7
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
8
|
import { BarElement } from './BarElement';
|
|
10
9
|
import getColor from './getColor';
|
|
@@ -12,6 +11,7 @@ import { useChartId } from '../hooks';
|
|
|
12
11
|
import { BarClipPath } from './BarClipPath';
|
|
13
12
|
import { BarLabelPlot } from './BarLabel/BarLabelPlot';
|
|
14
13
|
import { checkScaleErrors } from './checkScaleErrors';
|
|
14
|
+
import { useBarSeries } from '../hooks/useSeries';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Solution of the equations
|
|
@@ -42,7 +42,7 @@ function getBandSize({
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
const useAggregatedData = () => {
|
|
45
|
-
const seriesData =
|
|
45
|
+
const seriesData = useBarSeries() ?? {
|
|
46
46
|
series: {},
|
|
47
47
|
stackingGroups: [],
|
|
48
48
|
seriesOrder: []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { stack as d3Stack } from 'd3-shape';
|
|
3
3
|
import { getStackingGroups } from '../internals/stackSeries';
|
|
4
|
-
import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
|
|
4
|
+
import { defaultizeValueFormatter } from '../internals/defaultizeValueFormatter';
|
|
5
5
|
let warnOnce = false;
|
|
6
6
|
const formatter = (params, dataset) => {
|
|
7
7
|
const {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default function getColor(series, xAxis, yAxis) {
|
|
2
2
|
const verticalLayout = series.layout === 'vertical';
|
|
3
|
-
const bandColorScale = verticalLayout ? xAxis
|
|
4
|
-
const valueColorScale = verticalLayout ? yAxis
|
|
5
|
-
const bandValues = verticalLayout ? xAxis
|
|
3
|
+
const bandColorScale = verticalLayout ? xAxis?.colorScale : yAxis?.colorScale;
|
|
4
|
+
const valueColorScale = verticalLayout ? yAxis?.colorScale : xAxis?.colorScale;
|
|
5
|
+
const bandValues = verticalLayout ? xAxis?.data : yAxis?.data;
|
|
6
6
|
if (valueColorScale) {
|
|
7
7
|
return dataIndex => {
|
|
8
8
|
const value = series.data[dataIndex];
|
|
@@ -13,7 +13,7 @@ export default function getColor(series, xAxis, yAxis) {
|
|
|
13
13
|
return color;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
if (bandColorScale) {
|
|
16
|
+
if (bandColorScale && bandValues) {
|
|
17
17
|
return dataIndex => {
|
|
18
18
|
const value = bandValues[dataIndex];
|
|
19
19
|
const color = value === null ? series.color : bandColorScale(value);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getExtremumX, getExtremumY } from './extremums';
|
|
2
|
+
import formatter from './formatter';
|
|
3
|
+
import getColor from './getColor';
|
|
4
|
+
export const plugin = {
|
|
5
|
+
seriesType: 'bar',
|
|
6
|
+
seriesFormatter: formatter,
|
|
7
|
+
colorProcessor: getColor,
|
|
8
|
+
xExtremumGetter: getExtremumX,
|
|
9
|
+
yExtremumGetter: getExtremumY
|
|
10
|
+
};
|