步骤总结
<script src="./js/01基础/echarts.min.js"></script>
var echart = echarts.init(dom节点,主题)
var option = {};
echarts.setOption(option);
option选项
var option = {
title: {
legend:{data:[];},
tooltip:{},
xAxis:{},
yAxis:{},
}
颜色改变
color:["#f30"] 调色盘
itemStyle:
data:[15,{value:20,itemStyle:{}}]
bar柱状图
itemStyle:{
borderRadius:[左上,右上,右下,左下]
}
line折线图
smooth:true
areaStyle:
lineStyle:
cap:"round"
width:20,
pie饼行图
radius:[外径,内径]
left:
top:
itemStyle:
stack堆叠
yAxios:{data:[2019,2020,2011]},
{name:"新增",data:[10,20,30],stack:true}
{name:"流失",data:[7,5,8],stack:true}
一图多表
grid:[
{left,top,width,height}
],
xAxios:[
{gridIndex: 0,},
{gridIndex: 1,}
],
yAxios:[
{gridIndex: 0,},
{gridIndex: 1,}
],
series:
{name:"xxx",
xAxisIndex: 1,
yAxisIndex: 1,}
label
show:
position:
formater:
rich:
big:{fontSize:48}
formatter:{big|被格式内容}
动态更新
更改option的值
通过setOption(option) 更新图片
使用setInterval间隔调用