diff --git a/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.tsx b/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.tsx
new file mode 100644
index 000000000000..8361a9df7882
--- /dev/null
+++ b/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.tsx
@@ -0,0 +1,361 @@
+import * as React from 'react';
+import PropTypes from 'prop-types';
+import { ChartContainerProps } from '@mui/x-charts/ChartContainer';
+import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
+import { HighlightedProvider, ZAxisContextProvider } from '@mui/x-charts/context';
+import {
+ CartesianContextProvider,
+ ChartsAxesGradients,
+ ColorProvider,
+ DrawingProvider,
+ InteractionProvider,
+ SeriesContextProvider,
+ useChartContainerHooks,
+} from '@mui/x-charts/internals';
+import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
+import { getReleaseInfo } from '../internals/utils/releaseInfo';
+
+const releaseInfo = getReleaseInfo();
+
+export interface ChartContainerProProps extends ChartContainerProps {}
+
+const ChartContainerPro = React.forwardRef(function ChartContainer(
+ props: ChartContainerProProps,
+ ref,
+) {
+ const {
+ width,
+ height,
+ series,
+ margin,
+ xAxis,
+ yAxis,
+ zAxis,
+ colors,
+ dataset,
+ sx,
+ title,
+ desc,
+ disableAxisListener,
+ highlightedItem,
+ onHighlightChange,
+ plugins,
+ children,
+ } = props;
+
+ useLicenseVerifier('x-charts-pro', releaseInfo);
+
+ const {
+ svgRef,
+ handleRef,
+ xExtremumGetters,
+ yExtremumGetters,
+ seriesFormatters,
+ colorProcessors,
+ } = useChartContainerHooks(ref, plugins);
+
+ return (
+
+
+
+
+
+
+
+
+
+ {children}
+
+
+
+
+
+
+
+
+ );
+});
+
+ChartContainerPro.propTypes = {
+ // ----------------------------- Warning --------------------------------
+ // | These PropTypes are generated from the TypeScript type definitions |
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
+ // ----------------------------------------------------------------------
+ children: PropTypes.node,
+ className: PropTypes.string,
+ /**
+ * Color palette used to colorize multiple series.
+ * @default blueberryTwilightPalette
+ */
+ colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
+ /**
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
+ */
+ dataset: PropTypes.arrayOf(PropTypes.object),
+ desc: PropTypes.string,
+ /**
+ * If `true`, the charts will not listen to the mouse move event.
+ * It might break interactive features, but will improve performance.
+ * @default false
+ */
+ disableAxisListener: PropTypes.bool,
+ /**
+ * The height of the chart in px.
+ */
+ height: PropTypes.number.isRequired,
+ /**
+ * The item currently highlighted. Turns highlighting into a controlled prop.
+ */
+ highlightedItem: PropTypes.shape({
+ dataIndex: PropTypes.number,
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
+ }),
+ /**
+ * The margin between the SVG and the drawing area.
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
+ * @default object Depends on the charts type.
+ */
+ margin: PropTypes.shape({
+ bottom: PropTypes.number,
+ left: PropTypes.number,
+ right: PropTypes.number,
+ top: PropTypes.number,
+ }),
+ /**
+ * The callback fired when the highlighted item changes.
+ *
+ * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
+ */
+ onHighlightChange: PropTypes.func,
+ /**
+ * An array of plugins defining how to preprocess data.
+ * If not provided, the container supports line, bar, scatter and pie charts.
+ */
+ plugins: PropTypes.arrayOf(PropTypes.object),
+ /**
+ * The array of series to display.
+ * Each type of series has its own specificity.
+ * Please refer to the appropriate docs page to learn more about it.
+ */
+ series: PropTypes.arrayOf(PropTypes.object).isRequired,
+ sx: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])),
+ PropTypes.func,
+ PropTypes.object,
+ ]),
+ title: PropTypes.string,
+ viewBox: PropTypes.shape({
+ height: PropTypes.number,
+ width: PropTypes.number,
+ x: PropTypes.number,
+ y: PropTypes.number,
+ }),
+ /**
+ * The width of the chart in px.
+ */
+ width: PropTypes.number.isRequired,
+ /**
+ * The configuration of the x-axes.
+ * If not provided, a default axis config is used.
+ * An array of [[AxisConfig]] objects.
+ */
+ xAxis: PropTypes.arrayOf(
+ PropTypes.shape({
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
+ classes: PropTypes.object,
+ colorMap: PropTypes.oneOfType([
+ PropTypes.shape({
+ color: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.string.isRequired),
+ PropTypes.func,
+ ]).isRequired,
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ type: PropTypes.oneOf(['continuous']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ thresholds: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired,
+ ).isRequired,
+ type: PropTypes.oneOf(['piecewise']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ type: PropTypes.oneOf(['ordinal']).isRequired,
+ unknownColor: PropTypes.string,
+ values: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
+ .isRequired,
+ ),
+ }),
+ ]),
+ data: PropTypes.array,
+ dataKey: PropTypes.string,
+ disableLine: PropTypes.bool,
+ disableTicks: PropTypes.bool,
+ fill: PropTypes.string,
+ hideTooltip: PropTypes.bool,
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
+ label: PropTypes.string,
+ labelFontSize: PropTypes.number,
+ labelStyle: PropTypes.object,
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ position: PropTypes.oneOf(['bottom', 'top']),
+ reverse: PropTypes.bool,
+ scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
+ slotProps: PropTypes.object,
+ slots: PropTypes.object,
+ stroke: PropTypes.string,
+ tickFontSize: PropTypes.number,
+ tickInterval: PropTypes.oneOfType([
+ PropTypes.oneOf(['auto']),
+ PropTypes.array,
+ PropTypes.func,
+ ]),
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
+ tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
+ tickLabelStyle: PropTypes.object,
+ tickMaxStep: PropTypes.number,
+ tickMinStep: PropTypes.number,
+ tickNumber: PropTypes.number,
+ tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
+ tickSize: PropTypes.number,
+ valueFormatter: PropTypes.func,
+ }),
+ ),
+ /**
+ * The configuration of the y-axes.
+ * If not provided, a default axis config is used.
+ * An array of [[AxisConfig]] objects.
+ */
+ yAxis: PropTypes.arrayOf(
+ PropTypes.shape({
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
+ classes: PropTypes.object,
+ colorMap: PropTypes.oneOfType([
+ PropTypes.shape({
+ color: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.string.isRequired),
+ PropTypes.func,
+ ]).isRequired,
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ type: PropTypes.oneOf(['continuous']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ thresholds: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired,
+ ).isRequired,
+ type: PropTypes.oneOf(['piecewise']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ type: PropTypes.oneOf(['ordinal']).isRequired,
+ unknownColor: PropTypes.string,
+ values: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
+ .isRequired,
+ ),
+ }),
+ ]),
+ data: PropTypes.array,
+ dataKey: PropTypes.string,
+ disableLine: PropTypes.bool,
+ disableTicks: PropTypes.bool,
+ fill: PropTypes.string,
+ hideTooltip: PropTypes.bool,
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
+ label: PropTypes.string,
+ labelFontSize: PropTypes.number,
+ labelStyle: PropTypes.object,
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ position: PropTypes.oneOf(['left', 'right']),
+ reverse: PropTypes.bool,
+ scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
+ slotProps: PropTypes.object,
+ slots: PropTypes.object,
+ stroke: PropTypes.string,
+ tickFontSize: PropTypes.number,
+ tickInterval: PropTypes.oneOfType([
+ PropTypes.oneOf(['auto']),
+ PropTypes.array,
+ PropTypes.func,
+ ]),
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
+ tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
+ tickLabelStyle: PropTypes.object,
+ tickMaxStep: PropTypes.number,
+ tickMinStep: PropTypes.number,
+ tickNumber: PropTypes.number,
+ tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
+ tickSize: PropTypes.number,
+ valueFormatter: PropTypes.func,
+ }),
+ ),
+ /**
+ * The configuration of the z-axes.
+ */
+ zAxis: PropTypes.arrayOf(
+ PropTypes.shape({
+ colorMap: PropTypes.oneOfType([
+ PropTypes.shape({
+ color: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.string.isRequired),
+ PropTypes.func,
+ ]).isRequired,
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ type: PropTypes.oneOf(['continuous']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ thresholds: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired,
+ ).isRequired,
+ type: PropTypes.oneOf(['piecewise']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ type: PropTypes.oneOf(['ordinal']).isRequired,
+ unknownColor: PropTypes.string,
+ values: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
+ .isRequired,
+ ),
+ }),
+ ]),
+ data: PropTypes.array,
+ dataKey: PropTypes.string,
+ id: PropTypes.string,
+ }),
+ ),
+} as any;
+
+export { ChartContainerPro };
diff --git a/packages/x-charts-pro/src/ChartContainerPro/index.ts b/packages/x-charts-pro/src/ChartContainerPro/index.ts
new file mode 100644
index 000000000000..3ca7bddfcdfc
--- /dev/null
+++ b/packages/x-charts-pro/src/ChartContainerPro/index.ts
@@ -0,0 +1 @@
+export * from './ChartContainerPro';
diff --git a/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.test.tsx b/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.test.tsx
index e8fcf52be087..007e7217a8e3 100644
--- a/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.test.tsx
+++ b/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.test.tsx
@@ -2,11 +2,18 @@ import * as React from 'react';
import { expect } from 'chai';
import { createRenderer, screen, waitFor } from '@mui/internal-test-utils';
import { LicenseInfo } from '@mui/x-license';
+import { sharedLicenseStatuses } from '@mui/x-license/useLicenseVerifier/useLicenseVerifier';
import { ResponsiveChartContainerPro } from './ResponsiveChartContainerPro';
describe(' - License', () => {
const { render } = createRenderer();
+ beforeEach(() => {
+ Object.keys(sharedLicenseStatuses).forEach((key) => {
+ delete sharedLicenseStatuses[key];
+ });
+ });
+
it('should render watermark when the license is missing', async () => {
LicenseInfo.setLicenseKey('');
@@ -15,7 +22,7 @@ describe(' - License', () => {
).toErrorDev(['MUI X: Missing license key.']);
await waitFor(() => {
- expect(screen.getByText('MUI X Missing license key')).to.not.equal(null);
+ expect(screen.findAllByText('MUI X Missing license key')).to.not.equal(null);
});
});
});
diff --git a/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.tsx b/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.tsx
index c508e7209514..e65ebb933b40 100644
--- a/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.tsx
+++ b/packages/x-charts-pro/src/ResponsiveChartContainerPro/ResponsiveChartContainerPro.tsx
@@ -1,10 +1,10 @@
import * as React from 'react';
import PropTypes from 'prop-types';
-import { useLicenseVerifier, Watermark } from '@mui/x-license';
-import { ChartContainer } from '@mui/x-charts/ChartContainer';
+import { Watermark } from '@mui/x-license/Watermark';
import { ResponsiveChartContainerProps } from '@mui/x-charts/ResponsiveChartContainer';
import { ResizableContainer, useChartContainerDimensions } from '@mui/x-charts/internals';
import { getReleaseInfo } from '../internals/utils/releaseInfo';
+import { ChartContainerPro } from '../ChartContainerPro';
export interface ResponsiveChartContainerProProps extends ResponsiveChartContainerProps {}
@@ -17,12 +17,10 @@ const ResponsiveChartContainerPro = React.forwardRef(function ResponsiveChartCon
const { width: inWidth, height: inHeight, ...other } = props;
const [containerRef, width, height] = useChartContainerDimensions(inWidth, inHeight);
- useLicenseVerifier('x-charts-pro', releaseInfo);
-
return (
{width && height ? (
-
+
) : null}
@@ -118,15 +116,6 @@ ResponsiveChartContainerPro.propTypes = {
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
classes: PropTypes.object,
colorMap: PropTypes.oneOfType([
- PropTypes.shape({
- colors: PropTypes.arrayOf(PropTypes.string).isRequired,
- type: PropTypes.oneOf(['ordinal']).isRequired,
- unknownColor: PropTypes.string,
- values: PropTypes.arrayOf(
- PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
- .isRequired,
- ),
- }),
PropTypes.shape({
color: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.string.isRequired),
@@ -143,6 +132,15 @@ ResponsiveChartContainerPro.propTypes = {
).isRequired,
type: PropTypes.oneOf(['piecewise']).isRequired,
}),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ type: PropTypes.oneOf(['ordinal']).isRequired,
+ unknownColor: PropTypes.string,
+ values: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
+ .isRequired,
+ ),
+ }),
]),
data: PropTypes.array,
dataKey: PropTypes.string,
@@ -189,15 +187,6 @@ ResponsiveChartContainerPro.propTypes = {
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
classes: PropTypes.object,
colorMap: PropTypes.oneOfType([
- PropTypes.shape({
- colors: PropTypes.arrayOf(PropTypes.string).isRequired,
- type: PropTypes.oneOf(['ordinal']).isRequired,
- unknownColor: PropTypes.string,
- values: PropTypes.arrayOf(
- PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
- .isRequired,
- ),
- }),
PropTypes.shape({
color: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.string.isRequired),
@@ -214,6 +203,15 @@ ResponsiveChartContainerPro.propTypes = {
).isRequired,
type: PropTypes.oneOf(['piecewise']).isRequired,
}),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ type: PropTypes.oneOf(['ordinal']).isRequired,
+ unknownColor: PropTypes.string,
+ values: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
+ .isRequired,
+ ),
+ }),
]),
data: PropTypes.array,
dataKey: PropTypes.string,
@@ -250,6 +248,43 @@ ResponsiveChartContainerPro.propTypes = {
valueFormatter: PropTypes.func,
}),
),
+ /**
+ * The configuration of the z-axes.
+ */
+ zAxis: PropTypes.arrayOf(
+ PropTypes.shape({
+ colorMap: PropTypes.oneOfType([
+ PropTypes.shape({
+ color: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.string.isRequired),
+ PropTypes.func,
+ ]).isRequired,
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
+ type: PropTypes.oneOf(['continuous']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ thresholds: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired,
+ ).isRequired,
+ type: PropTypes.oneOf(['piecewise']).isRequired,
+ }),
+ PropTypes.shape({
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
+ type: PropTypes.oneOf(['ordinal']).isRequired,
+ unknownColor: PropTypes.string,
+ values: PropTypes.arrayOf(
+ PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
+ .isRequired,
+ ),
+ }),
+ ]),
+ data: PropTypes.array,
+ dataKey: PropTypes.string,
+ id: PropTypes.string,
+ }),
+ ),
} as any;
export { ResponsiveChartContainerPro };
diff --git a/packages/x-charts-pro/src/index.ts b/packages/x-charts-pro/src/index.ts
index 6aa3762c874e..244186c6588e 100644
--- a/packages/x-charts-pro/src/index.ts
+++ b/packages/x-charts-pro/src/index.ts
@@ -24,3 +24,4 @@ export * from '@mui/x-charts/Gauge';
export * from '@mui/x-charts/ChartsSurface';
export * from './ResponsiveChartContainerPro';
+export * from './ChartContainerPro';
diff --git a/packages/x-charts/src/ChartContainer/ChartContainer.tsx b/packages/x-charts/src/ChartContainer/ChartContainer.tsx
index 7ebdd67c0e32..6af023914930 100644
--- a/packages/x-charts/src/ChartContainer/ChartContainer.tsx
+++ b/packages/x-charts/src/ChartContainer/ChartContainer.tsx
@@ -1,6 +1,5 @@
import * as React from 'react';
import PropTypes from 'prop-types';
-import useForkRef from '@mui/utils/useForkRef';
import { DrawingProvider, DrawingProviderProps } from '../context/DrawingProvider';
import {
SeriesContextProvider,
@@ -8,7 +7,6 @@ import {
} from '../context/SeriesContextProvider';
import { InteractionProvider } from '../context/InteractionProvider';
import { ColorProvider } from '../context/ColorProvider';
-import { useReducedMotion } from '../hooks/useReducedMotion';
import { ChartsSurface, ChartsSurfaceProps } from '../ChartsSurface';
import {
CartesianContextProvider,
@@ -23,7 +21,7 @@ import {
} from '../context';
import { ChartsPluginType } from '../models/plugin';
import { ChartSeriesType } from '../models/seriesType/config';
-import { usePluginsMerge } from './usePluginsMerge';
+import { useChartContainerHooks } from './useChartContainerHooks';
export type ChartContainerProps = Omit<
ChartsSurfaceProps &
@@ -62,12 +60,14 @@ const ChartContainer = React.forwardRef(function ChartContainer(props: ChartCont
plugins,
children,
} = props;
- const svgRef = React.useRef(null);
- const handleRef = useForkRef(ref, svgRef);
-
- const { xExtremumGetters, yExtremumGetters, seriesFormatters, colorProcessors } =
- usePluginsMerge(plugins);
- useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
+ const {
+ svgRef,
+ handleRef,
+ xExtremumGetters,
+ yExtremumGetters,
+ seriesFormatters,
+ colorProcessors,
+ } = useChartContainerHooks(ref, plugins);
return (
diff --git a/packages/x-charts/src/ChartContainer/useChartContainerHooks.ts b/packages/x-charts/src/ChartContainer/useChartContainerHooks.ts
new file mode 100644
index 000000000000..da8d4834f986
--- /dev/null
+++ b/packages/x-charts/src/ChartContainer/useChartContainerHooks.ts
@@ -0,0 +1,27 @@
+import useForkRef from '@mui/utils/useForkRef';
+import * as React from 'react';
+import { usePluginsMerge } from './usePluginsMerge';
+import { useReducedMotion } from '../hooks/useReducedMotion';
+import { ChartsPluginType } from '../models';
+import { ChartSeriesType } from '../models/seriesType/config';
+
+export const useChartContainerHooks = (
+ ref: React.ForwardedRef | null,
+ plugins?: ChartsPluginType[],
+) => {
+ const svgRef = React.useRef(null);
+ const handleRef = useForkRef(ref, svgRef);
+
+ const { xExtremumGetters, yExtremumGetters, seriesFormatters, colorProcessors } =
+ usePluginsMerge(plugins);
+ useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
+
+ return {
+ svgRef,
+ handleRef,
+ xExtremumGetters,
+ yExtremumGetters,
+ seriesFormatters,
+ colorProcessors,
+ };
+};
diff --git a/packages/x-charts/src/context/ColorProvider.tsx b/packages/x-charts/src/context/ColorProvider.tsx
index 46faebddded3..e7061912c086 100644
--- a/packages/x-charts/src/context/ColorProvider.tsx
+++ b/packages/x-charts/src/context/ColorProvider.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
import { ColorProcessorsConfig } from '../models';
-import { ChartSeriesType } from '../internals';
+import { ChartSeriesType } from '../models/seriesType/config';
export interface ColorProviderProps {
children: React.ReactNode;
diff --git a/packages/x-charts/src/internals/index.ts b/packages/x-charts/src/internals/index.ts
index 6e6bafd231d4..2c9a56da60c9 100644
--- a/packages/x-charts/src/internals/index.ts
+++ b/packages/x-charts/src/internals/index.ts
@@ -7,6 +7,7 @@ export * from '../ResponsiveChartContainer/ResizableContainer';
// hooks
export { useReducedMotion } from '../hooks/useReducedMotion';
export { useSeries } from '../hooks/useSeries';
+export { useChartContainerHooks } from '../ChartContainer/useChartContainerHooks';
// utils
export * from './defaultizeValueFormatter';
@@ -16,9 +17,11 @@ export * from './configInit';
export * from '../context/CartesianContextProvider';
export * from '../context/DrawingProvider';
+export * from '../context/ColorProvider';
export * from '../context/InteractionProvider';
export * from '../context/SeriesContextProvider';
export * from '../context/ZAxisContextProvider';
+export type * from '../context/context.types';
// series configuration
export * from '../models/seriesType/config';