@mui/x-charts-pro 9.0.0-alpha.4 → 9.0.0-beta.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/BarChartPro/BarChartPro.js +19 -28
- package/BarChartPro/BarChartPro.mjs +19 -28
- package/CHANGELOG.md +107 -1
- package/ChartsDataProviderPro/ChartsDataProviderPro.js +2 -2
- package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +2 -2
- package/FunnelChart/FunnelChart.js +8 -8
- package/FunnelChart/FunnelChart.mjs +8 -8
- package/FunnelChart/FunnelPlot.d.mts +4 -0
- package/FunnelChart/FunnelPlot.d.ts +4 -0
- package/FunnelChart/FunnelPlot.js +4 -2
- package/FunnelChart/FunnelPlot.mjs +4 -2
- package/FunnelChart/categoryAxis.types.d.mts +2 -1
- package/FunnelChart/categoryAxis.types.d.ts +2 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.d.mts +2 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.d.ts +2 -1
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.js +14 -5
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.mjs +15 -6
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.js +6 -4
- package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.mjs +7 -5
- package/FunnelChart/seriesConfig/descriptionGetter.d.mts +3 -0
- package/FunnelChart/seriesConfig/descriptionGetter.d.ts +3 -0
- package/FunnelChart/seriesConfig/descriptionGetter.js +26 -0
- package/FunnelChart/seriesConfig/descriptionGetter.mjs +20 -0
- package/FunnelChart/seriesConfig/index.js +2 -0
- package/FunnelChart/seriesConfig/index.mjs +2 -0
- package/Heatmap/Heatmap.js +2 -2
- package/Heatmap/Heatmap.mjs +2 -2
- package/Heatmap/Heatmap.types.d.mts +4 -0
- package/Heatmap/Heatmap.types.d.ts +4 -0
- package/Heatmap/HeatmapItem.js +2 -16
- package/Heatmap/HeatmapItem.mjs +2 -16
- package/Heatmap/HeatmapPlot.js +4 -0
- package/Heatmap/HeatmapPlot.mjs +4 -0
- package/Heatmap/HeatmapSVGPlot.js +35 -42
- package/Heatmap/HeatmapSVGPlot.mjs +36 -44
- package/Heatmap/seriesConfig/descriptionGetter.d.mts +3 -0
- package/Heatmap/seriesConfig/descriptionGetter.d.ts +3 -0
- package/Heatmap/seriesConfig/descriptionGetter.js +39 -0
- package/Heatmap/seriesConfig/descriptionGetter.mjs +33 -0
- package/Heatmap/seriesConfig/index.js +2 -0
- package/Heatmap/seriesConfig/index.mjs +2 -0
- package/LineChartPro/LineChartPro.js +21 -19
- package/LineChartPro/LineChartPro.mjs +21 -19
- package/SankeyChart/SankeyPlot.d.mts +4 -0
- package/SankeyChart/SankeyPlot.d.ts +4 -0
- package/SankeyChart/SankeyPlot.js +3 -1
- package/SankeyChart/SankeyPlot.mjs +3 -1
- package/SankeyChart/seriesConfig/descriptionGetter.d.mts +3 -0
- package/SankeyChart/seriesConfig/descriptionGetter.d.ts +3 -0
- package/SankeyChart/seriesConfig/descriptionGetter.js +48 -0
- package/SankeyChart/seriesConfig/descriptionGetter.mjs +42 -0
- package/SankeyChart/seriesConfig/index.js +2 -0
- package/SankeyChart/seriesConfig/index.mjs +2 -0
- package/ScatterChartPro/ScatterChartPro.js +18 -18
- package/ScatterChartPro/ScatterChartPro.mjs +18 -18
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +129 -129
- package/typeOverloads/modules.d.mts +17 -1
- package/typeOverloads/modules.d.ts +17 -1
- package/Heatmap/shouldRegisterPointerInteractionsGlobally.d.mts +0 -2
- package/Heatmap/shouldRegisterPointerInteractionsGlobally.d.ts +0 -2
- package/Heatmap/shouldRegisterPointerInteractionsGlobally.js +0 -18
- package/Heatmap/shouldRegisterPointerInteractionsGlobally.mjs +0 -13
|
@@ -2,6 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { type FunnelItemIdentifier } from "./funnel.types.mjs";
|
|
3
3
|
import { type FunnelPlotSlotExtension } from "./funnelPlotSlots.types.mjs";
|
|
4
4
|
export interface FunnelPlotProps extends FunnelPlotSlotExtension {
|
|
5
|
+
/**
|
|
6
|
+
* A CSS class name applied to the root element.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
5
9
|
/**
|
|
6
10
|
* Callback fired when a funnel item is clicked.
|
|
7
11
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
@@ -2,6 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { type FunnelItemIdentifier } from "./funnel.types.js";
|
|
3
3
|
import { type FunnelPlotSlotExtension } from "./funnelPlotSlots.types.js";
|
|
4
4
|
export interface FunnelPlotProps extends FunnelPlotSlotExtension {
|
|
5
|
+
/**
|
|
6
|
+
* A CSS class name applied to the root element.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
5
9
|
/**
|
|
6
10
|
* Callback fired when a funnel item is clicked.
|
|
7
11
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var React = _react;
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
15
|
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
15
16
|
var _internals = require("@mui/x-charts/internals");
|
|
16
17
|
var _FunnelSection = require("./FunnelSection");
|
|
@@ -23,7 +24,7 @@ var _useChartFunnelAxisRendering = require("./funnelAxisPlugin/useChartFunnelAxi
|
|
|
23
24
|
var _coordinateMapper = require("./coordinateMapper");
|
|
24
25
|
var _get2DExtrema = require("./get2DExtrema");
|
|
25
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["onItemClick"];
|
|
27
|
+
const _excluded = ["className", "onItemClick"];
|
|
27
28
|
_internals.cartesianSeriesTypes.addType('funnel');
|
|
28
29
|
const useAggregatedData = () => {
|
|
29
30
|
const seriesData = (0, _useFunnelSeries.useFunnelSeriesContext)();
|
|
@@ -107,13 +108,14 @@ const useAggregatedData = () => {
|
|
|
107
108
|
};
|
|
108
109
|
function FunnelPlot(props) {
|
|
109
110
|
const {
|
|
111
|
+
className,
|
|
110
112
|
onItemClick
|
|
111
113
|
} = props,
|
|
112
114
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
113
115
|
const data = useAggregatedData();
|
|
114
116
|
const classes = (0, _funnelClasses.useUtilityClasses)();
|
|
115
117
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
116
|
-
className: classes.root,
|
|
118
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
117
119
|
children: [data.map(series => {
|
|
118
120
|
if (series.length === 0) {
|
|
119
121
|
return null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["onItemClick"];
|
|
3
|
+
const _excluded = ["className", "onItemClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
7
8
|
import { cartesianSeriesTypes, useStore } from '@mui/x-charts/internals';
|
|
8
9
|
import { FunnelSection } from "./FunnelSection.mjs";
|
|
@@ -99,13 +100,14 @@ const useAggregatedData = () => {
|
|
|
99
100
|
};
|
|
100
101
|
function FunnelPlot(props) {
|
|
101
102
|
const {
|
|
103
|
+
className,
|
|
102
104
|
onItemClick
|
|
103
105
|
} = props,
|
|
104
106
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
105
107
|
const data = useAggregatedData();
|
|
106
108
|
const classes = useUtilityClasses();
|
|
107
109
|
return /*#__PURE__*/_jsxs("g", {
|
|
108
|
-
className: classes.root,
|
|
110
|
+
className: clsx(classes.root, className),
|
|
109
111
|
children: [data.map(series => {
|
|
110
112
|
if (series.length === 0) {
|
|
111
113
|
return null;
|
|
@@ -20,7 +20,8 @@ export type CategoryAxis<S extends FunnelScaleName = FunnelScaleName> = S extend
|
|
|
20
20
|
* The size of the axis.
|
|
21
21
|
* - If the axis is horizontal, the size is the height of the axis.
|
|
22
22
|
* - If the axis is vertical, the size is the width of the axis.
|
|
23
|
+
* - If set to `'auto'`, the size is automatically calculated based on tick label measurements.
|
|
23
24
|
*/
|
|
24
|
-
size?: number;
|
|
25
|
+
size?: number | 'auto';
|
|
25
26
|
scaleType?: S;
|
|
26
27
|
} & MakeOptional<Pick<AxisConfig<S, any>, 'disableLine' | 'disableTicks' | 'tickLabelStyle' | 'tickSize' | 'id'>, 'id'> : never;
|
|
@@ -20,7 +20,8 @@ export type CategoryAxis<S extends FunnelScaleName = FunnelScaleName> = S extend
|
|
|
20
20
|
* The size of the axis.
|
|
21
21
|
* - If the axis is horizontal, the size is the height of the axis.
|
|
22
22
|
* - If the axis is vertical, the size is the width of the axis.
|
|
23
|
+
* - If set to `'auto'`, the size is automatically calculated based on tick label measurements.
|
|
23
24
|
*/
|
|
24
|
-
size?: number;
|
|
25
|
+
size?: number | 'auto';
|
|
25
26
|
scaleType?: S;
|
|
26
27
|
} & MakeOptional<Pick<AxisConfig<S, any>, 'disableLine' | 'disableTicks' | 'tickLabelStyle' | 'tickSize' | 'id'>, 'id'> : never;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
2
2
|
import { type ChartDrawingArea } from '@mui/x-charts/hooks';
|
|
3
|
-
import { type ComputedAxisConfig, type ChartSeriesType, type ProcessedSeries, type ChartSeriesConfig, type DefaultedYAxis, type DefaultedXAxis } from '@mui/x-charts/internals';
|
|
3
|
+
import { type ComputedAxisConfig, type ChartSeriesType, type ProcessedSeries, type ChartSeriesConfig, type DefaultedYAxis, type DefaultedXAxis, type AxisId } from '@mui/x-charts/internals';
|
|
4
4
|
import { type ChartsXAxisProps, type ChartsYAxisProps } from '@mui/x-charts/models';
|
|
5
5
|
export declare const xRangeGetter: (drawingArea: ChartDrawingArea, reverse?: boolean, removedSpace?: number) => [number, number];
|
|
6
6
|
export declare const yRangeGetter: (drawingArea: ChartDrawingArea, reverse?: boolean, removedSpace?: number) => [number, number];
|
|
@@ -13,6 +13,7 @@ type ComputeCommonParams<SeriesType extends ChartSeriesType = 'funnel'> = {
|
|
|
13
13
|
formattedSeries: ProcessedSeries<SeriesType>;
|
|
14
14
|
seriesConfig: ChartSeriesConfig<SeriesType>;
|
|
15
15
|
gap: number;
|
|
16
|
+
autoSizes?: Record<AxisId, number>;
|
|
16
17
|
};
|
|
17
18
|
export declare function computeAxisValue(options: ComputeCommonParams<'funnel'> & {
|
|
18
19
|
axis?: DefaultedYAxis[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
2
2
|
import { type ChartDrawingArea } from '@mui/x-charts/hooks';
|
|
3
|
-
import { type ComputedAxisConfig, type ChartSeriesType, type ProcessedSeries, type ChartSeriesConfig, type DefaultedYAxis, type DefaultedXAxis } from '@mui/x-charts/internals';
|
|
3
|
+
import { type ComputedAxisConfig, type ChartSeriesType, type ProcessedSeries, type ChartSeriesConfig, type DefaultedYAxis, type DefaultedXAxis, type AxisId } from '@mui/x-charts/internals';
|
|
4
4
|
import { type ChartsXAxisProps, type ChartsYAxisProps } from '@mui/x-charts/models';
|
|
5
5
|
export declare const xRangeGetter: (drawingArea: ChartDrawingArea, reverse?: boolean, removedSpace?: number) => [number, number];
|
|
6
6
|
export declare const yRangeGetter: (drawingArea: ChartDrawingArea, reverse?: boolean, removedSpace?: number) => [number, number];
|
|
@@ -13,6 +13,7 @@ type ComputeCommonParams<SeriesType extends ChartSeriesType = 'funnel'> = {
|
|
|
13
13
|
formattedSeries: ProcessedSeries<SeriesType>;
|
|
14
14
|
seriesConfig: ChartSeriesConfig<SeriesType>;
|
|
15
15
|
gap: number;
|
|
16
|
+
autoSizes?: Record<AxisId, number>;
|
|
16
17
|
};
|
|
17
18
|
export declare function computeAxisValue(options: ComputeCommonParams<'funnel'> & {
|
|
18
19
|
axis?: DefaultedYAxis[];
|
|
@@ -28,7 +28,8 @@ function computeAxisValue({
|
|
|
28
28
|
axis: allAxis,
|
|
29
29
|
seriesConfig,
|
|
30
30
|
axisDirection,
|
|
31
|
-
gap
|
|
31
|
+
gap,
|
|
32
|
+
autoSizes
|
|
32
33
|
}) {
|
|
33
34
|
if (allAxis === undefined) {
|
|
34
35
|
return {
|
|
@@ -51,13 +52,17 @@ function computeAxisValue({
|
|
|
51
52
|
const N = axis.data.length;
|
|
52
53
|
const bandWidth = (rangeSpace - gap * (N - 1)) / N;
|
|
53
54
|
const step = bandWidth + gap;
|
|
55
|
+
const resolvedSize = (0, _internals.resolveAxisSize)(axis, autoSizes, axisDirection);
|
|
54
56
|
completeAxis[axis.id] = (0, _extends2.default)({
|
|
55
57
|
offset: 0,
|
|
56
|
-
height: 0,
|
|
57
58
|
categoryGapRatio: 0,
|
|
58
59
|
barGapRatio: 0,
|
|
59
60
|
triggerTooltip
|
|
60
|
-
}, axis, {
|
|
61
|
+
}, axis, axisDirection === 'x' ? {
|
|
62
|
+
height: resolvedSize
|
|
63
|
+
} : {
|
|
64
|
+
width: resolvedSize
|
|
65
|
+
}, {
|
|
61
66
|
data,
|
|
62
67
|
scale: (0, _internals.scaleBand)(axis.data, scaleRange).paddingInner(gap / step).paddingOuter(0),
|
|
63
68
|
tickNumber: axis.data.length,
|
|
@@ -101,11 +106,15 @@ function computeAxisValue({
|
|
|
101
106
|
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
102
107
|
const [minDomain, maxDomain] = finalScale.domain();
|
|
103
108
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
109
|
+
const resolvedSize = (0, _internals.resolveAxisSize)(axis, autoSizes, axisDirection);
|
|
104
110
|
completeAxis[axis.id] = (0, _extends2.default)({
|
|
105
111
|
offset: 0,
|
|
106
|
-
height: 0,
|
|
107
112
|
triggerTooltip
|
|
108
|
-
}, axis, {
|
|
113
|
+
}, axis, axisDirection === 'x' ? {
|
|
114
|
+
height: resolvedSize
|
|
115
|
+
} : {
|
|
116
|
+
width: resolvedSize
|
|
117
|
+
}, {
|
|
109
118
|
data,
|
|
110
119
|
scaleType: scaleType,
|
|
111
120
|
scale: finalScale.domain(domain),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import { getAxisExtrema, isBandScaleConfig, isPointScaleConfig, isContinuousScaleConfig, getScale, getColorScale, getOrdinalColorScale, getTickNumber, scaleTickNumberByRange, getCartesianAxisTriggerTooltip, isDateData, createDateFormatter, getDefaultTickNumber, scaleBand } from '@mui/x-charts/internals';
|
|
3
|
+
import { getAxisExtrema, isBandScaleConfig, isPointScaleConfig, isContinuousScaleConfig, getScale, getColorScale, getOrdinalColorScale, getTickNumber, scaleTickNumberByRange, getCartesianAxisTriggerTooltip, isDateData, createDateFormatter, getDefaultTickNumber, scaleBand, resolveAxisSize } from '@mui/x-charts/internals';
|
|
4
4
|
export const xRangeGetter = (drawingArea, reverse, removedSpace = 0) => {
|
|
5
5
|
const range = [drawingArea.left, drawingArea.left + drawingArea.width - removedSpace];
|
|
6
6
|
return reverse ? [range[1], range[0]] : [range[0], range[1]];
|
|
@@ -18,7 +18,8 @@ export function computeAxisValue({
|
|
|
18
18
|
axis: allAxis,
|
|
19
19
|
seriesConfig,
|
|
20
20
|
axisDirection,
|
|
21
|
-
gap
|
|
21
|
+
gap,
|
|
22
|
+
autoSizes
|
|
22
23
|
}) {
|
|
23
24
|
if (allAxis === undefined) {
|
|
24
25
|
return {
|
|
@@ -41,13 +42,17 @@ export function computeAxisValue({
|
|
|
41
42
|
const N = axis.data.length;
|
|
42
43
|
const bandWidth = (rangeSpace - gap * (N - 1)) / N;
|
|
43
44
|
const step = bandWidth + gap;
|
|
45
|
+
const resolvedSize = resolveAxisSize(axis, autoSizes, axisDirection);
|
|
44
46
|
completeAxis[axis.id] = _extends({
|
|
45
47
|
offset: 0,
|
|
46
|
-
height: 0,
|
|
47
48
|
categoryGapRatio: 0,
|
|
48
49
|
barGapRatio: 0,
|
|
49
50
|
triggerTooltip
|
|
50
|
-
}, axis, {
|
|
51
|
+
}, axis, axisDirection === 'x' ? {
|
|
52
|
+
height: resolvedSize
|
|
53
|
+
} : {
|
|
54
|
+
width: resolvedSize
|
|
55
|
+
}, {
|
|
51
56
|
data,
|
|
52
57
|
scale: scaleBand(axis.data, scaleRange).paddingInner(gap / step).paddingOuter(0),
|
|
53
58
|
tickNumber: axis.data.length,
|
|
@@ -91,11 +96,15 @@ export function computeAxisValue({
|
|
|
91
96
|
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
92
97
|
const [minDomain, maxDomain] = finalScale.domain();
|
|
93
98
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
99
|
+
const resolvedSize = resolveAxisSize(axis, autoSizes, axisDirection);
|
|
94
100
|
completeAxis[axis.id] = _extends({
|
|
95
101
|
offset: 0,
|
|
96
|
-
height: 0,
|
|
97
102
|
triggerTooltip
|
|
98
|
-
}, axis, {
|
|
103
|
+
}, axis, axisDirection === 'x' ? {
|
|
104
|
+
height: resolvedSize
|
|
105
|
+
} : {
|
|
106
|
+
width: resolvedSize
|
|
107
|
+
}, {
|
|
99
108
|
data,
|
|
100
109
|
scaleType: scaleType,
|
|
101
110
|
scale: finalScale.domain(domain),
|
|
@@ -10,19 +10,21 @@ var _computeAxisValue = require("./computeAxisValue");
|
|
|
10
10
|
const selectorFunnel = state => state.funnel;
|
|
11
11
|
exports.selectorFunnel = selectorFunnel;
|
|
12
12
|
const selectorFunnelGap = exports.selectorFunnelGap = (0, _store.createSelector)(selectorFunnel, funnel => funnel?.gap ?? 0);
|
|
13
|
-
const selectorChartXAxis = exports.selectorChartXAxis = (0, _store.createSelectorMemoized)(_internals.selectorChartRawXAxis, _internals.selectorChartDrawingArea, _internals.selectorChartSeriesProcessed, _internals.selectorChartSeriesConfig, selectorFunnelGap, (axis, drawingArea, formattedSeries, seriesConfig, gap) => (0, _computeAxisValue.computeAxisValue)({
|
|
13
|
+
const selectorChartXAxis = exports.selectorChartXAxis = (0, _store.createSelectorMemoized)(_internals.selectorChartRawXAxis, _internals.selectorChartDrawingArea, _internals.selectorChartSeriesProcessed, _internals.selectorChartSeriesConfig, selectorFunnelGap, _internals.selectorChartXAxisAutoSizes, (axis, drawingArea, formattedSeries, seriesConfig, gap, autoSizes) => (0, _computeAxisValue.computeAxisValue)({
|
|
14
14
|
drawingArea,
|
|
15
15
|
formattedSeries,
|
|
16
16
|
axis,
|
|
17
17
|
seriesConfig,
|
|
18
18
|
axisDirection: 'x',
|
|
19
|
-
gap
|
|
19
|
+
gap,
|
|
20
|
+
autoSizes
|
|
20
21
|
}));
|
|
21
|
-
const selectorChartYAxis = exports.selectorChartYAxis = (0, _store.createSelectorMemoized)(_internals.selectorChartRawYAxis, _internals.selectorChartDrawingArea, _internals.selectorChartSeriesProcessed, _internals.selectorChartSeriesConfig, selectorFunnelGap, (axis, drawingArea, formattedSeries, seriesConfig, gap) => (0, _computeAxisValue.computeAxisValue)({
|
|
22
|
+
const selectorChartYAxis = exports.selectorChartYAxis = (0, _store.createSelectorMemoized)(_internals.selectorChartRawYAxis, _internals.selectorChartDrawingArea, _internals.selectorChartSeriesProcessed, _internals.selectorChartSeriesConfig, selectorFunnelGap, _internals.selectorChartYAxisAutoSizes, (axis, drawingArea, formattedSeries, seriesConfig, gap, autoSizes) => (0, _computeAxisValue.computeAxisValue)({
|
|
22
23
|
drawingArea,
|
|
23
24
|
formattedSeries,
|
|
24
25
|
axis,
|
|
25
26
|
seriesConfig,
|
|
26
27
|
axisDirection: 'y',
|
|
27
|
-
gap
|
|
28
|
+
gap,
|
|
29
|
+
autoSizes
|
|
28
30
|
}));
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { createSelector, createSelectorMemoized } from '@mui/x-internals/store';
|
|
2
|
-
import { selectorChartSeriesConfig, selectorChartSeriesProcessed, selectorChartDrawingArea, selectorChartRawXAxis, selectorChartRawYAxis } from '@mui/x-charts/internals';
|
|
2
|
+
import { selectorChartSeriesConfig, selectorChartSeriesProcessed, selectorChartDrawingArea, selectorChartRawXAxis, selectorChartRawYAxis, selectorChartXAxisAutoSizes, selectorChartYAxisAutoSizes } from '@mui/x-charts/internals';
|
|
3
3
|
import { computeAxisValue } from "./computeAxisValue.mjs";
|
|
4
4
|
export const selectorFunnel = state => state.funnel;
|
|
5
5
|
export const selectorFunnelGap = createSelector(selectorFunnel, funnel => funnel?.gap ?? 0);
|
|
6
|
-
export const selectorChartXAxis = createSelectorMemoized(selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorFunnelGap, (axis, drawingArea, formattedSeries, seriesConfig, gap) => computeAxisValue({
|
|
6
|
+
export const selectorChartXAxis = createSelectorMemoized(selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorFunnelGap, selectorChartXAxisAutoSizes, (axis, drawingArea, formattedSeries, seriesConfig, gap, autoSizes) => computeAxisValue({
|
|
7
7
|
drawingArea,
|
|
8
8
|
formattedSeries,
|
|
9
9
|
axis,
|
|
10
10
|
seriesConfig,
|
|
11
11
|
axisDirection: 'x',
|
|
12
|
-
gap
|
|
12
|
+
gap,
|
|
13
|
+
autoSizes
|
|
13
14
|
}));
|
|
14
|
-
export const selectorChartYAxis = createSelectorMemoized(selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorFunnelGap, (axis, drawingArea, formattedSeries, seriesConfig, gap) => computeAxisValue({
|
|
15
|
+
export const selectorChartYAxis = createSelectorMemoized(selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorFunnelGap, selectorChartYAxisAutoSizes, (axis, drawingArea, formattedSeries, seriesConfig, gap, autoSizes) => computeAxisValue({
|
|
15
16
|
drawingArea,
|
|
16
17
|
formattedSeries,
|
|
17
18
|
axis,
|
|
18
19
|
seriesConfig,
|
|
19
20
|
axisDirection: 'y',
|
|
20
|
-
gap
|
|
21
|
+
gap,
|
|
22
|
+
autoSizes
|
|
21
23
|
}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
const descriptionGetter = params => {
|
|
9
|
+
const {
|
|
10
|
+
identifier,
|
|
11
|
+
series,
|
|
12
|
+
localeText
|
|
13
|
+
} = params;
|
|
14
|
+
const item = series.data[identifier.dataIndex];
|
|
15
|
+
const label = (0, _internals.getLabel)(item?.label, 'tooltip');
|
|
16
|
+
const value = item?.value ?? null;
|
|
17
|
+
const formattedValue = series.valueFormatter(item, {
|
|
18
|
+
dataIndex: identifier.dataIndex
|
|
19
|
+
});
|
|
20
|
+
return localeText.funnelDescription({
|
|
21
|
+
value,
|
|
22
|
+
formattedValue: formattedValue ?? '',
|
|
23
|
+
seriesLabel: label
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var _default = exports.default = descriptionGetter;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getLabel } from '@mui/x-charts/internals';
|
|
2
|
+
const descriptionGetter = params => {
|
|
3
|
+
const {
|
|
4
|
+
identifier,
|
|
5
|
+
series,
|
|
6
|
+
localeText
|
|
7
|
+
} = params;
|
|
8
|
+
const item = series.data[identifier.dataIndex];
|
|
9
|
+
const label = getLabel(item?.label, 'tooltip');
|
|
10
|
+
const value = item?.value ?? null;
|
|
11
|
+
const formattedValue = series.valueFormatter(item, {
|
|
12
|
+
dataIndex: identifier.dataIndex
|
|
13
|
+
});
|
|
14
|
+
return localeText.funnelDescription({
|
|
15
|
+
value,
|
|
16
|
+
formattedValue: formattedValue ?? '',
|
|
17
|
+
seriesLabel: label
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default descriptionGetter;
|
|
@@ -14,6 +14,7 @@ var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
|
14
14
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
15
15
|
var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
|
|
16
16
|
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
17
|
+
var _descriptionGetter = _interopRequireDefault(require("./descriptionGetter"));
|
|
17
18
|
const funnelSeriesConfig = exports.funnelSeriesConfig = {
|
|
18
19
|
seriesProcessor: _seriesProcessor.default,
|
|
19
20
|
colorProcessor: _getColor.default,
|
|
@@ -26,6 +27,7 @@ const funnelSeriesConfig = exports.funnelSeriesConfig = {
|
|
|
26
27
|
keyboardFocusHandler: _keyboardFocusHandler.default,
|
|
27
28
|
identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
|
|
28
29
|
identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex,
|
|
30
|
+
descriptionGetter: _descriptionGetter.default,
|
|
29
31
|
isHighlightedCreator: _internals.createIsHighlighted,
|
|
30
32
|
isFadedCreator: _internals.createIsFaded
|
|
31
33
|
};
|
|
@@ -7,6 +7,7 @@ import tooltipGetter from "./tooltip.mjs";
|
|
|
7
7
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.mjs";
|
|
8
8
|
import tooltipItemPositionGetter from "./tooltipPosition.mjs";
|
|
9
9
|
import keyboardFocusHandler from "./keyboardFocusHandler.mjs";
|
|
10
|
+
import descriptionGetter from "./descriptionGetter.mjs";
|
|
10
11
|
export const funnelSeriesConfig = {
|
|
11
12
|
seriesProcessor,
|
|
12
13
|
colorProcessor: getColor,
|
|
@@ -19,6 +20,7 @@ export const funnelSeriesConfig = {
|
|
|
19
20
|
keyboardFocusHandler,
|
|
20
21
|
identifierSerializer: identifierSerializerSeriesIdDataIndex,
|
|
21
22
|
identifierCleaner: identifierCleanerSeriesIdDataIndex,
|
|
23
|
+
descriptionGetter,
|
|
22
24
|
isHighlightedCreator: createIsHighlighted,
|
|
23
25
|
isFadedCreator: createIsFaded
|
|
24
26
|
};
|
package/Heatmap/Heatmap.js
CHANGED
|
@@ -305,7 +305,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
305
305
|
tickLabelStyle: _propTypes.default.object,
|
|
306
306
|
tickSize: _propTypes.default.number
|
|
307
307
|
})),
|
|
308
|
-
height: _propTypes.default.number,
|
|
308
|
+
height: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
|
|
309
309
|
hideTooltip: _propTypes.default.bool,
|
|
310
310
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
311
311
|
ignoreTooltip: _propTypes.default.bool,
|
|
@@ -415,7 +415,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
415
415
|
tickSize: _propTypes.default.number,
|
|
416
416
|
tickSpacing: _propTypes.default.number,
|
|
417
417
|
valueFormatter: _propTypes.default.func,
|
|
418
|
-
width: _propTypes.default.number,
|
|
418
|
+
width: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]),
|
|
419
419
|
zoom: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
420
420
|
filterMode: _propTypes.default.oneOf(['discard', 'keep']),
|
|
421
421
|
maxEnd: _propTypes.default.number,
|
package/Heatmap/Heatmap.mjs
CHANGED
|
@@ -298,7 +298,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
298
298
|
tickLabelStyle: PropTypes.object,
|
|
299
299
|
tickSize: PropTypes.number
|
|
300
300
|
})),
|
|
301
|
-
height: PropTypes.number,
|
|
301
|
+
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
302
302
|
hideTooltip: PropTypes.bool,
|
|
303
303
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
304
304
|
ignoreTooltip: PropTypes.bool,
|
|
@@ -408,7 +408,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
408
408
|
tickSize: PropTypes.number,
|
|
409
409
|
tickSpacing: PropTypes.number,
|
|
410
410
|
valueFormatter: PropTypes.func,
|
|
411
|
-
width: PropTypes.number,
|
|
411
|
+
width: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
412
412
|
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
413
413
|
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
414
414
|
maxEnd: PropTypes.number,
|
|
@@ -2,6 +2,10 @@ import { type HeatmapItemProps, type HeatmapItemSlotProps, type HeatmapItemSlots
|
|
|
2
2
|
export interface HeatmapPlotSlots extends HeatmapItemSlots {}
|
|
3
3
|
export interface HeatmapPlotSlotProps extends HeatmapItemSlotProps {}
|
|
4
4
|
export interface HeatmapRendererPlotProps extends Pick<HeatmapItemProps, 'slots' | 'slotProps'> {
|
|
5
|
+
/**
|
|
6
|
+
* A CSS class name applied to the root element.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
5
9
|
/**
|
|
6
10
|
* The border radius of the heatmap cells in pixels.
|
|
7
11
|
*/
|
|
@@ -2,6 +2,10 @@ import { type HeatmapItemProps, type HeatmapItemSlotProps, type HeatmapItemSlots
|
|
|
2
2
|
export interface HeatmapPlotSlots extends HeatmapItemSlots {}
|
|
3
3
|
export interface HeatmapPlotSlotProps extends HeatmapItemSlotProps {}
|
|
4
4
|
export interface HeatmapRendererPlotProps extends Pick<HeatmapItemProps, 'slots' | 'slotProps'> {
|
|
5
|
+
/**
|
|
6
|
+
* A CSS class name applied to the root element.
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
5
9
|
/**
|
|
6
10
|
* The border radius of the heatmap cells in pixels.
|
|
7
11
|
*/
|
package/Heatmap/HeatmapItem.js
CHANGED
|
@@ -11,10 +11,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
14
|
-
var _internals = require("@mui/x-charts/internals");
|
|
15
14
|
var _heatmapClasses = require("./heatmapClasses");
|
|
16
15
|
var _HeatmapCell = require("./HeatmapCell");
|
|
17
|
-
var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
|
|
18
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
17
|
const _excluded = ["seriesId", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
|
|
20
18
|
/**
|
|
@@ -28,22 +26,10 @@ function HeatmapItem(props) {
|
|
|
28
26
|
isHighlighted = false,
|
|
29
27
|
isFaded = false,
|
|
30
28
|
borderRadius,
|
|
31
|
-
xIndex,
|
|
32
|
-
yIndex,
|
|
33
29
|
slotProps = {},
|
|
34
30
|
slots = {}
|
|
35
31
|
} = props,
|
|
36
32
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
37
|
-
|
|
38
|
-
// If we aren't using the default cell, we skip adding interaction props because we have a more efficient way to
|
|
39
|
-
// calculate them. To avoid breaking changes, we need to keep this behavior. We can remove this in v9.
|
|
40
|
-
const skipInteractionItemProps = (0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps);
|
|
41
|
-
const interactionProps = (0, _internals.useInteractionItemProps)({
|
|
42
|
-
type: 'heatmap',
|
|
43
|
-
seriesId,
|
|
44
|
-
xIndex,
|
|
45
|
-
yIndex
|
|
46
|
-
}, skipInteractionItemProps);
|
|
47
33
|
const ownerState = {
|
|
48
34
|
seriesId,
|
|
49
35
|
color,
|
|
@@ -55,12 +41,12 @@ function HeatmapItem(props) {
|
|
|
55
41
|
const Cell = slots?.cell ?? _HeatmapCell.HeatmapCell;
|
|
56
42
|
const cellProps = (0, _useSlotProps.default)({
|
|
57
43
|
elementType: Cell,
|
|
58
|
-
additionalProps:
|
|
44
|
+
additionalProps: {
|
|
59
45
|
rx: borderRadius,
|
|
60
46
|
ry: borderRadius,
|
|
61
47
|
'data-highlighted': isHighlighted || undefined,
|
|
62
48
|
'data-faded': isFaded || undefined
|
|
63
|
-
}
|
|
49
|
+
},
|
|
64
50
|
externalForwardedProps: (0, _extends2.default)({}, other),
|
|
65
51
|
externalSlotProps: slotProps.cell,
|
|
66
52
|
ownerState,
|
package/Heatmap/HeatmapItem.mjs
CHANGED
|
@@ -4,10 +4,8 @@ const _excluded = ["seriesId", "color", "value", "isHighlighted", "isFaded", "bo
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
7
|
-
import { useInteractionItemProps } from '@mui/x-charts/internals';
|
|
8
7
|
import { useUtilityClasses } from "./heatmapClasses.mjs";
|
|
9
8
|
import { HeatmapCell } from "./HeatmapCell.mjs";
|
|
10
|
-
import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.mjs";
|
|
11
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
10
|
/**
|
|
13
11
|
* @ignore - internal component.
|
|
@@ -20,22 +18,10 @@ function HeatmapItem(props) {
|
|
|
20
18
|
isHighlighted = false,
|
|
21
19
|
isFaded = false,
|
|
22
20
|
borderRadius,
|
|
23
|
-
xIndex,
|
|
24
|
-
yIndex,
|
|
25
21
|
slotProps = {},
|
|
26
22
|
slots = {}
|
|
27
23
|
} = props,
|
|
28
24
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
|
-
|
|
30
|
-
// If we aren't using the default cell, we skip adding interaction props because we have a more efficient way to
|
|
31
|
-
// calculate them. To avoid breaking changes, we need to keep this behavior. We can remove this in v9.
|
|
32
|
-
const skipInteractionItemProps = shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps);
|
|
33
|
-
const interactionProps = useInteractionItemProps({
|
|
34
|
-
type: 'heatmap',
|
|
35
|
-
seriesId,
|
|
36
|
-
xIndex,
|
|
37
|
-
yIndex
|
|
38
|
-
}, skipInteractionItemProps);
|
|
39
25
|
const ownerState = {
|
|
40
26
|
seriesId,
|
|
41
27
|
color,
|
|
@@ -47,12 +33,12 @@ function HeatmapItem(props) {
|
|
|
47
33
|
const Cell = slots?.cell ?? HeatmapCell;
|
|
48
34
|
const cellProps = useSlotProps({
|
|
49
35
|
elementType: Cell,
|
|
50
|
-
additionalProps:
|
|
36
|
+
additionalProps: {
|
|
51
37
|
rx: borderRadius,
|
|
52
38
|
ry: borderRadius,
|
|
53
39
|
'data-highlighted': isHighlighted || undefined,
|
|
54
40
|
'data-faded': isFaded || undefined
|
|
55
|
-
}
|
|
41
|
+
},
|
|
56
42
|
externalForwardedProps: _extends({}, other),
|
|
57
43
|
externalSlotProps: slotProps.cell,
|
|
58
44
|
ownerState,
|
package/Heatmap/HeatmapPlot.js
CHANGED
|
@@ -32,6 +32,10 @@ process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
|
|
|
32
32
|
* The border radius of the heatmap cells in pixels.
|
|
33
33
|
*/
|
|
34
34
|
borderRadius: _propTypes.default.number,
|
|
35
|
+
/**
|
|
36
|
+
* A CSS class name applied to the root element.
|
|
37
|
+
*/
|
|
38
|
+
className: _propTypes.default.string,
|
|
35
39
|
/**
|
|
36
40
|
* The props used for each component slot.
|
|
37
41
|
* @default {}
|
package/Heatmap/HeatmapPlot.mjs
CHANGED
|
@@ -25,6 +25,10 @@ process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
|
|
|
25
25
|
* The border radius of the heatmap cells in pixels.
|
|
26
26
|
*/
|
|
27
27
|
borderRadius: PropTypes.number,
|
|
28
|
+
/**
|
|
29
|
+
* A CSS class name applied to the root element.
|
|
30
|
+
*/
|
|
31
|
+
className: PropTypes.string,
|
|
28
32
|
/**
|
|
29
33
|
* The props used for each component slot.
|
|
30
34
|
* @default {}
|