[Chartjs]-How do I obtain a Chart instance for Chart.js

3👍

The Chart object is defined in Chart.min.js. It looks like that script isn’t being loaded.

I think you’re missing quotes around the value of the src attribute in the <script> tag in your header – try:

<script type="text/javascript" src="{% static 'js/Chart.min.js' %}"></script>

1👍

I discovered that by moving the Chart.min.js included line BELOW the jQuery included line, it springs into life. Like so:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script type="text/javascript" src="{% static 'js/Chart.min.js' %}"></script>

Presumably Chart.js is dependent on jQuery.

Leave a comment