diff --git a/packages/x-charts/src/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.tsx b/packages/x-charts/src/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.tsx index 6b6957ab154d3..f88979c928dc8 100644 --- a/packages/x-charts/src/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.tsx +++ b/packages/x-charts/src/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.tsx @@ -13,6 +13,10 @@ type ChartsPiecewiseGradientProps = { export default function ChartsPiecewiseGradient(props: ChartsPiecewiseGradientProps) { const { isReversed, gradientId, size, direction, scale, colorMap } = props; + if (size <= 0) { + return null; + } + return (