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

Method _layers

src/core/core.scale.js:1637–1671  ·  view source on GitHub ↗

* @return {object[]} * @private

()

Source from the content-addressed store, hash-verified

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