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

Function applyItemTextAlign

src/plugins/plugin.legend.ts:141–147  ·  view source on GitHub ↗

* The text alignment of an item: its own, or else the labels' one, which is * written back to the item because users read `legendItems[i].textAlign`.

(item: LegendItem | undefined, labelAlign: TextAlign)

Source from the content-addressed store, hash-verified

139 * written back to the item because users read `legendItems[i].textAlign`.
140 */
141function applyItemTextAlign(item: LegendItem | undefined, labelAlign: TextAlign): TextAlign {
142 // The labels are built again after fit(), so there can be fewer items than hit boxes.
143 if (!item) {
144 return labelAlign;
145 }
146 return item.textAlign || (item.textAlign = labelAlign);
147}
148
149/**
150 * What `adjustHitBoxes()` reads once to place every item.

Callers 1

adjustHitBoxesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected