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

Function onClick

src/plugins/plugin.legend.js:645–655  ·  src/plugins/plugin.legend.js::onClick
(e, legendItem, legend)

Source from the content-addressed store, hash-verified

643
644 class="cm">// a callback that will handle
645 onClick(e, legendItem, legend) {
646 const index = legendItem.datasetIndex;
647 const ci = legend.chart;
648 if (ci.isDatasetVisible(index)) {
649 ci.hide(index);
650 legendItem.hidden = true;
651 } else {
652 ci.show(index);
653 legendItem.hidden = false;
654 }
655 },
656
657 onHover: null,
658 onLeave: null,

Callers

nothing calls this directly

Calls 3

isDatasetVisibleMethod · 0.80
hideMethod · 0.80
showMethod · 0.80

Tested by

no test coverage detected