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

Function buildPointLabelItems

src/scales/scale.radialLinear.js:176–201  ·  view source on GitHub ↗
(scale, labelSizes, padding)

Source from the content-addressed store, hash-verified

174}
175
176function buildPointLabelItems(scale, labelSizes, padding) {
177 const items = [];
178 const valueCount = scale._pointLabels.length;
179 const opts = scale.options;
180 const {centerPointLabels, display} = opts.pointLabels;
181 const itemOpts = {
182 extra: getTickBackdropHeight(opts) / 2,
183 additionalAngle: centerPointLabels ? PI / valueCount : 0
184 };
185 let area;
186
187 for (let i = 0; i < valueCount; i++) {
188 itemOpts.padding = padding[i];
189 itemOpts.size = labelSizes[i];
190
191 const item = createPointLabelItem(scale, i, itemOpts);
192 items.push(item);
193 if (display === 'auto') {
194 item.visible = isNotOverlapped(item, area);
195 if (item.visible) {
196 area = item;
197 }
198 }
199 }
200 return items;
201}
202
203function getTextAlignForAngle(angle) {
204 if (angle === 0 || angle === 180) {

Callers 1

fitWithPointLabelsFunction · 0.85

Calls 3

getTickBackdropHeightFunction · 0.85
createPointLabelItemFunction · 0.85
isNotOverlappedFunction · 0.85

Tested by

no test coverage detected