jones
jones

Reputation: 41

How to hide axis in column_chart using chartkick

In chartkick's column_chart, I want to remove the axes of the chart as shown in the attached image.

I tried this code, but I couldn't hide axis.

<%= column_chart data, library: { hAxis: { textPosition: 'none'  },vAxis: { textPosition: 'none'  } } %>

enter image description here

Upvotes: 2

Views: 648

Answers (2)

aqwan
aqwan

Reputation: 500

Maybe depends on the underlying library, but when using chartjs this is what worked

 <%= column_chart data, library: { scales: {
                         x: {
                           ticks: {
                             display: false
                           }
                         },
                         y: {
                           ticks: {
                             display: false
                           }
                         }
                       } } %>
    ```

Upvotes: 1

jones
jones

Reputation: 41

The problem is now solved.

<%= column_chart data, library: { scales: { xAxes: [display: false], yAxes: [display: false] } %>

Upvotes: 2

Related Questions