Make the `chart.data.datasets.dataset.hidden` reflect the actual value
- Dominant language
- JavaScript
- Stars
- 67.7k
- Forks
- 11.9k
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 5
Description
### Feature Proposal
```js
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_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.