5

I am new to Chart.js and I want to hide the y axis and x axis line and label in my chart. I looked at the documentation and couldn't find a good option. Has anyone else encountered this problem and have a solution?

Chris Deering
  • 77
  • 1
  • 1
  • 7

2 Answers2

12

Using the showScale option would be better

var ctx = document.getElementById("LineWithLine").getContext("2d");
new Chart(ctx).Line(data, {
    showScale: false
});

Fiddle - http://jsfiddle.net/wb3kcunt/

This hides gridlines too. If you want to hide only the axes and labels and not the grid lines, just set scaleFontColor and scaleLineColor to a transparent color.

potatopeelings
  • 40,709
  • 7
  • 95
  • 119
  • and how would you do that only for the x axis? I am googling the solution like 10 hours already – jPO Feb 11 '16 at 11:44
1

I found that if you edit a library posted in this answer, you can achieve this

In chart.js, Is it possible to hide x-axis label/text of bar chart if accessing from mobile?

Community
  • 1
  • 1
Chris Deering
  • 77
  • 1
  • 1
  • 7