You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ApexCharts中如何修改坐标轴标题的字体大小?

解决ApexCharts坐标轴标题字体大小不生效的问题

方法1:调整配置层级(适配部分版本)

部分版本的ApexCharts中,坐标轴标题的样式需要单独提取到titleStyle字段而非嵌套在title内,可尝试修改配置:

const options = {
  // ...其他配置
  yaxis: {
    labels: {
      formatter: function (value) {
        return "$" + value;
      }
    },
    title: {
      text: 'Estimated Value'
    },
    titleStyle: {
      fontSize: '28px'
    }
  }
}

方法2:全局主题统一设置

通过全局主题配置强制指定坐标轴标题样式,避免局部配置被覆盖:

const options = {
  theme: {
    typography: {
      axes: {
        title: {
          fontSize: '28px'
        }
      }
    }
  },
  // ...其他配置
  yaxis: {
    labels: {
      formatter: function (value) {
        return "$" + value;
      }
    },
    title: {
      text: 'Estimated Value'
    }
  }
}

方法3:CSS强制修改

如果以上配置均无效,直接针对ApexCharts的坐标轴标题类编写CSS,优先级更高:

.apexcharts-yaxis-title {
  font-size: 28px !important;
}

内容的提问来源于stack exchange,提问作者Hemanth

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 03:14:52