const fontSize = 12 function barChartOption(chartData) { const x = chartData.xAxis const legends = chartData.yAxis.map((v) => { return v.name }) const series = chartData.yAxis.map((v) => { return { name: v.name, type: 'bar', data: v.data } }) return { legend: { data: legends, textStyle: { fontSize: fontSize, color: 'white' } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: { type: 'category', data: x, axisLabel: { rotate: 45, textStyle: { fontSize: fontSize }, color: '#ffffff', textBorderColor: '#fff' } }, yAxis: { type: 'value', axisLabel: { textStyle: { fontSize: fontSize, color: 'white' } } }, series: series } } export { barChartOption }