Closed timipoky closed 1 year ago
With some trial and error I made it work with
updateChart = function (data) {
const isDataShown = chartJS_w3.isDatasetVisible(data.value);
if (isDataShown === true) {
chartJS_w3.data.datasets[data.value].hidden = true;
chartJS_w3.update();
}
if (isDataShown === false) {
chartJS_w3.data.datasets[data.value].hidden = false;
chartJS_w3.update();
}
}
Hello, is it possible to access the Chart from different script?
I would like to add checkboxes to show/hide datasets in multiple dataset pie.
I can see that in
registerClientScript()
there is initialization of the ChartchartJS_{$id} = new Chart($('#{$id}'),{$config});
, I can see in my app, that it is filled withchartJS_w3
, but when I try to use it I get an errorUncaught ReferenceError: chartJS_w3 is not defined
.This is my code:
I found something similar to what I need at different package