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

Method getLabelAndValue

src/controllers/controller.bar.ts:472–485  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

470 }
471
472 protected override getLabelAndValue(index: number): {label: string; value: string} {
473 const meta: BarMeta = this._cachedMeta;
474 const {iScale, vScale} = meta;
475 const parsed: BarParsed = this.getParsed(index);
476 const custom = parsed._custom;
477 const value = isFloatBar(custom)
478 ? '[' + custom.start + ', ' + custom.end + ']'
479 : '' + vScale.getLabelForValue(parsed[vScale.axis]);
480
481 return {
482 label: '' + iScale.getLabelForValue(parsed[iScale.axis]),
483 value
484 };
485 }
486
487 /**
488 * A bar hidden by `chart.toggleDataVisibility` collapses to its base.

Callers 3

labelOfFunction · 0.45
labelOfFunction · 0.45
createTooltipItemFunction · 0.45

Calls 3

isFloatBarFunction · 0.85
getParsedMethod · 0.80
getLabelForValueMethod · 0.65

Tested by 2

labelOfFunction · 0.36
labelOfFunction · 0.36