Build data visualization (based on Echarts, python)
Contents of this article:
1. Digression written in front
2. The concept of data visualization
3. Use the Python matplotlib library to draw data visualization graphs
4. Build big data visualization based on Echarts
4.2. Production of data visualization line chart
4.3. Production of data visualization histogram
4.4. Production of data visualization polar coordinate histogram
1. Digression written in front
We can't decide a person's appearance, and we can't decide a person's departure. What you may be able to do is to cherish the unexpected surprise. The fate of the previous life, the encounter in this life, and the review of the next life.
Any type of relationship (friends, relatives...), those who have a heart, must be tired, and those who have no heart, it doesn't matter. Love is voluntary, don't talk about debts, when you think about it, the end of the world is so close;
Everyone has different personalities and different life experiences. If you cannot get along normally due to factors such as the environment, it is better to choose to exit politely, find your original self, and return others to the crowd without disturbing each other.
No one's life is smooth and unimpeded, and it is not easy. You think that others live better than you, just because you have never seen the other side of him (her) who is exhausted but has to persist. Half the life is windy and half the body is cold, a glass of turbid wine toasts the fleeting years, looking back on the past half life, seven parts are sour and three parts are sweet.
Everyone in this world is unique and irreplaceable. That's why we are unconsciously drawn by some insignificant thing, remembering a certain person, a certain voice, a certain other person's story. . .
"There Is No One Like Me" Author: Master Hongyi Li Shutong
Old people don't know my current situation, and
new people don't know my past.
No matter how many people you read,
there is no one like me.
Sober in adversity
2023.8.27
2. The concept of data visualization
data visualization:
Data visualization refers to the transformation of data into charts, graphs, or other forms of visual elements to help people better understand and analyze the data. It can show the patterns, trends, correlations and regularities of data, and help people discover buried value and insights from data, so as to make better decisions and actions. Data visualization involves a variety of techniques and tools, including charts, maps, network diagrams, heat maps, and more. It has become a very important part of the field of data analysis and business intelligence.
Things to keep in mind when implementing data visualization:
- Choose the right chart type: Different types of data should be presented using different types of charts. For example, use a line chart to display trend data, and use a pie chart to display percentage data.
- Determine the focus of the data: In order to present the focus of the data, you need to ensure that the arrangement, color, and size of the visual elements match the focus of the data.
- Keep it simple: Don’t overdo it with too much information in the diagram, keep the information concise and easy to understand and read.
- Use color effectively: Contrasting and related colors can help readers better understand data. However, avoid using too many colors, which can distract the reader.
- Choose the right font: Use an easy-to-read font, and make sure the font size is large enough so that readers can easily read the data.
- Be consistent: Make sure elements of your data visualization (such as color, font, size) are consistent across your visualization project.
3. Use the Python matplotlib library to draw data visualization graphs
#-*- coding: UTF-8 -*-
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams["font.sans-serif"]=["SimHei"]
mpl.rcParams["axes.unicode_minus"]=False
import matplotlib.pyplot as plt
labels = ['糯米糍', '雪梅娘', '八宝饭', '驴打滚', '甜薄撑']
values = [20, 30, 25, 15, 10]
colors = ['lightskyblue', 'yellowgreen', 'gold', 'orange', 'lightcoral']
plt.pie(values, labels=labels, colors=colors, autopct='%1.1f%%', startangle=90)
plt.axis('equal')
plt.show()
In the above code, we used the plt.pie() function to draw the graph.
in,
The labels parameter specifies the labels for each pie chart,
The values parameter specifies the value of each pie chart,
The colors parameter specifies the color of each pie chart,
The autopct parameter specifies the display mode of the proportion of each pie chart,
The startangle parameter specifies the starting angle.
Finally, we use plt.axis('equal') to ensure that the pie chart is a perfect circle.
Show pie charts by calling plt.show().
4. Build big data visualization based on Echarts
4.1. Install echarts.js
We need to install echarts first,
Download address: https://archive.apache.org/dist/echarts/5.4.3/
Or add to the page code:
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
4.2. Production of data visualization line chart
4.2.1. Basic Line Chart
Year-on-year trend chart of Guangdong Consumer Price Index from January 2022 to July 2023
code show as below:
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
xAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"]
},
yAxis: {
type: 'value',
axisTick: {
show:false,
alignWithLabel: true,
},
},
series: [
{
data: [101.7,101.5,101.9,102.4,102.3,103.1,102.9,102.5,102.6,102,101.8,102.2,102.7,100.8,100.8,100.6,100.3,99.6,99.8],
type: 'line',
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
The line chart data is concentrated in a small range, and the effect is not obvious. Let's adjust the code:
4.2.2. Improve Line Chart
Year-on-year trend chart of Guangdong Consumer Price Index from January 2022 to July 2023
code show as below:
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"]
},
yAxis: {
type: 'value',
axisTick: {
show:false,
alignWithLabel: true,
},
minInterval: 1, //最小刻度是1
splitNumber: 4, //段数是4
min: 98, //最小是0
max: function (value) { //最大设定
if (value.max < 4) {return 4;}
else {return value.max;}
},
},
series: [
{
itemStyle : { normal: {label : {show: true,fontSize:8},}}, //可以显示数字
data: [101.7,101.5,101.9,102.4,102.3,103.1,102.9,102.5,102.6,102,101.8,102.2,102.7,100.8,100.8,100.6,100.3,99.6,99.8],
type: 'line',
lineStyle: {
width: 3,
type: 'singleAxis',
shadowColor : 'rgba(2, 89, 133,0.4)', //默认透明
shadowBlur: 5,
shadowOffsetX: 3,
shadowOffsetY: 3,
type:'solid' // 虚线'dotted' 实线'solid'
}
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
We change the line chart to a smooth line chart:
4.2.3. Smooth Line Chart
Year-on-year trend chart of Guangdong Consumer Price Index from January 2022 to July 2023
code show as below:
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"]
},
yAxis: {
type: 'value',
axisTick: {
show:false,
alignWithLabel: true,
},
minInterval: 1, //最小刻度是1
splitNumber: 4, //段数是4
min: 98, //最小是0
max: function (value) { //最大设定
if (value.max < 4) {return 4;}
else {return value.max;}
},
},
series: [
{
itemStyle : { normal: {label : {show: true,fontSize:8},}}, //可以显示数字
data: [101.7,101.5,101.9,102.4,102.3,103.1,102.9,102.5,102.6,102,101.8,102.2,102.7,100.8,100.8,100.6,100.3,99.6,99.8],
type: 'line',
smooth: true,
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
4.2.4. Dotted Line Chart
Year-on-year trend chart of Guangdong Consumer Price Index from January 2022 to July 2023
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"]
},
yAxis: {
type: 'value',
axisTick: {
show:false,
alignWithLabel: true,
},
minInterval: 1, //最小刻度是1
splitNumber: 4, //段数是4
min: 98, //最小是0
max: function (value) { //最大设定
if (value.max < 4) {return 4;}
else {return value.max;}
},
},
series: [
{
itemStyle : { normal: {label : {show: true,fontSize:8},}}, //可以显示数字
//name: 'Step End',
data: [101.7,101.5,101.9,102.4,102.3,103.1,102.9,102.5,102.6,102,101.8,102.2,102.7,100.8,100.8,100.6,100.3,99.6,99.8],
type: 'line',
lineStyle: {
width: 3,
type: 'singleAxis',
shadowColor : 'rgba(2, 89, 133,0.4)', //默认透明
shadowBlur: 5,
shadowOffsetX: 3,
shadowOffsetY: 3,
type:'dotted' // 虚线'dotted' 实线'solid'
}
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
4.2.5. Ladder line chart
Year-on-year trend chart of Guangdong Consumer Price Index from January 2022 to July 2023
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"]
},
yAxis: {
type: 'value',
axisTick: {
show:false,
alignWithLabel: true,
},
minInterval: 1, //最小刻度是1
splitNumber: 4, //段数是4
min: 98, //最小是0
max: function (value) { //最大设定
if (value.max < 4) {return 4;}
else {return value.max;}
},
},
series: [
{
itemStyle : { normal: {label : {show: true,fontSize:8},}}, //可以显示数字
data: [101.7,101.5,101.9,102.4,102.3,103.1,102.9,102.5,102.6,102,101.8,102.2,102.7,100.8,100.8,100.6,100.3,99.6,99.8],
type: 'line',
step: 'end',
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
4.2.6. Area Line Chart
Year-on-year trend chart of Guangdong Consumer Price Index from January 2022 to July 2023
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
xAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"]
},
yAxis: {
type: 'value',
axisTick: {
show:false,
alignWithLabel: true,
},
minInterval: 1, //最小刻度是1
splitNumber: 4, //段数是4
min: 98, //最小是0
max: function (value) { //最大设定
if (value.max < 4) {return 4;}
else {return value.max;}
},
},
series: [
{
itemStyle : { normal: {label : {show: true,fontSize:8},}}, //可以显示数字
data: [101.7,101.5,101.9,102.4,102.3,103.1,102.9,102.5,102.6,102,101.8,102.2,102.7,100.8,100.8,100.6,100.3,99.6,99.8],
type: 'line',
areaStyle: {},
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
4.3. Production of data visualization histogram
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
title: {
text: '广州城镇非私营单位在岗职工历年平均工资(元)'
},
xAxis: {
type: 'category',
data: [
'2006年',
'2007年',
'2008年',
'2009年',
'2010年',
'2011年',
'2012年',
'2013年',
'2014年',
'2015年',
'2016年',
'2017年',
'2018年',
'2019年',
'2020年',
'2021年'
],
},
yAxis: {
type: 'value'
},
series: [
{
itemStyle : { normal: {label : {show: true,fontSize:9},}}, //可以显示数字
data: [
'36770',
'40561',
'45702',
'49518',
'54494',
'57474',
'67515',
'73678',
'74246',
'81171',
'89096',
'98612',
'111839',
'123498',
'135138',
'144288'
],
type: 'bar'
}
]
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
4.4. Production of data visualization polar coordinate histogram
<!DOCTYPE html>
<html lang="zh-CN" style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/china.js"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=YOUR_API_KEY"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/[email protected]/dist/extension/bmap.min.js"></script>
-->
<script type="text/javascript">
var dom = document.getElementById('container');
var myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false
});
var app = {};
var option;
option = {
title: [
{
text: '广州城镇非私营单位在岗职工历年平均工资(元)'
}
],
polar: {
radius: [30, '90%']
},
angleAxis: {
max:74246,
startAngle: 30
},
radiusAxis: {
type: 'category',
data: ["22年01月","02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","23年01月","02月","03月","04月","05月","06月","07月"],
},
tooltip: {},
series: {
type: 'bar',
data: [
'36770',
'40561',
'45702',
'49518',
'54494',
'57474',
'67515',
'73678',
'74246',
'81171',
'89096',
'98612',
'111839',
'123498',
'135138',
'144288'
],
coordinateSystem: 'polar',
label: {
show: true,
position: 'middle',
formatter: '{b}: {c}'
}
}
};
if (option && typeof option === 'object') {
myChart.setOption(option);
}
window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
Big data articles:
- Big data (1) Definition and characteristics
- Big data (2) Statistics related to big data industry
- Big data (3) Jobs related to big data
- Build big data visualization big screen based on Echarts
- Big Data (4) Mainstream Big Data Technology
Recommended reading:
|
|
|
Tomcat11, tomcat10 installation configuration (Windows environment) (detailed graphics) |
Tomcat startup flashback problem solving set (eight categories in detail) |
|