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

Method drawLabels

src/core/core.scale.js:1562–1588  ·  view source on GitHub ↗

* @protected

(chartArea)

Source from the content-addressed store, hash-verified

1560 * @protected
1561 */
1562 drawLabels(chartArea) {
1563 const optionTicks = this.options.ticks;
1564
1565 if (!optionTicks.display) {
1566 return;
1567 }
1568
1569 const ctx = this.ctx;
1570
1571 const area = this._computeLabelArea();
1572 if (area) {
1573 clipArea(ctx, area);
1574 }
1575
1576 const items = this.getLabelItems(chartArea);
1577 for (const item of items) {
1578 const renderTextOptions = item.options;
1579 const tickFont = item.font;
1580 const label = item.label;
1581 const y = item.textOffset;
1582 renderText(ctx, label, 0, y, tickFont, renderTextOptions);
1583 }
1584
1585 if (area) {
1586 unclipArea(ctx);
1587 }
1588 }
1589
1590 /**
1591 * @protected

Callers 2

drawMethod · 0.95
_layersMethod · 0.95

Calls 5

_computeLabelAreaMethod · 0.95
getLabelItemsMethod · 0.95
clipAreaFunction · 0.85
renderTextFunction · 0.85
unclipAreaFunction · 0.85

Tested by

no test coverage detected