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

Function onClick

src/plugins/plugin.legend.ts:836–846  ·  view source on GitHub ↗
(_e, legendItem, legend)

Source from the content-addressed store, hash-verified

834
835 // a callback that will handle
836 onClick(_e, legendItem, legend) {
837 const index = legendItem.datasetIndex;
838 const ci = legend.chart;
839 if (ci.isDatasetVisible(index)) {
840 ci.hide(index);
841 legendItem.hidden = true;
842 } else {
843 ci.show(index);
844 legendItem.hidden = false;
845 }
846 },
847
848 onHover: null,
849 onLeave: null,

Callers

nothing calls this directly

Calls 3

isDatasetVisibleMethod · 0.80
hideMethod · 0.80
showMethod · 0.80

Tested by

no test coverage detected