echarts 给x轴label增加百分号

echarts yekong 239℃

echarts 给x轴label增加百分号

要在ECharts的x轴上添加百分号,可以使用axisLabelformatter属性。formatter属性允许你自定义轴标签的显示方式。你可以将其设置为一个函数,该函数接收一个参数(标签值),并返回你想要显示的字符串。在这个例子中,你可以返回值后面加上百分号。以下是如何修改你的代码:

xAxis: {
  axisLabel: {
    show: true,
    fontSize: FontChart(14),
    color: 'rgba(193, 215, 230, 1)',
    formatter: function (value) {
      return value + '%';  // 在值后面添加百分号
    }
  },
  // 其他属性...
}

这样,x轴上的每个标签都会显示为其原始值,后面跟着一个百分号。

喜欢 (1)