由于我的需求是用echar做一个水平柱状图。但是我y轴的有些数据很长,所以我想把y轴的字数全截取剩4位。但是我设置了代码却没起作用。我的代码是这样的:co
countOption.xAxis(new ValueAxis().boundaryGap(0, 0.01).axisLine(new AxisLine().show(false)).axisTick(new AxisTick().show(false)).splitLine(new SplitLine().show(false)).show(false).max(maxCount));
countOption.yAxis(new CategoryAxis().data(yAxisString.toArray()).axisTick(new AxisTick().show(false)).axisLabel(new AxisLabel().rotate(30).formatter("function (params) {var res = params;res = res.substr(0,4);return res;}")).axisLine(new AxisLine().show(false)));
```不知道为什么识别不行。有大神搞过类似的吗?。请问如何在formatter里面写js方法呢?
如果是echarts,可以这样设置:
https://blog.csdn.net/weixin_42069147/article/details/103584198