MCPcopy Index your code
hub / github.com/tinyplex/tinybase / getPlotFrame

Function getPlotFrame

src/ui-react-dom-charts/common/svg.ts:59–75  ·  view source on GitHub ↗
(
  [width, height]: Size,
  [, , , xAxisHeight, yAxisWidth, inset, fontSize]: Style,
)

Source from the content-addressed store, hash-verified

57export const getLabelSize = ([, , chartStyle]: RefAndLayout) => chartStyle[6];
58
59export const getPlotFrame = (
60 [width, height]: Size,
61 [, , , xAxisHeight, yAxisWidth, inset, fontSize]: Style,
62): PlotFrame => {
63 const plotX = inset + mathMax(mathMin(yAxisWidth, width / 2 - 2 * inset), 0);
64 const plotY = inset + fontSize / 2;
65 const plotRight = inset + fontSize / 2;
66 const plotHeight = mathMax(
67 height -
68 plotY -
69 mathMax(mathMin(xAxisHeight, height / 2 - plotY - inset), 0) -
70 inset,
71 0,
72 );
73
74 return [plotX, plotY, mathMax(width - plotX - plotRight, 0), plotHeight];
75};
76
77const getDefaultStyle = (fontSize: number): Style =>
78 arrayMap(DEFAULT_STYLE, (value) => value * fontSize) as unknown as Style;

Callers 2

CartesianChartFunction · 0.90
getPlotSizeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…