PitchKit
API Reference@pitchkit/coreFunctions

computeChartFrame()

function computeChartFrame(
   width, 
   height, 
   padding
): ChartFrame;

Defined in: packages/core/src/chart/frame.ts:15

Carves the plot rectangle out of a chart's outer box.

The analogue of createPixelTransform's padding handling, minus every pitch concern: no crop, no orientation, no uniform-scale constraint. A chart's two axes are independent by definition — that is what makes it a chart and not a pitch — so there is no Math.min of the two scales here.

Padding is clamped so a plot area can never be negative: a chart rendered into a container narrower than its own padding collapses to a zero-width plot rather than inverting and drawing itself inside out.

Parameters

ParameterType
widthnumber
heightnumber
paddingChartPadding

Returns

ChartFrame

On this page