diff --git a/packages/x-charts/src/BarChart/BarPlot.tsx b/packages/x-charts/src/BarChart/BarPlot.tsx index bf8e47ddd0833..7102c0e253880 100644 --- a/packages/x-charts/src/BarChart/BarPlot.tsx +++ b/packages/x-charts/src/BarChart/BarPlot.tsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { to, useTransition } from '@react-spring/web'; import { SeriesContext } from '../context/SeriesContextProvider'; import { CartesianContext } from '../context/CartesianContextProvider'; -import { BarElement, BarElementProps, BarElementSlotProps, BarElementSlots } from './BarElement'; +import { BarElement, BarElementSlotProps, BarElementSlots } from './BarElement'; import { AxisDefaultized, isBandScaleConfig, isPointScaleConfig } from '../models/axis'; import { FormatterResult } from '../models/seriesType/config'; import { HighlightScope } from '../context/HighlightProvider'; @@ -11,7 +11,7 @@ import { BarItemIdentifier, BarSeriesType } from '../models'; import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants'; import { SeriesId } from '../models/seriesType/common'; import getColor from './getColor'; -import { BarElementLabel } from './BarElementLabel'; +import { BarElementLabel, BarElementLabelSlotProps, BarElementLabelSlots } from './BarElementLabel'; /** * Solution of the equations @@ -45,11 +45,11 @@ function getBandSize({ }; } -export interface BarPlotSlots extends BarElementSlots {} +export interface BarPlotSlots extends BarElementSlots, BarElementLabelSlots {} -export interface BarPlotSlotProps extends BarElementSlotProps {} +export interface BarPlotSlotProps extends BarElementSlotProps, BarElementLabelSlotProps {} -export interface BarPlotProps extends Pick { +export interface BarPlotProps extends BarPlotSlotProps { /** * If `true`, animations are skipped. * @default false @@ -289,6 +289,7 @@ function BarPlot(props: BarPlotProps) { seriesId={seriesId} dataIndex={dataIndex} color={color} + {...other} style={ { ...style, @@ -296,7 +297,6 @@ function BarPlot(props: BarPlotProps) { y: to([(style as any).y, (style as any).height], (x, width) => (x ?? 0) + width / 2), } as any } - // When value is 0 we don't want to show the label either labelText={value ? value.toString() : null} /> ))}