MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / resolveCenterPlotCss

Function resolveCenterPlotCss

src/renderers/createPieRenderer.ts:82–97  ·  view source on GitHub ↗
(
  center: PieCenter | undefined,
  plotWidthCss: number,
  plotHeightCss: number
)

Source from the content-addressed store, hash-verified

80};
81
82const resolveCenterPlotCss = (
83 center: PieCenter | undefined,
84 plotWidthCss: number,
85 plotHeightCss: number
86): { readonly x: number; readonly y: number } => {
87 const xRaw = center?.[0] ?? '50%';
88 const yRaw = center?.[1] ?? '50%';
89
90 const x = parseNumberOrPercent(xRaw, plotWidthCss);
91 const y = parseNumberOrPercent(yRaw, plotHeightCss);
92
93 return {
94 x: Number.isFinite(x) ? x! : plotWidthCss * 0.5,
95 y: Number.isFinite(y) ? y! : plotHeightCss * 0.5,
96 };
97};
98
99const isRadiusTuple = (
100 radius: PieRadius

Callers 1

prepareFunction · 0.85

Calls 1

parseNumberOrPercentFunction · 0.70

Tested by

no test coverage detected