Skip to main content

Variable: usePlotArea

@arolariu/components


@arolariu/components / usePlotArea

Variable: usePlotArea

usePlotArea: () => PlotArea

Defined in: components/ui/chart.tsx:630

Plot area is the area where the actual chart data is rendered. This means: bars, lines, scatter points, etc.

The plot area is calculated based on the chart dimensions and the offset.

Plot area width and height are the dimensions in pixels; x and y are the coordinates of the top-left corner of the plot area relative to the chart container.

They are also independent of the scale and zoom, meaning that as the user zooms in and out, the plot area dimensions will not change as the chart gets visually larger or smaller.

This hook must be used within a chart context (inside a <LineChart>, <BarChart>, etc.). This hook returns undefined if used outside a chart context.

Returns

PlotArea

Plot area of the chart in pixels, or undefined if used outside a chart context.

Since

3.1

// was this page useful?