@mui/x-charts 6.18.0 → 7.0.0-alpha.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 +15 -8
- package/BarChart/BarChart.js +41 -4
- package/BarChart/BarPlot.d.ts +2 -2
- package/CHANGELOG.md +212 -5
- package/ChartsAxis/ChartsAxis.d.ts +3 -3
- package/ChartsAxis/ChartsAxis.js +5 -5
- package/ChartsAxis/axisClasses.d.ts +2 -2
- package/ChartsLegend/ChartsLegend.d.ts +10 -6
- package/ChartsLegend/ChartsLegend.js +137 -2
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/chartsLegendClasses.js +2 -2
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
- package/ChartsReferenceLine/common.d.ts +41 -0
- package/ChartsReferenceLine/common.js +27 -0
- package/ChartsReferenceLine/index.d.ts +2 -0
- package/ChartsReferenceLine/index.js +27 -0
- package/ChartsReferenceLine/package.json +6 -0
- package/ChartsSurface.d.ts +11 -0
- package/ChartsTooltip/ChartsTooltip.d.ts +4 -4
- package/ChartsXAxis/ChartsXAxis.js +9 -5
- package/ChartsYAxis/ChartsYAxis.js +9 -5
- package/LineChart/AreaPlot.d.ts +2 -2
- package/LineChart/LineChart.d.ts +18 -11
- package/LineChart/LineChart.js +41 -4
- package/LineChart/LineHighlightPlot.d.ts +4 -4
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.d.ts +2 -2
- package/LineChart/MarkPlot.d.ts +4 -4
- package/LineChart/MarkPlot.js +2 -1
- package/PieChart/PieArcLabelPlot.d.ts +4 -4
- package/PieChart/PieArcPlot.d.ts +4 -4
- package/PieChart/PieChart.d.ts +8 -8
- package/PieChart/PieChart.js +34 -4
- package/PieChart/PiePlot.d.ts +6 -6
- package/ResponsiveChartContainer/index.d.ts +13 -3
- package/ScatterChart/ScatterChart.d.ts +8 -8
- package/ScatterChart/ScatterChart.js +34 -4
- package/ScatterChart/ScatterPlot.d.ts +4 -4
- package/SparkLineChart/SparkLineChart.d.ts +10 -10
- package/SparkLineChart/SparkLineChart.js +22 -0
- package/context/CartesianContextProvider.d.ts +21 -1
- package/context/CartesianContextProvider.js +11 -0
- package/context/DrawingProvider.d.ts +18 -0
- package/context/DrawingProvider.js +6 -0
- package/context/HighlightProvider.d.ts +17 -0
- package/context/InteractionProvider.d.ts +6 -0
- package/context/SeriesContextProvider.d.ts +5 -0
- package/esm/BarChart/BarChart.js +41 -4
- package/esm/ChartsAxis/ChartsAxis.js +6 -5
- package/esm/ChartsLegend/ChartsLegend.js +140 -4
- package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/esm/ChartsReferenceLine/common.js +20 -0
- package/esm/ChartsReferenceLine/index.js +2 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
- package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
- package/esm/LineChart/LineChart.js +41 -4
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/MarkPlot.js +2 -1
- package/esm/PieChart/PieChart.js +34 -4
- package/esm/ScatterChart/ScatterChart.js +34 -4
- package/esm/SparkLineChart/SparkLineChart.js +22 -0
- package/esm/context/CartesianContextProvider.js +11 -0
- package/esm/context/DrawingProvider.js +6 -0
- package/esm/index.js +2 -0
- package/esm/internals/geometry.js +2 -2
- package/hooks/useScale.d.ts +2 -2
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/internals/components/ChartsText.d.ts +1 -1
- package/internals/geometry.d.ts +2 -2
- package/internals/geometry.js +2 -2
- package/internals/isBandScale.d.ts +3 -1
- package/internals/utils.d.ts +5 -0
- package/legacy/BarChart/BarChart.js +41 -4
- package/legacy/ChartsAxis/ChartsAxis.js +6 -5
- package/legacy/ChartsLegend/ChartsLegend.js +140 -4
- package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/legacy/ChartsReferenceLine/common.js +20 -0
- package/legacy/ChartsReferenceLine/index.js +2 -0
- package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
- package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
- package/legacy/LineChart/LineChart.js +41 -4
- package/legacy/LineChart/LineHighlightPlot.js +1 -1
- package/legacy/LineChart/MarkPlot.js +2 -1
- package/legacy/PieChart/PieChart.js +34 -4
- package/legacy/ScatterChart/ScatterChart.js +34 -4
- package/legacy/SparkLineChart/SparkLineChart.js +22 -0
- package/legacy/context/CartesianContextProvider.js +11 -0
- package/legacy/context/DrawingProvider.js +6 -0
- package/legacy/index.js +3 -1
- package/legacy/internals/geometry.js +2 -2
- package/models/axis.d.ts +37 -17
- package/models/layout.d.ts +6 -0
- package/models/seriesType/common.d.ts +16 -0
- package/modern/BarChart/BarChart.js +41 -4
- package/modern/ChartsAxis/ChartsAxis.js +5 -5
- package/modern/ChartsLegend/ChartsLegend.js +140 -4
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/modern/ChartsReferenceLine/common.js +20 -0
- package/modern/ChartsReferenceLine/index.js +2 -0
- package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
- package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
- package/modern/LineChart/LineChart.js +41 -4
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/MarkPlot.js +2 -1
- package/modern/PieChart/PieChart.js +34 -4
- package/modern/ScatterChart/ScatterChart.js +34 -4
- package/modern/SparkLineChart/SparkLineChart.js +22 -0
- package/modern/context/CartesianContextProvider.js +11 -0
- package/modern/context/DrawingProvider.js +6 -0
- package/modern/index.js +3 -1
- package/modern/internals/geometry.js +2 -2
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ScatterPlotSlotProps, ScatterPlotSlots } from './ScatterPlot';
|
|
3
3
|
import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
|
|
4
4
|
import { ChartsAxisProps } from '../ChartsAxis';
|
|
5
5
|
import { ScatterSeriesType } from '../models/seriesType/scatter';
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
|
-
import { ChartsTooltipProps,
|
|
8
|
-
import { ChartsLegendProps,
|
|
7
|
+
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
8
|
+
import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
9
9
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
10
|
-
import {
|
|
11
|
-
export interface
|
|
10
|
+
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
11
|
+
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
|
|
14
14
|
}
|
|
15
15
|
export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
|
|
16
16
|
series: MakeOptional<ScatterSeriesType, 'type'>[];
|
|
@@ -24,12 +24,12 @@ export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, '
|
|
|
24
24
|
* Overridable component slots.
|
|
25
25
|
* @default {}
|
|
26
26
|
*/
|
|
27
|
-
slots?:
|
|
27
|
+
slots?: ScatterChartSlots;
|
|
28
28
|
/**
|
|
29
29
|
* The props used for each component slot.
|
|
30
30
|
* @default {}
|
|
31
31
|
*/
|
|
32
|
-
slotProps?:
|
|
32
|
+
slotProps?: ScatterChartSlotProps;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Demos:
|
|
@@ -96,7 +96,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
96
96
|
* @default xAxisIds[0] The id of the first provided axis
|
|
97
97
|
*/
|
|
98
98
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
99
|
-
axisId: _propTypes.default.string
|
|
99
|
+
axisId: _propTypes.default.string,
|
|
100
100
|
classes: _propTypes.default.object,
|
|
101
101
|
disableLine: _propTypes.default.bool,
|
|
102
102
|
disableTicks: _propTypes.default.bool,
|
|
@@ -123,9 +123,21 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
123
123
|
* Color palette used to colorize multiple series.
|
|
124
124
|
*/
|
|
125
125
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
126
|
+
/**
|
|
127
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
128
|
+
*/
|
|
126
129
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
127
130
|
desc: _propTypes.default.string,
|
|
131
|
+
/**
|
|
132
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
133
|
+
* It might break interactive features, but will improve performance.
|
|
134
|
+
* @default false
|
|
135
|
+
*/
|
|
128
136
|
disableAxisListener: _propTypes.default.bool,
|
|
137
|
+
/**
|
|
138
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
139
|
+
* @default undefined
|
|
140
|
+
*/
|
|
129
141
|
height: _propTypes.default.number,
|
|
130
142
|
/**
|
|
131
143
|
* Indicate which axis to display the left of the charts.
|
|
@@ -133,7 +145,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
133
145
|
* @default yAxisIds[0] The id of the first provided axis
|
|
134
146
|
*/
|
|
135
147
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
136
|
-
axisId: _propTypes.default.string
|
|
148
|
+
axisId: _propTypes.default.string,
|
|
137
149
|
classes: _propTypes.default.object,
|
|
138
150
|
disableLine: _propTypes.default.bool,
|
|
139
151
|
disableTicks: _propTypes.default.bool,
|
|
@@ -168,6 +180,12 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
168
180
|
slotProps: _propTypes.default.object,
|
|
169
181
|
slots: _propTypes.default.object
|
|
170
182
|
}),
|
|
183
|
+
/**
|
|
184
|
+
* The margin between the SVG and the drawing area.
|
|
185
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
186
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
187
|
+
* @default object Depends on the charts type.
|
|
188
|
+
*/
|
|
171
189
|
margin: _propTypes.default.shape({
|
|
172
190
|
bottom: _propTypes.default.number,
|
|
173
191
|
left: _propTypes.default.number,
|
|
@@ -180,7 +198,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
180
198
|
* @default null
|
|
181
199
|
*/
|
|
182
200
|
rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
183
|
-
axisId: _propTypes.default.string
|
|
201
|
+
axisId: _propTypes.default.string,
|
|
184
202
|
classes: _propTypes.default.object,
|
|
185
203
|
disableLine: _propTypes.default.bool,
|
|
186
204
|
disableTicks: _propTypes.default.bool,
|
|
@@ -246,7 +264,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
246
264
|
* @default null
|
|
247
265
|
*/
|
|
248
266
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
249
|
-
axisId: _propTypes.default.string
|
|
267
|
+
axisId: _propTypes.default.string,
|
|
250
268
|
classes: _propTypes.default.object,
|
|
251
269
|
disableLine: _propTypes.default.bool,
|
|
252
270
|
disableTicks: _propTypes.default.bool,
|
|
@@ -273,7 +291,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
273
291
|
x: _propTypes.default.number,
|
|
274
292
|
y: _propTypes.default.number
|
|
275
293
|
}),
|
|
294
|
+
/**
|
|
295
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
296
|
+
* @default undefined
|
|
297
|
+
*/
|
|
276
298
|
width: _propTypes.default.number,
|
|
299
|
+
/**
|
|
300
|
+
* The configuration of the x-axes.
|
|
301
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
302
|
+
*/
|
|
277
303
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
278
304
|
axisId: _propTypes.default.string,
|
|
279
305
|
classes: _propTypes.default.object,
|
|
@@ -304,6 +330,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
304
330
|
tickSize: _propTypes.default.number,
|
|
305
331
|
valueFormatter: _propTypes.default.func
|
|
306
332
|
})),
|
|
333
|
+
/**
|
|
334
|
+
* The configuration of the y-axes.
|
|
335
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
336
|
+
*/
|
|
307
337
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
308
338
|
axisId: _propTypes.default.string,
|
|
309
339
|
classes: _propTypes.default.object,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ScatterProps } from './Scatter';
|
|
3
|
-
export interface
|
|
3
|
+
export interface ScatterPlotSlots {
|
|
4
4
|
scatter?: React.JSXElementConstructor<ScatterProps>;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface ScatterPlotSlotProps {
|
|
7
7
|
scatter?: Partial<ScatterProps>;
|
|
8
8
|
}
|
|
9
9
|
export interface ScatterPlotProps {
|
|
@@ -11,12 +11,12 @@ export interface ScatterPlotProps {
|
|
|
11
11
|
* Overridable component slots.
|
|
12
12
|
* @default {}
|
|
13
13
|
*/
|
|
14
|
-
slots?:
|
|
14
|
+
slots?: ScatterPlotSlots;
|
|
15
15
|
/**
|
|
16
16
|
* The props used for each component slot.
|
|
17
17
|
* @default {}
|
|
18
18
|
*/
|
|
19
|
-
slotProps?:
|
|
19
|
+
slotProps?: ScatterPlotSlotProps;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Demos:
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
|
|
3
|
-
import { ChartsTooltipProps,
|
|
3
|
+
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
4
4
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
5
5
|
import { AxisConfig } from '../models/axis';
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
export interface
|
|
8
|
+
import { AreaPlotSlots, AreaPlotSlotProps } from '../LineChart/AreaPlot';
|
|
9
|
+
import { LinePlotSlots, LinePlotSlotProps } from '../LineChart/LinePlot';
|
|
10
|
+
import { MarkPlotSlots, MarkPlotSlotProps } from '../LineChart/MarkPlot';
|
|
11
|
+
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from '../LineChart/LineHighlightPlot';
|
|
12
|
+
import { BarPlotSlots, BarPlotSlotProps } from '../BarChart/BarPlot';
|
|
13
|
+
export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, BarPlotSlots, ChartsTooltipSlots {
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {
|
|
16
16
|
}
|
|
17
17
|
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis'> {
|
|
18
18
|
/**
|
|
@@ -63,12 +63,12 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
63
63
|
* Overridable component slots.
|
|
64
64
|
* @default {}
|
|
65
65
|
*/
|
|
66
|
-
slots?:
|
|
66
|
+
slots?: SparkLineChartSlots;
|
|
67
67
|
/**
|
|
68
68
|
* The props used for each component slot.
|
|
69
69
|
* @default {}
|
|
70
70
|
*/
|
|
71
|
-
slotProps?:
|
|
71
|
+
slotProps?: SparkLineChartSlotProps;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Demos:
|
|
@@ -137,10 +137,28 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
137
137
|
* Data to plot.
|
|
138
138
|
*/
|
|
139
139
|
data: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
|
140
|
+
/**
|
|
141
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
142
|
+
*/
|
|
140
143
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
141
144
|
desc: _propTypes.default.string,
|
|
145
|
+
/**
|
|
146
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
147
|
+
* It might break interactive features, but will improve performance.
|
|
148
|
+
* @default false
|
|
149
|
+
*/
|
|
142
150
|
disableAxisListener: _propTypes.default.bool,
|
|
151
|
+
/**
|
|
152
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
153
|
+
* @default undefined
|
|
154
|
+
*/
|
|
143
155
|
height: _propTypes.default.number,
|
|
156
|
+
/**
|
|
157
|
+
* The margin between the SVG and the drawing area.
|
|
158
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
159
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
160
|
+
* @default object Depends on the charts type.
|
|
161
|
+
*/
|
|
144
162
|
margin: _propTypes.default.shape({
|
|
145
163
|
bottom: _propTypes.default.number,
|
|
146
164
|
left: _propTypes.default.number,
|
|
@@ -196,6 +214,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
196
214
|
x: _propTypes.default.number,
|
|
197
215
|
y: _propTypes.default.number
|
|
198
216
|
}),
|
|
217
|
+
/**
|
|
218
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
219
|
+
* @default undefined
|
|
220
|
+
*/
|
|
199
221
|
width: _propTypes.default.number,
|
|
200
222
|
/**
|
|
201
223
|
* The xAxis configuration.
|
|
@@ -4,8 +4,19 @@ import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
|
4
4
|
import { DatasetType } from '../models/seriesType/config';
|
|
5
5
|
import { MakeOptional } from '../models/helpers';
|
|
6
6
|
export type CartesianContextProviderProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The configuration of the x-axes.
|
|
9
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
10
|
+
*/
|
|
7
11
|
xAxis?: MakeOptional<AxisConfig, 'id'>[];
|
|
12
|
+
/**
|
|
13
|
+
* The configuration of the y-axes.
|
|
14
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
15
|
+
*/
|
|
8
16
|
yAxis?: MakeOptional<AxisConfig, 'id'>[];
|
|
17
|
+
/**
|
|
18
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
19
|
+
*/
|
|
9
20
|
dataset?: DatasetType;
|
|
10
21
|
children: React.ReactNode;
|
|
11
22
|
};
|
|
@@ -14,15 +25,24 @@ type DefaultizedAxisConfig = {
|
|
|
14
25
|
};
|
|
15
26
|
export declare const CartesianContext: React.Context<{
|
|
16
27
|
/**
|
|
17
|
-
* Mapping from axis key to scaling
|
|
28
|
+
* Mapping from x-axis key to scaling configuration.
|
|
18
29
|
*/
|
|
19
30
|
xAxis: {
|
|
20
31
|
DEFAULT_X_AXIS_KEY: AxisDefaultized;
|
|
21
32
|
} & DefaultizedAxisConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Mapping from y-axis key to scaling configuration.
|
|
35
|
+
*/
|
|
22
36
|
yAxis: {
|
|
23
37
|
DEFAULT_X_AXIS_KEY: AxisDefaultized;
|
|
24
38
|
} & DefaultizedAxisConfig;
|
|
39
|
+
/**
|
|
40
|
+
* The x-axes IDs sorted by order they got provided.
|
|
41
|
+
*/
|
|
25
42
|
xAxisIds: string[];
|
|
43
|
+
/**
|
|
44
|
+
* The y-axes IDs sorted by order they got provided.
|
|
45
|
+
*/
|
|
26
46
|
yAxisIds: string[];
|
|
27
47
|
}>;
|
|
28
48
|
/**
|
|
@@ -225,7 +225,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
225
225
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
226
226
|
// ----------------------------------------------------------------------
|
|
227
227
|
children: _propTypes.default.node,
|
|
228
|
+
/**
|
|
229
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
230
|
+
*/
|
|
228
231
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
232
|
+
/**
|
|
233
|
+
* The configuration of the x-axes.
|
|
234
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
235
|
+
*/
|
|
229
236
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
230
237
|
axisId: _propTypes.default.string,
|
|
231
238
|
classes: _propTypes.default.object,
|
|
@@ -256,6 +263,10 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
256
263
|
tickSize: _propTypes.default.number,
|
|
257
264
|
valueFormatter: _propTypes.default.func
|
|
258
265
|
})),
|
|
266
|
+
/**
|
|
267
|
+
* The configuration of the y-axes.
|
|
268
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
269
|
+
*/
|
|
259
270
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
260
271
|
axisId: _propTypes.default.string,
|
|
261
272
|
classes: _propTypes.default.object,
|
|
@@ -8,11 +8,29 @@ export interface DrawingProviderProps extends LayoutConfig {
|
|
|
8
8
|
* Defines the area in which it is possible to draw the charts.
|
|
9
9
|
*/
|
|
10
10
|
export type DrawingArea = {
|
|
11
|
+
/**
|
|
12
|
+
* The gap between the left border of the SVG and the drawing area.
|
|
13
|
+
*/
|
|
11
14
|
left: number;
|
|
15
|
+
/**
|
|
16
|
+
* The gap between the top border of the SVG and the drawing area.
|
|
17
|
+
*/
|
|
12
18
|
top: number;
|
|
19
|
+
/**
|
|
20
|
+
* The gap between the bottom border of the SVG and the drawing area.
|
|
21
|
+
*/
|
|
13
22
|
bottom: number;
|
|
23
|
+
/**
|
|
24
|
+
* The gap between the right border of the SVG and the drawing area.
|
|
25
|
+
*/
|
|
14
26
|
right: number;
|
|
27
|
+
/**
|
|
28
|
+
* The width of the drawing area.
|
|
29
|
+
*/
|
|
15
30
|
width: number;
|
|
31
|
+
/**
|
|
32
|
+
* The height of the drawing area.
|
|
33
|
+
*/
|
|
16
34
|
height: number;
|
|
17
35
|
};
|
|
18
36
|
export declare const DrawingContext: React.Context<DrawingArea>;
|
|
@@ -57,6 +57,12 @@ process.env.NODE_ENV !== "production" ? DrawingProvider.propTypes = {
|
|
|
57
57
|
// ----------------------------------------------------------------------
|
|
58
58
|
children: _propTypes.default.node,
|
|
59
59
|
height: _propTypes.default.number.isRequired,
|
|
60
|
+
/**
|
|
61
|
+
* The margin between the SVG and the drawing area.
|
|
62
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
63
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
64
|
+
* @default object Depends on the charts type.
|
|
65
|
+
*/
|
|
60
66
|
margin: _propTypes.default.shape({
|
|
61
67
|
bottom: _propTypes.default.number,
|
|
62
68
|
left: _propTypes.default.number,
|
|
@@ -7,7 +7,21 @@ export type ItemHighlighData<T extends ChartSeriesType> = ChartItemIdentifier<T>
|
|
|
7
7
|
export type HighlightOptions = 'none' | 'item' | 'series';
|
|
8
8
|
export type FadeOptions = 'none' | 'series' | 'global';
|
|
9
9
|
export type HighlightScope = {
|
|
10
|
+
/**
|
|
11
|
+
* The scope of highlighted elements.
|
|
12
|
+
* - 'none': no highlight.
|
|
13
|
+
* - 'item': only highlight the item.
|
|
14
|
+
* - 'series': highlight all elements of the same series.
|
|
15
|
+
* @default 'none'
|
|
16
|
+
*/
|
|
10
17
|
highlighted: HighlightOptions;
|
|
18
|
+
/**
|
|
19
|
+
* The scope of faded elements.
|
|
20
|
+
* - 'none': no fading.
|
|
21
|
+
* - 'series': only fade element of the same series.
|
|
22
|
+
* - 'global': fade all elements that are not highlighted.
|
|
23
|
+
* @default 'none'
|
|
24
|
+
*/
|
|
11
25
|
faded: FadeOptions;
|
|
12
26
|
};
|
|
13
27
|
type HighlighActions<T extends ChartSeriesType = ChartSeriesType> = {
|
|
@@ -19,6 +33,9 @@ type HighlighActions<T extends ChartSeriesType = ChartSeriesType> = {
|
|
|
19
33
|
item: ItemHighlighData<T>;
|
|
20
34
|
};
|
|
21
35
|
type HighlighState = {
|
|
36
|
+
/**
|
|
37
|
+
* The item that triggers the highlight state.
|
|
38
|
+
*/
|
|
22
39
|
item: null | ItemHighlighData<ChartSeriesType>;
|
|
23
40
|
scope: HighlightScope;
|
|
24
41
|
dispatch: React.Dispatch<HighlighActions>;
|
|
@@ -25,7 +25,13 @@ type InteractionActions<T extends ChartSeriesType = ChartSeriesType> = {
|
|
|
25
25
|
data: AxisInteractionData;
|
|
26
26
|
};
|
|
27
27
|
type InteractionState = {
|
|
28
|
+
/**
|
|
29
|
+
* The item currently interacting.
|
|
30
|
+
*/
|
|
28
31
|
item: null | ItemInteractionData<ChartSeriesType>;
|
|
32
|
+
/**
|
|
33
|
+
* The x- and y-axes currently interacting.
|
|
34
|
+
*/
|
|
29
35
|
axis: AxisInteractionData;
|
|
30
36
|
dispatch: React.Dispatch<InteractionActions>;
|
|
31
37
|
};
|
|
@@ -4,6 +4,11 @@ import { ChartSeriesType, DatasetType, FormatterResult } from '../models/seriesT
|
|
|
4
4
|
import { ChartsColorPalette } from '../colorPalettes';
|
|
5
5
|
export type SeriesContextProviderProps = {
|
|
6
6
|
dataset?: DatasetType;
|
|
7
|
+
/**
|
|
8
|
+
* The array of series to display.
|
|
9
|
+
* Each type of series has its own specificity.
|
|
10
|
+
* Please refer to the appropriate docs page to learn more about it.
|
|
11
|
+
*/
|
|
7
12
|
series: AllSeriesType[];
|
|
8
13
|
/**
|
|
9
14
|
* Color palette used to colorize multiple series.
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -114,6 +114,13 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
114
114
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
115
115
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
116
116
|
// ----------------------------------------------------------------------
|
|
117
|
+
/**
|
|
118
|
+
* Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
|
|
119
|
+
* The two properties accept the following values:
|
|
120
|
+
* - 'none': display nothing.
|
|
121
|
+
* - 'line': display a line at the current mouse position.
|
|
122
|
+
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
123
|
+
*/
|
|
117
124
|
axisHighlight: PropTypes.shape({
|
|
118
125
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
119
126
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
@@ -124,7 +131,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
124
131
|
* @default xAxisIds[0] The id of the first provided axis
|
|
125
132
|
*/
|
|
126
133
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
127
|
-
axisId: PropTypes.string
|
|
134
|
+
axisId: PropTypes.string,
|
|
128
135
|
classes: PropTypes.object,
|
|
129
136
|
disableLine: PropTypes.bool,
|
|
130
137
|
disableTicks: PropTypes.bool,
|
|
@@ -151,9 +158,21 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
151
158
|
* Color palette used to colorize multiple series.
|
|
152
159
|
*/
|
|
153
160
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
161
|
+
/**
|
|
162
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
163
|
+
*/
|
|
154
164
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
155
165
|
desc: PropTypes.string,
|
|
166
|
+
/**
|
|
167
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
168
|
+
* It might break interactive features, but will improve performance.
|
|
169
|
+
* @default false
|
|
170
|
+
*/
|
|
156
171
|
disableAxisListener: PropTypes.bool,
|
|
172
|
+
/**
|
|
173
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
174
|
+
* @default undefined
|
|
175
|
+
*/
|
|
157
176
|
height: PropTypes.number,
|
|
158
177
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
159
178
|
/**
|
|
@@ -162,7 +181,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
162
181
|
* @default yAxisIds[0] The id of the first provided axis
|
|
163
182
|
*/
|
|
164
183
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
165
|
-
axisId: PropTypes.string
|
|
184
|
+
axisId: PropTypes.string,
|
|
166
185
|
classes: PropTypes.object,
|
|
167
186
|
disableLine: PropTypes.bool,
|
|
168
187
|
disableTicks: PropTypes.bool,
|
|
@@ -197,6 +216,12 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
197
216
|
slotProps: PropTypes.object,
|
|
198
217
|
slots: PropTypes.object
|
|
199
218
|
}),
|
|
219
|
+
/**
|
|
220
|
+
* The margin between the SVG and the drawing area.
|
|
221
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
222
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
223
|
+
* @default object Depends on the charts type.
|
|
224
|
+
*/
|
|
200
225
|
margin: PropTypes.shape({
|
|
201
226
|
bottom: PropTypes.number,
|
|
202
227
|
left: PropTypes.number,
|
|
@@ -209,7 +234,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
209
234
|
* @default null
|
|
210
235
|
*/
|
|
211
236
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
212
|
-
axisId: PropTypes.string
|
|
237
|
+
axisId: PropTypes.string,
|
|
213
238
|
classes: PropTypes.object,
|
|
214
239
|
disableLine: PropTypes.bool,
|
|
215
240
|
disableTicks: PropTypes.bool,
|
|
@@ -280,7 +305,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
280
305
|
* @default null
|
|
281
306
|
*/
|
|
282
307
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
283
|
-
axisId: PropTypes.string
|
|
308
|
+
axisId: PropTypes.string,
|
|
284
309
|
classes: PropTypes.object,
|
|
285
310
|
disableLine: PropTypes.bool,
|
|
286
311
|
disableTicks: PropTypes.bool,
|
|
@@ -307,7 +332,15 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
307
332
|
x: PropTypes.number,
|
|
308
333
|
y: PropTypes.number
|
|
309
334
|
}),
|
|
335
|
+
/**
|
|
336
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
337
|
+
* @default undefined
|
|
338
|
+
*/
|
|
310
339
|
width: PropTypes.number,
|
|
340
|
+
/**
|
|
341
|
+
* The configuration of the x-axes.
|
|
342
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
343
|
+
*/
|
|
311
344
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
312
345
|
axisId: PropTypes.string,
|
|
313
346
|
classes: PropTypes.object,
|
|
@@ -338,6 +371,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
338
371
|
tickSize: PropTypes.number,
|
|
339
372
|
valueFormatter: PropTypes.func
|
|
340
373
|
})),
|
|
374
|
+
/**
|
|
375
|
+
* The configuration of the y-axes.
|
|
376
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
377
|
+
*/
|
|
341
378
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
342
379
|
axisId: PropTypes.string,
|
|
343
380
|
classes: PropTypes.object,
|
|
@@ -11,7 +11,8 @@ const getAxisId = propsValue => {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
if (typeof propsValue === 'object') {
|
|
14
|
-
|
|
14
|
+
var _propsValue$axisId;
|
|
15
|
+
return (_propsValue$axisId = propsValue.axisId) != null ? _propsValue$axisId : null;
|
|
15
16
|
}
|
|
16
17
|
return propsValue;
|
|
17
18
|
};
|
|
@@ -100,7 +101,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
100
101
|
* @default xAxisIds[0] The id of the first provided axis
|
|
101
102
|
*/
|
|
102
103
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
103
|
-
axisId: PropTypes.string
|
|
104
|
+
axisId: PropTypes.string,
|
|
104
105
|
classes: PropTypes.object,
|
|
105
106
|
disableLine: PropTypes.bool,
|
|
106
107
|
disableTicks: PropTypes.bool,
|
|
@@ -127,7 +128,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
127
128
|
* @default yAxisIds[0] The id of the first provided axis
|
|
128
129
|
*/
|
|
129
130
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
130
|
-
axisId: PropTypes.string
|
|
131
|
+
axisId: PropTypes.string,
|
|
131
132
|
classes: PropTypes.object,
|
|
132
133
|
disableLine: PropTypes.bool,
|
|
133
134
|
disableTicks: PropTypes.bool,
|
|
@@ -154,7 +155,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
154
155
|
* @default null
|
|
155
156
|
*/
|
|
156
157
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
157
|
-
axisId: PropTypes.string
|
|
158
|
+
axisId: PropTypes.string,
|
|
158
159
|
classes: PropTypes.object,
|
|
159
160
|
disableLine: PropTypes.bool,
|
|
160
161
|
disableTicks: PropTypes.bool,
|
|
@@ -191,7 +192,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
191
192
|
* @default null
|
|
192
193
|
*/
|
|
193
194
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
194
|
-
axisId: PropTypes.string
|
|
195
|
+
axisId: PropTypes.string,
|
|
195
196
|
classes: PropTypes.object,
|
|
196
197
|
disableLine: PropTypes.bool,
|
|
197
198
|
disableTicks: PropTypes.bool,
|