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

Method drawLabels

src/core/core.scale.js:1559–1585  ·  view source on GitHub ↗

* @protected

(chartArea)

Source from the content-addressed store, hash-verified

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