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

Method draw

src/core/core.datasetController.js:712–743  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

710 update(mode) {} // eslint-disable-line no-unused-vars
711
712 draw() {
713 const ctx = this._ctx;
714 const chart = this.chart;
715 const meta = this._cachedMeta;
716 const elements = meta.data || [];
717 const area = chart.chartArea;
718 const active = [];
719 const start = this._drawStart || 0;
720 const count = this._drawCount || (elements.length - start);
721 const drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;
722 let i;
723
724 if (meta.dataset) {
725 meta.dataset.draw(ctx, area, start, count);
726 }
727
728 for (i = start; i < start + count; ++i) {
729 const element = elements[i];
730 if (element.hidden) {
731 continue;
732 }
733 if (element.active && drawActiveElementsOnTop) {
734 active.push(element);
735 } else {
736 element.draw(ctx, area);
737 }
738 }
739
740 for (i = 0; i < active.length; ++i) {
741 active[i].draw(ctx, area);
742 }
743 }
744
745 /**
746 * Returns a set of predefined style properties that should be used to represent the dataset

Callers

nothing calls this directly

Calls 1

drawMethod · 0.65

Tested by

no test coverage detected