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

Function drawPointLabels

src/scales/scale.radialLinear.js:261–288  ·  view source on GitHub ↗
(scale, labelCount)

Source from the content-addressed store, hash-verified

259}
260
261function drawPointLabels(scale, labelCount) {
262 const {ctx, options: {pointLabels}} = scale;
263
264 for (let i = labelCount - 1; i >= 0; i--) {
265 const item = scale._pointLabelItems[i];
266 if (!item.visible) {
267 // overlapping
268 continue;
269 }
270 const optsAtIndex = pointLabels.setContext(scale.getPointLabelContext(i));
271 drawPointLabelBox(ctx, optsAtIndex, item);
272 const plFont = toFont(optsAtIndex.font);
273 const {x, y, textAlign} = item;
274
275 renderText(
276 ctx,
277 scale._pointLabels[i],
278 x,
279 y + (plFont.lineHeight / 2),
280 plFont,
281 {
282 color: optsAtIndex.color,
283 textAlign: textAlign,
284 textBaseline: 'middle'
285 }
286 );
287 }
288}
289
290function pathRadiusLine(scale, radius, circular, labelCount) {
291 const {ctx} = scale;

Callers 1

drawGridMethod · 0.85

Calls 5

drawPointLabelBoxFunction · 0.85
toFontFunction · 0.85
renderTextFunction · 0.85
setContextMethod · 0.80
getPointLabelContextMethod · 0.80

Tested by

no test coverage detected