0

I understand that this is an old and boring question, already asked and answered here (see: Highcharts, make the yAxis start at zero), but I just came to highcharts recently and with some efforts I was able to create my charts.
Everything is fine but on a series of 5 charts one refuses to start from 0 on Y axis. Here is the example for one of the working charts:

    var myBarChart = new Chart(ctx, {       
    type: tipi[tipoGrafico],
    data: {
            labels: nameArray,
            datasets: [{
                label: 'Visite nel periodo alla pagina: ' + pag ,
                data: valueArray,
                backgroundColor:'rgba(255, 32, 0, 0.5)'
            }]
      },
      yAxis: {min: 0, floor:0},
      xAxis: {min: 0, floor:0}          
    });

And this is the correct result:
enter image description here

This is the code for the wrong chart:

    var myBarChart = new Chart(ctx, {                   
    type: tipi[tipoGrafico],
    data: {
              labels: nameArray,    
              datasets: [{
                  label: 'Visite in '+ nomiMesi[idxMese]+' alla pagina: '+pag,
                  data: valueArray,
                  backgroundColor:'rgba(144, 0, 144, 0.5)'
            }]
        },
        yAxis: {floor: 0, min:0},    
        xAxis: {floor: 0, min:0}                        
    });

And the resulting image, which shows that the Y axis start from 2, which is the value for the 5th column:
enter image description here

Pls note that I used both min:0 and floor:0 just for an extra safe.
I can not find any difference in the two codes, but maybe my eyes are tired.

Highcharts version: 2.5.0
Javascript version: jquery-2.2.4.min.js

Core972
  • 4,065
  • 3
  • 31
  • 45
Orionis
  • 983
  • 7
  • 11
  • 1
    Maybe if you share a fiddle or more pieces of code we can help you – beaver Jan 05 '18 at 11:23
  • 1
    Like @beaver said some code would be nice and what is highcharts 2.5.0 ? Looking on Github I only see 2.3.5 from 19 Dec 2012 and v3.0.0 from 21 Feb 2013. If you really use an so old version strart by using a 6.x or 5.x version please. – Core972 Jan 05 '18 at 13:26
  • Ok, I did an unbelieveble error. I'm using Charts, not Highcharts ! – Orionis Jan 05 '18 at 15:14
  • Ok, I did an unbelieveble error. I'm using Charts, not Highcharts ! And indeed, it has revision 2.5, not so old. In Charts, the syntax is 'beginAtZero:true' and not 'min:0'. The odd thing is that only this particular charts I reported in my question does need this option to set the starting point from o; all the other 4 already working charts do it even without this option. Anyway, the ticket is closed. – Orionis Jan 05 '18 at 15:19

0 Answers0