//销售额折线图
var myChart = echarts.init(document.getElementById('canvasDiv'))
option = {
color: ['#46a144'], //折线图折点圆圈
title: {
text: '销售额折线图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
// backgroundColor: '#46a144'
}
}
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '1%',
right: '5%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: true,//轴两端空白
data: data.data.reportDates,
}
],
yAxis: [
{
type: 'value',
name: '(元)' //Y轴顶端显示单位
}
],
series: [
{
type: 'line',
areaStyle: {
normal: {
color: ['#CDEACC'], //折线图背景
}
}, //背景色
data: canvasDivData,
itemStyle: {
normal: {
lineStyle: {
// color:"#46a144",
width: 3,
// background:"#46a144"
}
}
},
label: {
normal: {
show: true,
// position: 'top',
formatter: '{c}', //每个点的数字显示
// color:"#46a144" //数字颜色
},
}
},
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);//自动匹配屏幕尺寸显示
window.onresize = myChart.resize;