效果图
源代码
<!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" ></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
var option;
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
symbol: 'triangle',
symbolSize: 20,
lineStyle: {
normal: {
color: 'green',
width: 4,
type: 'dashed'
}
},
itemStyle: {
normal: {
borderWidth: 3,
borderColor: 'yellow',
color: 'blue'
}
}
}]
};
myChart.setOption(option);
</script>
</body>
</html>