
myEchartsBar(data, id) {
let legendArr = data.series.map((item) => item.name)
let option = {
color: ['#FF6D6D', '#2282FF','#17C388'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
legend: {
data: legendArr, // 顶部展示的名字数组 [a,b,c]
right: '10px',
textStyle: {
color: '#9f9f9f',
}
},
grid: { // 内容区
left: '2%',
right: '20px',
bottom: '2%',
containLabel: true,
},
xAxis: [
{
type: 'category', // 说明轴
data: data.xAxisData, // 说明的文字说明数组
axisTick: {
show: false, //隐藏刻度线
},
axisLine: { // 坐标线样式
lineStyle: {
color: '#eef3f8',
}
},
axisLabel: { // 字体样式
color: '#999999'
}
},
],
yAxis: [
{
name: '工单量',
type: 'value', // 数据轴
nameTextStyle: {
color: "#999999"
},
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: '#eef3f8',
}
},
axisLabel: {
color: '#999999'
},
splitLine: { // x 坐标网格线样式
show: true,
lineStyle:{
color: ['#eef3f8'],
1,
type: 'solid'
}
}
},
],
series: data.series,
}
var myChart = this.$echarts.init(document.getElementById(id))
myChart.setOption(option)
},