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

如何使用vue-chartkick隐藏图表坐标轴?求实现方法

How to Hide Axes in vue-chartkick

Hey there! I've dealt with this exact scenario before, so let me walk you through how to hide axes using vue-chartkick. Since vue-chartkick wraps underlying chart libraries like Chart.js, Google Charts, or Highcharts, the solution depends on which library you're using—here are the most common cases:

For Chart.js

You can pass custom configuration to the underlying Chart.js instance using the library prop. To hide both x and y axes, set their display property to false in the scales object:

<line-chart 
  :data="chartData" 
  :library="{
    scales: {
      x: { display: false },
      y: { display: false }
    }
  }"
></line-chart>

If you only want to hide one axis (say, the y-axis), just omit the other axis's configuration.

For Google Charts

Similarly, use the library prop to pass Google Charts-specific options. Set textPosition to 'none' for the axes you want to hide:

<column-chart 
  :data="chartData" 
  :library="{
    hAxis: { textPosition: 'none' },
    vAxis: { textPosition: 'none' }
  }"
></column-chart>

You can also hide axis lines and grid lines if needed by adding baselineColor: 'transparent' and gridlines: { color: 'transparent' } to the axis configs.

General Tip

No matter which underlying library you're using, the key is leveraging the library prop in vue-chartkick to pass the native configuration options that control axis visibility. You can check the official docs of the chart library you're using for more granular axis customization options.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:56:01