-
Notifications
You must be signed in to change notification settings - Fork 12k
Open
Labels
Description
Feature Proposal
chart.data.datasets = Object.keys(data[territorialUnit]).map(representationMethod => {
const hidden = chart.data.datasets.find(entry => entry.label === representationMethod)?.hidden;
return {
label: representationMethod,
data: Object.fromEntries(Object.entries(data[territorialUnit][representationMethod]).filter(filter)),
borderWidth: 1,
hidden: hidden ?? representationMethod !== defaultRepresentationMethod,
};
});
chart.update();The above is always resetting hidden to the default value (the !==), because dataset.hidden is not updated when user interacts.
I'm assigning datasets this way instead of .data = because I'm downloading the data asynchronously, so there's no initial data when the chart is created. I'm not checking if the dataset already exists, because in my opinion this would be unnecessary code.
Possible Implementation
No response