当前位置:网站首页>In fact, it's very simple. It teaches you to easily realize the cool data visualization big screen
In fact, it's very simple. It teaches you to easily realize the cool data visualization big screen
2022-07-07 09:29:00 【Python data mining】
Hello everyone , Today I'd like to share a Python Visual large screen project ,GitHub Address :https://github.com/TurboWay/big_screen,
The project is simple in structure and easy to use , Data visualization can be realized by directly transmitting data . Like to remember to collect 、 Focus on 、 give the thumbs-up .
notes : Technical exchange is provided at the end of the article 、 Source code acquisition method
install
The project relies on third-party modules flask, Therefore, we need to install dependencies first , Installation command :pip install -i https://pypi.tuna.tsinghua.edu.cn/simple flask.
Share some source code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author : way
# @Site :
# @Describe:
import json
class SourceDataDemo:
def __init__(self):
self.title = ' General template for big data visualization display board '
self.counter = {
'name': '2018 Total annual income ', 'value': 12581189}
self.counter2 = {
'name': '2018 Total annual expenditure ', 'value': 3912410}
self.echart1_data = {
'title': ' Industry distribution ',
'data': [
{
"name": " Supermarket stores ", "value": 47},
{
"name": " Education and training ", "value": 52},
{
"name": " The real estate ", "value": 90},
{
"name": " Life service ", "value": 84},
{
"name": " Car sales ", "value": 99},
{
"name": " Tourist Hotel ", "value": 37},
{
"name": " Hardware and building materials ", "value": 2},
]
}
self.echart2_data = {
'title': ' Province Distribution ',
'data': [
{
"name": " Zhejiang ", "value": 47},
{
"name": " Shanghai ", "value": 52},
{
"name": " jiangsu ", "value": 90},
{
"name": " guangdong ", "value": 84},
{
"name": " Beijing ", "value": 99},
{
"name": " Shenzhen ", "value": 37},
{
"name": " anhui ", "value": 150},
]
}
self.echarts3_1_data = {
'title': ' Age distribution ',
'data': [
{
"name": "0 Under the age of ", "value": 47},
{
"name": "20-29 year ", "value": 52},
{
"name": "30-39 year ", "value": 90},
{
"name": "40-49 year ", "value": 84},
{
"name": "50 Years of age or older ", "value": 99},
]
}
self.echarts3_2_data = {
'title': ' Career distribution ',
'data': [
{
"name": " Electronic Commerce ", "value": 10},
{
"name": " education ", "value": 20},
{
"name": "IT/ Internet ", "value": 20},
{
"name": " Finance ", "value": 30},
{
"name": " Student ", "value": 40},
{
"name": " other ", "value": 50},
]
}
self.echarts3_3_data = {
'title': ' Interest distribution ',
'data': [
{
"name": " automobile ", "value": 4},
{
"name": " tourism ", "value": 5},
{
"name": " Finance and economics, ", "value": 9},
{
"name": " education ", "value": 8},
{
"name": " Software ", "value": 9},
{
"name": " other ", "value": 9},
]
}
self.echart4_data = {
'title': ' Time trend ',
'data': [
{
"name": " Android ", "value": [3, 4, 3, 4, 3, 4, 3, 6, 2, 4, 2, 4, 3, 4, 3, 4, 3, 4, 3, 6, 2, 4, 4]},
{
"name": "IOS", "value": [5, 3, 5, 6, 1, 5, 3, 5, 6, 4, 6, 4, 8, 3, 5, 6, 1, 5, 3, 7, 2, 5, 8]},
],
'xAxis': ['01', '02', '03', '04', '05', '06', '07', '08', '09', '11', '12', '13', '14', '15', '16', '17',
'18', '19', '20', '21', '22', '23', '24'],
}
self.echart5_data = {
'title': ' Province TOP',
'data': [
{
"name": " Zhejiang ", "value": 2},
{
"name": " Shanghai ", "value": 3},
{
"name": " jiangsu ", "value": 3},
{
"name": " guangdong ", "value": 9},
{
"name": " Beijing ", "value": 15},
{
"name": " Shenzhen ", "value": 18},
{
"name": " anhui ", "value": 20},
{
"name": " sichuan ", "value": 13},
]
}
self.echart6_data = {
'title': ' First tier cities ',
'data': [
{
"name": " Zhejiang ", "value": 80, "value2": 20, "color": "01", "radius": ['59%', '70%']},
{
"name": " Shanghai ", "value": 70, "value2": 30, "color": "02", "radius": ['49%', '60%']},
{
"name": " guangdong ", "value": 65, "value2": 35, "color": "03", "radius": ['39%', '50%']},
{
"name": " Beijing ", "value": 60, "value2": 40, "color": "04", "radius": ['29%', '40%']},
{
"name": " Shenzhen ", "value": 50, "value2": 50, "color": "05", "radius": ['20%', '30%']},
]
}
self.map_1_data = {
'symbolSize': 100,
'data': [
{
'name': ' Haimen ', 'value': 239},
{
'name': ' ordos ', 'value': 231},
{
'name': ' Zhaoyuan ', 'value': 203},
]
}
@property
def echart1(self):
data = self.echart1_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'series': [i.get("value") for i in data.get('data')]
}
return echart
@property
def echart2(self):
data = self.echart2_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'series': [i.get("value") for i in data.get('data')]
}
return echart
@property
def echarts3_1(self):
data = self.echarts3_1_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'data': data.get('data'),
}
return echart
@property
def echarts3_2(self):
data = self.echarts3_2_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'data': data.get('data'),
}
return echart
@property
def echarts3_3(self):
data = self.echarts3_3_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'data': data.get('data'),
}
return echart
@property
def echart4(self):
data = self.echart4_data
echart = {
'title': data.get('title'),
'names': [i.get("name") for i in data.get('data')],
'xAxis': data.get('xAxis'),
'data': data.get('data'),
}
return echart
@property
def echart5(self):
data = self.echart5_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'series': [i.get("value") for i in data.get('data')],
'data': data.get('data'),
}
return echart
@property
def echart6(self):
data = self.echart6_data
echart = {
'title': data.get('title'),
'xAxis': [i.get("name") for i in data.get('data')],
'data': data.get('data'),
}
return echart
@property
def map_1(self):
data = self.map_1_data
echart = {
'symbolSize': data.get('symbolSize'),
'data': data.get('data'),
}
return echart
class SourceData(SourceDataDemo):
def __init__(self):
""" according to SourceDataDemo Just overwrite the data in the format of """
super().__init__()
self.title = ' General template for big data visualization display board '
class CorpData(SourceDataDemo):
def __init__(self):
""" according to SourceDataDemo Just overwrite the data in the format of """
super().__init__()
with open('corp.json', 'r', encoding='utf-8') as f:
data = json.loads(f.read())
self.title = data.get('title')
self.counter = data.get('counter')
self.counter2 = data.get('counter2')
self.echart1_data = data.get('echart1_data')
self.echart2_data = data.get('echart2_data')
self.echarts3_1_data = data.get('echarts3_1_data')
self.echarts3_2_data = data.get('echarts3_2_data')
self.echarts3_3_data = data.get('echarts3_3_data')
self.echart4_data = data.get('echart4_data')
self.echart5_data = data.get('echart5_data')
self.echart6_data = data.get('echart6_data')
self.map_1_data = data.get('map_1_data')
class JobData(SourceDataDemo):
def __init__(self):
""" according to SourceDataDemo Just overwrite the data in the format of """
super().__init__()
with open('job.json', 'r', encoding='utf-8') as f:
data = json.loads(f.read())
self.title = data.get('title')
self.counter = data.get('counter')
self.counter2 = data.get('counter2')
self.echart1_data = data.get('echart1_data')
self.echart2_data = data.get('echart2_data')
self.echarts3_1_data = data.get('echarts3_1_data')
self.echarts3_2_data = data.get('echarts3_2_data')
self.echarts3_3_data = data.get('echarts3_3_data')
self.echart4_data = data.get('echart4_data')
self.echart5_data = data.get('echart5_data')
self.echart6_data = data.get('echart6_data')
self.map_1_data = data.get('map_1_data')
function
First , We from GitHub Download the project locally , Of course, it can also be on the official account Python waiter The background to reply big_screen Direct access to .
After the project is downloaded , We enter the project root path , As shown below :

