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

Method buildLabels

src/plugins/plugin.legend.js:104–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102 }
103
104 buildLabels() {
105 const labelOpts = this.options.labels || {};
106 let legendItems = call(labelOpts.generateLabels, [this.chart], this) || [];
107
108 if (labelOpts.filter) {
109 legendItems = legendItems.filter((item) => labelOpts.filter(item, this.chart.data));
110 }
111
112 if (labelOpts.sort) {
113 legendItems = legendItems.sort((a, b) => labelOpts.sort(a, b, this.chart.data));
114 }
115
116 if (this.options.reverse) {
117 legendItems.reverse();
118 }
119
120 this.legendItems = legendItems;
121 }
122
123 fit() {
124 const {options, ctx} = this;

Callers 2

updateMethod · 0.95
afterUpdateFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected