Dynamically add multiple charts based on a JSON #11508
Unanswered
littlesuzi
asked this question in
Q&A
Replies: 1 comment
-
On this line it seems the id is the same for all the charts you have. ::new Chart(document.getElementById( |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a JSON that has three datasets which I'd like to visualize as a doughnut chart.
Is there a way for me to have only one function that generates a doughnut chart using the dataset at position n? Or how can I write this dynamically?
Right now, I'm getting the error "Canvas is already in use. Chart with ID '" + o.id + "' must be destroyed before the canvas with ID '" + o.canvas.id + "' can be reused."
This is the function I have right now (the element includes the data set and the id is just the id of the element in JSON that is passed).
`function generateDChart(element, id){
const chartContent = document.createElement("canvas"); chartContent.id = id;
Beta Was this translation helpful? Give feedback.
All reactions