then , Hold down Shift spot Right mouse button , Then choose Open command window here (W), After the command window opens, enter the command :python app.py Start project .
After the project starts , We can directly enter the address in the browser to access , Here's an example .
General template for big data visualization display board :http://127.0.0.1:5000, As shown below :

4600 Large screen visualization of enterprise data :http://127.0.0.1:5000/corp, As shown below :

Xiamen 10 10000 recruitment data (2020-09) Large screen visualization :http://127.0.0.1:5000/job, As shown below :

Use
edit data.py Medium SourceData class ( Or add a new class , If it is added, it needs to be edited app.py Add route , Please refer to CorpData/JobData)
Read your data from anywhere , according to SourceDataDemo Data format , Fill in SourceData class
function python app.py Check the effect of data changes
Contact information
At present, a technical exchange group has been opened , Group friends have exceeded 3000 people , The best way to add notes is : source + Interest direction , Easy to find like-minded friends , Data acquisition can also be added
The way 1、 Add microsignals :dkl88191, remarks : come from CSDN
The way 2、 WeChat search official account :Python Learning and data mining , The background to reply : Add group 
边栏推荐
- 牛客网——华为题库(61~70)
- Some pit avoidance guidelines for using Huawei ECS
- Systick tick timer
- Netease Cloud Wechat applet
- Netease cloud wechat applet
- Difference between interface iterator and iteratable
- Locust performance test 4 (custom load Policy)
- Information Security Experiment 3: the use of PGP email encryption software
- Schema-validation: wrong column type encountered in column XXX in table XXX
- H5网页播放器EasyPlayer.js如何实现直播视频实时录像?
猜你喜欢
随机推荐
Idea development environment installation
MySQL common statements
Yapi test plug-in -- cross request
12、 Sort
JWT certification used in DRF
SiteMesh getting started example
golang select机制和超时问题怎么解决
软件建模与分析
4、 Fundamentals of machine learning
[cloud native] Devops (I): introduction to Devops and use of code tool
Self awakening from a 30-year-old female programmer
[4G/5G/6G专题基础-146]: 6G总体愿景与潜在关键技术白皮书解读-1-总体愿景
H5网页播放器EasyPlayer.js如何实现直播视频实时录像?
Storage of data in memory
Register address name mapping
Data association between two interfaces of postman
JS judge whether checkbox is selected in the project
stm32和电机开发(从单机版到网络化)
Jmeters use
Mysql database lock learning notes









