Chart.js
Chart.js copied to clipboard
[plugin][HTML Legend]: Support Shadow Dom
Feature Proposal
The plugin uses document.getElementById(id) and therefore cannot find elements within a Shadow DOM.
options: {
plugins: {
htmlLegend: {
// ID of the container to put the legend in
containerID: 'legend-container',
},
legend: {
display: false,
}
}
},
Possible Implementation
The plugin accepts nodes in addition to CSS selectors.
options: {
plugins: {
htmlLegend: {
getContainer: () => this.shadowRoot.querySelector('#legend-container'),
},
legend: {
display: false,
}
}
},