I’m using Chart JS to try and add a graph into my web app. I’ve included the <script></script>
directly into my template (using Django MVT framework) and I’m trying to render the HTML into Chrome but the chart isn’t showing, even though the code is an almost direct copy from the Chart JS website’s “getting started” section (which works fine!).
The data is coming from the back-end properly because I can see it with chrome dev tools, however the canvas is just a blank square.
I’ve seen about a dozen videos and guides online where people use the same code and their graphs are working. Other Stack threads don’t help either as they are either to do with refreshing data or thread never got closed, so stuck on what’s going on.
Things I’ve tried:
- Tried setting dates to strings instead to see if that makes a difference, nope.
- Tried moving the CDN placement in my code, no difference.
- Setting “beginAtZero: false”
Been playing spot the difference for a couple of days with no success. The only thing I can possibly think is it’s something to do with the options for the line graph… no idea where to begin though as documentation seems incomplete. Here are screenshots of the “getting started” code working and my own code not working.