1

I'm using Chart.js. How can I disable the labels, both X and Y?

<canvas id="canvas-2010" width="800" style="width: 100% !important; height: auto !important;"></canvas>
<script>
options = {
    scaleShowLabels : false
}

var lineChartData = {
labels :    ["Jan","Feb","Mar","Apr","Maj","Jun","Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
datasets : [{
    fillColor : "rgba(151,187,205,0.5)",
    strokeColor : "rgba(151,187,205,1)",
    pointColor : "rgba(151,187,205,1)",
    pointStrokeColor : "#fff",
    data : [0,0,0,0,0,0,0,0,0,0,-6147.20,22333.57]
}]                  
}

var myLine = new Chart(document.getElementById("canvas-2010").getContext("2d"), options).Line(lineChartData);
</script>

The scaleShowLabels option does not work.

Sean Vieira
  • 155,703
  • 32
  • 311
  • 293
Jens Törnell
  • 23,180
  • 45
  • 124
  • 206

2 Answers2

0

You need to place the , options part after the lineChartData part, for the last line of the code to be:

var myLine = new Chart(document.getElementById("canvas-2010").getContext("2d")).Line(lineChartData, options);
WPO.plus
  • 1
  • 3
0

You can use this option for disable the labels

<canvas id="canvas-2010" width="800" style="width: 100% !important; height: auto !important;"></canvas>
<script>
options = {
    scaleShowLabels : false
}

var lineChartData = {
labels :    ["Jan","Feb","Mar","Apr","Maj","Jun","Jul", "Aug", "Sep", "Okt", "Nov", "Dec"],
datasets : [{
    fillColor : "rgba(151,187,205,0.5)",
    strokeColor : "rgba(151,187,205,1)",
    pointColor : "rgba(151,187,205,1)",
     ***showScale: false ,***
    pointStrokeColor : "#fff",
    data : [0,0,0,0,0,0,0,0,0,0,-6147.20,22333.57]
}]                  
}

var myLine = new Chart(document.getElementById("canvas-2010").getContext("2d"), options).Line(lineChartData);
</script> 

I hope it will work

Sergio
  • 28,539
  • 11
  • 85
  • 132
ASH
  • 77
  • 9