3

I am new to Highchart.

I have a line chart. X axis is a series of dates, and the Y values are only integers.

How can I make Highchart display only integers on the values of Y axis?

Arnab Nandy
  • 6,472
  • 5
  • 44
  • 50
curious1
  • 14,155
  • 37
  • 130
  • 231

1 Answers1

6

Try to null all values in xAxis or use following code.

xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        labels: {
            enabled: false
        }
    }

Please see the example http://jsfiddle.net/ssgoanb5/

See the Doc: http://api.highcharts.com/highcharts#xAxis.labels.enabled

New Updates:

For avoiding decimals values on graph Axis(x/y), Add allowDecimals attributes.

See the Doc. http://api.highcharts.com/highcharts#yAxis.allowDecimals

yAxis: {
        allowDecimals: false,
        title: {
            text: 'Temperature (°C)'
        },
        plotLines: [{
            value: 0,
            width: 1,
            color: '#808080'
        }]
    }

Please check the updated JSfiddle: http://jsfiddle.net/ssgoanb5/6/

Finoy Francis
  • 678
  • 5
  • 18
  • Finoy, it seems your solution is not working for me. Two reasons: 1) I need the labels on the x axis. 2) In my case I have zooming. When I zoomed, I see decimals on the Y axis. See this updated example: http://jsfiddle.net/mddc/ssgoanb5/5/ – curious1 Sep 19 '14 at 05:12
  • 1
    Please check the updated JSfiddle: http://jsfiddle.net/ssgoanb5/6/ Its may solve your problem. also i have updated the answer – Finoy Francis Sep 19 '14 at 08:49
  • Thanks, Finoy. It is just that simple. I went through highchart docs myself before, but it seems I missed it. Thanks, agains!!! – curious1 Sep 19 '14 at 12:34