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

Method _layers

src/core/core.scale.js:1641–1675  ·  view source on GitHub ↗

* @return {object[]} * @private

()

Source from the content-addressed store, hash-verified

1639 * @private
1640 */
1641 _layers() {
1642 const opts = this.options;
1643 const tz = opts.ticks && opts.ticks.z || 0;
1644 const gz = valueOrDefault(opts.grid && opts.grid.z, -1);
1645 const bz = valueOrDefault(opts.border && opts.border.z, 0);
1646
1647 if (!this._isVisible() || this.draw !== Scale.prototype.draw) {
1648 // backward compatibility: draw has been overridden by custom scale
1649 return [{
1650 z: tz,
1651 draw: (chartArea) => {
1652 this.draw(chartArea);
1653 }
1654 }];
1655 }
1656
1657 return [{
1658 z: gz,
1659 draw: (chartArea) => {
1660 this.drawBackground();
1661 this.drawGrid(chartArea);
1662 this.drawTitle();
1663 }
1664 }, {
1665 z: bz,
1666 draw: () => {
1667 this.drawBorder();
1668 }
1669 }, {
1670 z: tz,
1671 draw: (chartArea) => {
1672 this.drawLabels(chartArea);
1673 }
1674 }];
1675 }
1676
1677 /**
1678 * Returns visible dataset metas that are attached to this scale

Callers 2

_updateLayoutMethod · 0.80

Calls 8

_isVisibleMethod · 0.95
drawMethod · 0.95
drawBackgroundMethod · 0.95
drawGridMethod · 0.95
drawTitleMethod · 0.95
drawBorderMethod · 0.95
drawLabelsMethod · 0.95
valueOrDefaultFunction · 0.85

Tested by

no test coverage detected