Line Chart based on Django2.2+plotly Visualization data
This article introduces the relevant knowledge of "Django2.2+plotly Visualization data implementation Line Chart". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Reference article
1 https://www.codingwithricky.com/2019/08/28/easy-django-plotly/
2 https://plotly.com/python/box-plots/
3 https://github.com/ricleal/DjangoPlotLy/tree/master/site1
This is an app written by Django. It's worth looking at carefully.
4 https://towardsdatascience.com/how-to-create-a-plotly-visualization-and-embed-it-on-websites-517c1a78568b
5 https://medium.com/better-programming/prettify-python-django-with-beautiful-visual-charts-836fe6646305
Update plotlypip install-- upgrade plotly
Create a project and appdjango-admin startproject django_plotly
Cd django_plotly
Python manage.py startapp boxplot
Set up url add template
View function
Rom django.shortcuts import render
From plotly.offline import plot
From plotly.graph_objs import Scatter
# Create your views here.
Def index (request):
X_data = [0Jing 1pm 2JI 3]
Y_data = [xylene 2 for x in x_data]
Data = Scatter (xchangxroomdatamemorialityplayplaydatamemorialityplayplaydatamemorialityplayplaydatagradityredityredity08reparation.co.com.cn.
Plot_div = plot ([data], output_type='div')
Context = {'plot_div':plot_div}
Return render (request,'boxplot/index.html',context=context)
Html code
A simple line chart
How are you?
{{plot_div | safe}}
I'm fine!
The rendering result of the web page
The content of "Django2.2+plotly Visualization data realization Line Chart" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!