Echarts column width adaptive browser width, no overlap

problem description

column width can only be adapted according to browser width, for example, there are 10 columns. When initializing the display, if the browser width is small, then the columns must not overlap.

the environmental background of the problems and what methods you have tried

The api of a bar chart in

echart has a barWidth. How to write the dynamic width

related codes

/ / Please paste the code text below (do not replace the code with pictures)
series: [

    {
      data: yArr,
      type: "bar",
      barWidth: "40",
      barCategoryGap: "0",
      itemStyle: {
        normal: {
          color: function (params) {
            var colorList = color;
            return colorList[params.dataIndex];
          }
        }
      }
    },{
      data: varianceArr,
      type: "line",
      yAxisIndex: 1,
    }
  ]

what result do you expect? What is the error message actually seen?

expect to see that when the browser width is small, the columns are not coincident. The number of columns is returned from the interface data, maybe 10 or more, not fixed

Jun.30,2022

the bar chart itself is adaptive width


can make an adaptation, similar to this

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ec93-2c457.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ec93-2c457.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?