初始化数据可视化项目
This commit is contained in:
50
experiment_5/task2.html
Normal file
50
experiment_5/task2.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>柱状图</title>
|
||||
<script src="js/echarts.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="main" style="width:800px;height:800px;"></div>
|
||||
|
||||
<script>
|
||||
var myChart = echarts.init(document.getElementById('main'));
|
||||
|
||||
|
||||
var app = {};
|
||||
|
||||
var chartDom = document.getElementById('main');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option;
|
||||
|
||||
option = {
|
||||
legend: {},
|
||||
tooltip: {},
|
||||
dataset: {
|
||||
source: [
|
||||
['年份', '2018', '2019', '2020'],
|
||||
['洗衣机', 430, 858, 937],
|
||||
['空调', 831, 734, 551],
|
||||
['电视机', 864, 652, 825],
|
||||
['路由器', 724, 539, 391]
|
||||
]
|
||||
},
|
||||
xAxis: { type: 'category' },
|
||||
yAxis: {},
|
||||
// Declare several bar series, each will be mapped
|
||||
// to a column of dataset.source by default.
|
||||
series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user