Riku
2025-06-09 2547159bbd781c8e1a41ecc939385396c85f9766
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 }