箭头函数
series: chartData.map((item, index) => {
return {
type: 'bar',
name: valNameList[index].seriesName,
data: item.map(o => o.value),
barWidth: metaAttr.barHeight,
barGap: metaAttr.barGap, /*多个并排柱子设置柱子之间的间距*/
barCategoryGap: metaAttr.barCategoryGap, /*每个公司柱子之间的间距*/
itemStyle: {
normal: {
barBorderRadius: 0,
shadowBlur: 0,
label: {
show: true,
position: 'right',
textStyle: {
//数值样式
color: 'black',
fontSize: 12,
},
},
}
},
label: {
show: true,
position: "right",
color: "#fff",
fontSize: 12
}
}
})
普通函数
series: chartData.map(function(item, index){
return {
type: 'bar',
name: valNameList[index].seriesName,
data: item.map(function(o){ return o.value }),
barWidth: metaAttr.barHeight,
barGap: metaAttr.barGap, /*多个并排柱子设置柱子之间的间距*/
barCategoryGap: metaAttr.barCategoryGap, /*每个公司柱子之间的间距*/
itemStyle: {
normal: {
barBorderRadius: 0,
shadowBlur: 0,
label: {
show: true,
position: 'right',
textStyle: {
//数值样式
color: 'black',
fontSize: 12,
},
},
}
},
label: {
show: true,
position: "right",
color: "#fff",
fontSize: 12
}
}
})
yAxis: {
type: 'category',
triggerEvent: true,
data: chartData[0].map(item => item.name),
axisLabel: {
textStyle: {
color: "black",
fontSize: metaAttr.yfontSize,
},
}
}
yAxis: {
type: 'category',
triggerEvent: true,
data: chartData[0].map(function(item){ return item.name }),
},