line: simple line
简单折线图
HTML
<script src="//unpkg.com/echarts/dist/echarts.min.js"></script>
<script src="https://underscorejs.org/underscore.js"></script>
<div id="main" style="width: 800px;height:600px;"></div>
JavaScript
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
var option = {
series: [{
type: "tree",
data: [{
name: "root",
children: [{
name: "Child A",
children: [{
name: "Leaf C"
}, {
name: "Leaf D"
}, {
name: "Leaf E"
}, {
name: "Leaf F"
}]
}, {
name: "Child B",
children: [{
name: "Leaf G"
}, {
name: "Leaf H"
}]
}, {
name: "Child D"
}, {
name: "Child F",
children: [{
name: "Leaf J"
}, {
name: "Leaf K"
}]
}]
}],
label: {
position: "right"
},
itemStyle: {
color: "rgba(225, 99, 99, 1)",
borderColor: "rgba(111, 238, 26, 1)",
borderWidth: 2
}
}]
}
myChart.setOption(option);
// 使用刚指定的配置项和数据显示图表。
// myChart.setOption(option);