@mui/x-charts 8.8.0 → 8.9.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 +3 -2
- package/BarChart/BarChart.js +1 -1
- package/BarChart/barClasses.d.ts +1 -1
- package/BarChart/seriesConfig/seriesProcessor.js +5 -3
- package/BarChart/useBarPlotData.js +32 -5
- package/CHANGELOG.md +101 -24
- package/ChartsLabel/ChartsLabelMark.d.ts +2 -1
- package/ChartsLabel/index.d.ts +1 -0
- package/ChartsLabel/index.js +18 -0
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/LineChart/LineChart.d.ts +3 -2
- package/LineChart/LineChart.js +1 -1
- package/PieChart/PieArcLabelPlot.js +3 -0
- package/PieChart/PieArcPlot.js +3 -0
- package/PieChart/PieChart.d.ts +3 -2
- package/PieChart/PieChart.js +1 -1
- package/PieChart/pieClasses.d.ts +1 -1
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
- package/RadarChart/RadarChart.d.ts +2 -1
- package/RadarChart/RadarChart.js +23 -2
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -2
- package/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +38 -0
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
- package/RadarChart/index.d.ts +1 -1
- package/RadarChart/useRadarChartProps.d.ts +3 -0
- package/RadarChart/useRadarChartProps.js +15 -3
- package/ScatterChart/ScatterChart.d.ts +3 -2
- package/ScatterChart/ScatterChart.js +1 -1
- package/esm/BarChart/BarChart.d.ts +3 -2
- package/esm/BarChart/BarChart.js +1 -1
- package/esm/BarChart/barClasses.d.ts +1 -1
- package/esm/BarChart/seriesConfig/seriesProcessor.js +5 -3
- package/esm/BarChart/useBarPlotData.js +32 -5
- package/esm/ChartsLabel/ChartsLabelMark.d.ts +2 -1
- package/esm/ChartsLabel/index.d.ts +1 -0
- package/esm/ChartsLabel/index.js +1 -0
- package/esm/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/esm/LineChart/LineChart.d.ts +3 -2
- package/esm/LineChart/LineChart.js +1 -1
- package/esm/PieChart/PieArcLabelPlot.js +3 -0
- package/esm/PieChart/PieArcPlot.js +3 -0
- package/esm/PieChart/PieChart.d.ts +3 -2
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/PieChart/pieClasses.d.ts +1 -1
- package/esm/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
- package/esm/RadarChart/RadarChart.d.ts +2 -1
- package/esm/RadarChart/RadarChart.js +23 -2
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -2
- package/esm/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
- package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
- package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +32 -0
- package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
- package/esm/RadarChart/index.d.ts +1 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +3 -0
- package/esm/RadarChart/useRadarChartProps.js +15 -3
- package/esm/ScatterChart/ScatterChart.d.ts +3 -2
- package/esm/ScatterChart/ScatterChart.js +1 -1
- package/esm/hooks/useTicks.d.ts +6 -1
- package/esm/hooks/useTicks.js +94 -58
- package/esm/index.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +19 -11
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +19 -11
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
- package/esm/models/axis.d.ts +27 -1
- package/esm/models/seriesType/bar.d.ts +11 -1
- package/esm/models/seriesType/common.d.ts +9 -3
- package/esm/models/seriesType/line.d.ts +3 -1
- package/esm/models/seriesType/scatter.d.ts +4 -1
- package/esm/tests/web-components.js +49 -0
- package/hooks/useTicks.d.ts +6 -1
- package/hooks/useTicks.js +95 -58
- package/index.js +1 -1
- package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +20 -13
- package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +20 -13
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
- package/models/axis.d.ts +27 -1
- package/models/seriesType/bar.d.ts +11 -1
- package/models/seriesType/common.d.ts +9 -3
- package/models/seriesType/line.d.ts +3 -1
- package/models/seriesType/scatter.d.ts +4 -1
- package/package.json +4 -4
- package/tests/web-components.js +55 -0
package/models/axis.d.ts
CHANGED
|
@@ -281,11 +281,37 @@ export type AxisValueFormatterContext<S extends ScaleName = ScaleName> = {
|
|
|
281
281
|
* - `'legend'` The value is displayed in the legend when using color legend.
|
|
282
282
|
* - `'zoom-slider-tooltip'` The value is displayed in the zoom slider tooltip.
|
|
283
283
|
*/
|
|
284
|
-
location: '
|
|
284
|
+
location: 'tooltip' | 'zoom-slider-tooltip';
|
|
285
285
|
/**
|
|
286
286
|
* The d3-scale instance associated to the axis.
|
|
287
287
|
*/
|
|
288
288
|
scale: AxisScaleConfig[S]['scale'];
|
|
289
|
+
} | {
|
|
290
|
+
/**
|
|
291
|
+
* Location indicates where the value will be displayed.
|
|
292
|
+
* - `'tick'` The value is displayed on the axis ticks.
|
|
293
|
+
* - `'tooltip'` The value is displayed in the tooltip when hovering the chart.
|
|
294
|
+
* - `'legend'` The value is displayed in the legend when using color legend.
|
|
295
|
+
* - `'zoom-slider-tooltip'` The value is displayed in the zoom slider tooltip.
|
|
296
|
+
*/
|
|
297
|
+
location: 'tick';
|
|
298
|
+
/**
|
|
299
|
+
* The d3-scale instance associated to the axis.
|
|
300
|
+
*/
|
|
301
|
+
scale: AxisScaleConfig[S]['scale'];
|
|
302
|
+
/**
|
|
303
|
+
* The tick label shown by default if the value isn't formatted.
|
|
304
|
+
* This value might be an empty string if no tick label should be displayed, which is particularly useful in log
|
|
305
|
+
* scales where we want to show ticks to demonstrate it's a log scale, but not labels to avoid them overlapping.
|
|
306
|
+
* @see See {@link https://d3js.org/d3-scale/log#log_tickFormat D3 log scale docs} for more details.
|
|
307
|
+
*/
|
|
308
|
+
defaultTickLabel: string;
|
|
309
|
+
/**
|
|
310
|
+
* A suggestion of the number of ticks to show.
|
|
311
|
+
* Can be provided to the scale's `ticks` method to compute the ticks, or to `tickFormat` to format the ticks.
|
|
312
|
+
* Can be `undefined` if the scale doesn't support it, e.g., band, point scales.
|
|
313
|
+
*/
|
|
314
|
+
tickNumber?: number;
|
|
289
315
|
};
|
|
290
316
|
/**
|
|
291
317
|
* Config that is shared between cartesian and polar axes.
|
|
@@ -25,6 +25,16 @@ export interface BarSeriesType extends CommonSeriesType<number | null>, Cartesia
|
|
|
25
25
|
* @default 'diverging'
|
|
26
26
|
*/
|
|
27
27
|
stackOffset?: StackOffsetType;
|
|
28
|
+
/**
|
|
29
|
+
* If provided, the value will be used as the minimum size of the bar in pixels.
|
|
30
|
+
* This is useful to avoid bars with a size of 0.
|
|
31
|
+
*
|
|
32
|
+
* The property is ignored if the series value is `null` or `0`.
|
|
33
|
+
* It also doesn't work with stacked series.
|
|
34
|
+
*
|
|
35
|
+
* @default 0px
|
|
36
|
+
*/
|
|
37
|
+
minBarSize?: number;
|
|
28
38
|
}
|
|
29
39
|
/**
|
|
30
40
|
* An object that allows to identify a single bar.
|
|
@@ -35,4 +45,4 @@ export type BarItemIdentifier = {
|
|
|
35
45
|
seriesId: SeriesId;
|
|
36
46
|
dataIndex: number;
|
|
37
47
|
};
|
|
38
|
-
export interface DefaultizedBarSeriesType extends DefaultizedProps<BarSeriesType, CommonDefaultizedProps | 'color' | 'layout'> {}
|
|
48
|
+
export interface DefaultizedBarSeriesType extends DefaultizedProps<BarSeriesType, CommonDefaultizedProps | 'color' | 'layout' | 'minBarSize'> {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ChartsLabelMarkProps } from "../../ChartsLabel/index.js";
|
|
2
1
|
import { HighlightScope } from "../../internals/plugins/featurePlugins/useChartHighlight/highlightConfig.types.js";
|
|
3
2
|
import type { StackOffsetType, StackOrderType } from "../stacking.js";
|
|
3
|
+
import type { ChartsLabelMarkType } from "../../ChartsLabel/ChartsLabelMark.js";
|
|
4
4
|
export type SeriesId = number | string;
|
|
5
5
|
export type SeriesValueFormatterContext = {
|
|
6
6
|
/**
|
|
@@ -10,7 +10,13 @@ export type SeriesValueFormatterContext = {
|
|
|
10
10
|
};
|
|
11
11
|
export type SeriesValueFormatter<TValue> = (value: TValue, context: SeriesValueFormatterContext) => string | null;
|
|
12
12
|
export type CommonSeriesType<TValue> = {
|
|
13
|
+
/**
|
|
14
|
+
* The id of this series.
|
|
15
|
+
*/
|
|
13
16
|
id?: SeriesId;
|
|
17
|
+
/**
|
|
18
|
+
* Color to use when displaying the series.
|
|
19
|
+
*/
|
|
14
20
|
color?: string;
|
|
15
21
|
/**
|
|
16
22
|
* Formatter used to render values in tooltip or other data display.
|
|
@@ -22,13 +28,13 @@ export type CommonSeriesType<TValue> = {
|
|
|
22
28
|
/**
|
|
23
29
|
* The scope to apply when the series is highlighted.
|
|
24
30
|
*/
|
|
25
|
-
highlightScope?:
|
|
31
|
+
highlightScope?: HighlightScope;
|
|
26
32
|
/**
|
|
27
33
|
* Defines the mark type for the series.
|
|
28
34
|
*
|
|
29
35
|
* There is a default mark type for each series type.
|
|
30
36
|
*/
|
|
31
|
-
labelMarkType?:
|
|
37
|
+
labelMarkType?: ChartsLabelMarkType;
|
|
32
38
|
};
|
|
33
39
|
export type CommonDefaultizedProps = 'id' | 'valueFormatter' | 'data';
|
|
34
40
|
export type CartesianSeriesType = {
|
|
@@ -34,7 +34,9 @@ export interface LineSeriesType extends CommonSeriesType<number | null>, Cartesi
|
|
|
34
34
|
* The key used to retrieve data from the dataset.
|
|
35
35
|
*/
|
|
36
36
|
dataKey?: string;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* If `true`, the series is rendered as an area instead of a line.
|
|
39
|
+
*/
|
|
38
40
|
area?: boolean;
|
|
39
41
|
/**
|
|
40
42
|
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
@@ -12,6 +12,9 @@ export type ScatterValueType = {
|
|
|
12
12
|
export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType | null>, CartesianSeriesType {
|
|
13
13
|
type: 'scatter';
|
|
14
14
|
data?: readonly ScatterValueType[];
|
|
15
|
+
/**
|
|
16
|
+
* Size of the markers in the scatter plot, in pixels.
|
|
17
|
+
*/
|
|
15
18
|
markerSize?: number;
|
|
16
19
|
/**
|
|
17
20
|
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
@@ -52,7 +55,7 @@ export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType | n
|
|
|
52
55
|
};
|
|
53
56
|
preview?: {
|
|
54
57
|
/**
|
|
55
|
-
* The size of the preview marker.
|
|
58
|
+
* The size of the preview marker in pixels.
|
|
56
59
|
* @default 1
|
|
57
60
|
*/
|
|
58
61
|
markerSize?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of MUI X Charts components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"prop-types": "^15.8.1",
|
|
37
37
|
"reselect": "^5.1.1",
|
|
38
38
|
"use-sync-external-store": "^1.5.0",
|
|
39
|
-
"@mui/x-charts-vendor": "8.
|
|
40
|
-
"@mui/x-
|
|
41
|
-
"@mui/x-
|
|
39
|
+
"@mui/x-charts-vendor": "8.6.0",
|
|
40
|
+
"@mui/x-internal-gestures": "0.2.1",
|
|
41
|
+
"@mui/x-internals": "8.8.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@emotion/react": "^11.9.0",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.reactToWebComponent = reactToWebComponent;
|
|
7
|
+
const renderSymbol = Symbol.for('render');
|
|
8
|
+
const connectedSymbol = Symbol.for('connected');
|
|
9
|
+
const contextSymbol = Symbol.for('context');
|
|
10
|
+
const propsSymbol = Symbol.for('props');
|
|
11
|
+
|
|
12
|
+
// This function creates a custom web component that wraps a React component.
|
|
13
|
+
// Adapted from https://github.com/bitovi/react-to-web-component/blob/b1372bfd7bc67fe49920db840f1ed9cf736b2724/packages/core/src/core.ts
|
|
14
|
+
function reactToWebComponent(ReactComponent, options, renderer) {
|
|
15
|
+
class ReactWebComponent extends HTMLElement {
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this[connectedSymbol] = true;
|
|
22
|
+
this[contextSymbol] = void 0;
|
|
23
|
+
this[propsSymbol] = {};
|
|
24
|
+
this.container = void 0;
|
|
25
|
+
if (options.shadow) {
|
|
26
|
+
this.container = this.attachShadow({
|
|
27
|
+
mode: options.shadow
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
this.container = this;
|
|
31
|
+
}
|
|
32
|
+
this[propsSymbol].container = this.container;
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this[connectedSymbol] = true;
|
|
36
|
+
this[renderSymbol]();
|
|
37
|
+
}
|
|
38
|
+
disconnectedCallback() {
|
|
39
|
+
this[connectedSymbol] = false;
|
|
40
|
+
if (this[contextSymbol]) {
|
|
41
|
+
renderer.unmount(this[contextSymbol]);
|
|
42
|
+
}
|
|
43
|
+
delete this[contextSymbol];
|
|
44
|
+
}
|
|
45
|
+
[renderSymbol]() {
|
|
46
|
+
if (!this[connectedSymbol]) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!this[contextSymbol]) {
|
|
50
|
+
this[contextSymbol] = renderer.mount(this.container, ReactComponent, this[propsSymbol]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return ReactWebComponent;
|
|
55
|
+
}
|