1.导入echarts的js
<script src="${ctxPath}/static/build/echars/echarts.min.js"></script>
2.写js
进入官网打开demo
贴进去
function initechartsDiv1() {
let option = {
title: {
text: '红方操作次数'
},
xAxis: {
type: 'category',
data: ['15min', '30min', '45min', '60min', '75min', '90min', '105min']
},
yAxis: {
type: 'value'
},
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line'
}]
};
//获取容器
let echartsDiv1 = echarts.init(document.getElementById('echartsDiv1'));
// 加载配置就ok
echartsDiv1.setOption(option);
}
function init(){
initechartsDiv1();
}
window.addEventListener('load',init,false);