Highchart: can I make sure the y-axis values ​​are integers?

I am new to Highchart.

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

How to make Highchart display only integers on Y-axis values?

+3


source to share


1 answer


Try to remove all values ​​in xAxis or use the following code.

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

      

See example http://jsfiddle.net/ssgoanb5/

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

New updates:



To avoid decimal places in the Axis (x / y) plot, add the allowDecimals attributes.

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

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

      

Check out the updated JSfiddle: http://jsfiddle.net/ssgoanb5/6/

+6


source







All Articles