You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
export default function multipleColumn(columnName = [], xMsg = [], data = []) {
|
|
|
|
const valData = []
|
|
|
|
const color = ['#ff4852', '#ff6e25', '#ffbf00', '#20cc62', '#00d6d6', '#0084ff']
|
|
|
|
for (let [index, i] of data.entries()) {
|
|
|
|
let ojb = {
|
|
|
|
name: i.name,
|
|
|
|
type: 'bar',
|
|
|
|
barGap: 0,
|
|
|
|
emphasis: {
|
|
|
|
focus: 'series'
|
|
|
|
},
|
|
|
|
data: i.data,
|
|
|
|
itemStyle: {
|
|
|
|
color: color[index]
|
|
|
|
},
|
|
|
|
}
|
|
|
|
valData.push(ojb)
|
|
|
|
}
|
|
|
|
const option = {
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
|
|
|
axisPointer: {
|
|
|
|
type: 'shadow'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
data: columnName,
|
|
|
|
textStyle: { //图例文字的样式
|
|
|
|
color: 'black',
|
|
|
|
fontSize: 8
|
|
|
|
},
|
|
|
|
left: 20,
|
|
|
|
itemWidth: 12,
|
|
|
|
itemHeight: 12,
|
|
|
|
borderRadius: 1, //圆角半径
|
|
|
|
},
|
|
|
|
grid: {
|
|
|
|
left: 20,
|
|
|
|
containLabel: true,
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 8
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data: xMsg
|
|
|
|
},
|
|
|
|
yAxis: [{
|
|
|
|
type: 'value',
|
|
|
|
axisLabel: {
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 8
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
series: valData
|
|
|
|
}
|
|
|
|
return option
|
|
|
|
}
|