MCPcopy Create free account
hub / github.com/chartjs/Chart.js / getBoxSize

Function getBoxSize

src/plugins/plugin.legend.ts:112–125  ·  view source on GitHub ↗
(labelOpts: LegendLabelOptions, fontSize: number)

Source from the content-addressed store, hash-verified

110}
111
112const getBoxSize = (labelOpts: LegendLabelOptions, fontSize: number) => {
113 let {boxHeight = fontSize, boxWidth = fontSize} = labelOpts;
114
115 if (labelOpts.usePointStyle) {
116 boxHeight = Math.min(boxHeight, fontSize);
117 boxWidth = labelOpts.pointStyleWidth || Math.min(boxWidth, fontSize);
118 }
119
120 return {
121 boxWidth,
122 boxHeight,
123 itemHeight: Math.max(fontSize, boxHeight)
124 };
125};
126
127const itemsEqual = (a: LegendItem | null, b: LegendItem | null) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index;
128

Callers 1

fitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected