Closed MrSassyBritches closed 1 year ago
I was having the same issue. To solve your issue, you will need to install one of the following date adapters (whichever you prefer):
I see that you are already using moment
so you could use the date adapter for moment by adding this script:
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@^1"></script>
and by using moment()
in your x
field instead of Date.now
. So something like this:
realtime: {
delay: 2000,
onRefresh: chart => {
chart.data.datasets.forEach(dataset => {
dataset.data.push({
x: moment(),
y: Math.random()
});
});
}
}
}
Let me know if you have any questions!
I am having an issue and I am not sure how to troubleshoot from here. I am running a Flask app to visualize scientific instrument data. I have used chartjs to show this data in real time but its not as smooth as this plugin. When trying to run the tutorial I receive the following error:
I found removing the x-scale options allows the chart to render with no errors.
Remove this and the chart renders, of course without any data or functionality:
Any insight on how to get around this or what I am doing wrong would be greatly appreciated, thank you :)