useChartWidth
Returns the width of the chart in pixels. If you are using chart with hardcoded If you are using a chart with a If the chart has any axes or legend, the The dimensions do not scale, meaning as user zoom in and out, the width number will not change as the chart gets visually larger or smaller. Returns width prop, then the width returned will be the same as the width prop on the main chart element.ResponsiveContainer, the width will be the size of the chart as the ResponsiveContainer has decided it would be.width will be the size of the chart including the axes and legend. Meaning: adding axes and legend will not change the width.undefined if used outside a chart context.
Return value
number | undefined
The width of the chart in pixels, or undefined if not in a chart context.