Django & Plotly.- Plotly Line Charts / Django Form & Template integration

preview_player
Показать описание
In this video, we will learn how to create charts using the Plotly package in Python, and will learn how to display these charts in our Django templates.

We'll create a line-chart from real-life CSV data, using the Plotly Express module, and will create Django forms allowing users to filter between dates and update the chart.

We'll see how to do basic styling of a Plotly chart, including the chart's title and axis labels, as well as modifying fonts and positioning.

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:37 Setup
02:07 Adding Django model
02:58 Loading CSV data to database
06:14 Adding URL and View
06:52 Creating Line Chart with Plotly
10:46 Filtering chart data with Django Form

☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:

#python #csv #plotly
Рекомендации по теме
Комментарии
Автор

I love how this video goes all in on useful information and cuts out the over-production common in so many Youtube videos nowadays. Thanks

mattjackson
Автор

omg, it was that easy! 🤯

thank you for such an easy and quick tutorial! ❤

funkiel-nowka
Автор

Спасибо, классное видео. Стоит отметить, что грамотно использовал фишки Django и отлично изложил материал)

xwjwjnk
Автор

Thanks man, you know exactly what we need.

manofhat
Автор

Thanks by your video. I was looking for a video like this. Helped so much!

pythonscienceanddatascienc
Автор

thank you so much for this video :)
still helping people!
(love dat accent :D)

alexandrecosta
Автор

Thanks for another very helpful video ! Your explanation of the script to import the data from CSV and load it into the Django database was really clear. I was wondering if you could step through your thinking in using a custom script, rather than using Django fixtures?

daviddehoog
Автор

Easily the best plotly/Django integration video on YouTube! I was able to repurpose your form logic to use ModelChoiceField and filter the views by a model category. One question, though: Since the url action initiations a page refresh, how would you go about showing the applied filter on the refreshed page? In your example, the date form field clears after you hit submit so the user only knows what date range they've applied based on the chart visualization.

jedidiahn
Автор

thanks for the content pls do how to create pdf reports with bootstrap images and integration with graphics

jorgeramiroalarconvargas
Автор

could you please make another tuto about integration Django with plotly-dash?

wiki-infodevelopment
Автор

Thanks a lot, excellent as always. Would it be possible for you to make I video about Django charting with Chart.js and how to get the data into the JavaScript (htmx?)

peterholzer
Автор

Amazing video. Thank you for sharing this. Could you please explain how you would deploy an app like this. Particularly with the need to run the load_co2 script.

hprijvu
Автор

Thanks for this good tutorial again.
When we have a start date, we should also have an end date? Because its not plotting without that end date.

fernandtape
Автор

I’ve been trying to implement Chart.js for like 2 days and can not get it working properly. I may give up and use plotly

kodeypatterson
Автор

I keep getting Object of type Product is not JSON serializable but i'm using the same code as you, all i've changed is the query set to demand=Demand.objects.all() and the x and y loop in fig variable :/

redrum
Автор

Really nice video. However, I used the to_html( ) to render the plotly graphs and it is a complete killer of website performance. Is there any way to use it without making the webpage super slow to load?

kkkk
Автор

I great tutorial, I have not been able to get the code to run though. in the load _co2.py it shows an in ' from core.models import CO2' cannot find core. I have the same file structure.
any help would be great

daveskerrett