0
点赞
收藏
分享

微信扫一扫

54Echarts - 柱状图(Simple Example of Dataset)

若如初梘 2022-03-24 阅读 23


效果图

54Echarts - 柱状图(Simple Example of Dataset)_宽高

源代码

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="js/echarts.min.js"></script>
</head>

<body>
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
var option;
option = {
legend: {},
tooltip: {},
dataset: {
source: [
['product', '2015', '2016', '2017'],
['Matcha Latte', 43.3, 85.8, 93.7],
['Milk Tea', 83.1, 73.4, 55.1],
['Cheese Cocoa', 86.4, 65.2, 82.5],
['Walnut Brownie', 72.4, 53.9, 39.1]
]
},
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'
}
]
};

myChart.setOption(option);
</script>
</body>

</html>



举报

相关推荐

0 条评论