Search⌘ K
AI Features

Plotting Charts

Explore how to customize the Django Admin by integrating Chart.js to create dynamic bar charts. Learn to load static chart assets, embed JavaScript, and add canvas elements in your admin templates to visualize data visually.

We'll cover the following...

Plotting charts

Now that you know how to extend the Django admin templates, you can imagine what you want as new features.

As an example, you will learn how to integrate the chart.js library in your Author list page view.

In your sample_app/templates/admin/sample_app/author/change_list.html you will find the {{block.super}} and load the chart.js library (line 7 in unedited file).

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.css"/>
<script src= "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js"> </script>
...