MCPcopy
hub / github.com/chartjs/Chart.js / calculateItemWidth

Function calculateItemWidth

src/plugins/plugin.legend.js:561–567  ·  view source on GitHub ↗
(legendItem, boxWidth, labelFont, ctx)

Source from the content-addressed store, hash-verified

559}
560
561function calculateItemWidth(legendItem, boxWidth, labelFont, ctx) {
562 let legendItemText = legendItem.text;
563 if (legendItemText && typeof legendItemText !== 'string') {
564 legendItemText = legendItemText.reduce((a, b) => a.length > b.length ? a : b);
565 }
566 return boxWidth + (labelFont.size / 2) + ctx.measureText(legendItemText).width;
567}
568
569function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {
570 let itemHeight = _itemHeight;

Callers 1

calculateItemSizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected