简体   繁体   中英

Is there a way to scale x-axis on bar chart (using eCharts) so the 0 is always in the middle?

My problem is that I have a lot of different data displayed on the bar chart on user demand.

This is how the graph looks now.

现在图

What I want to achieve is to kind of scale the x-axis that way so the 0 is always in the middle of the chart. That way when I change the data and let's say on positive side max value is 20% and negative -60% x-axis 0 won't be on the right side of the chart but rather in the middle of it.

I was checking eCharts documentation but I didn't find any solution. Is there a way to achieve that without changing the series data?

Thanks

I'm also facing a similar issue and I would be interested in an implementation example for this solution.

You can set min and max values for the axis.

xAxis: {
 max: 100,
 min: 0,
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM