how to hide highchart x - axis data values

JavascriptJqueryChartsHighchartsBar Chart

Javascript Problem Overview


I am drawing a bar chart using highchart.js

I do not want to show the x - axis data values.

Can any one tell me which option does it?
full config:

var chart = new Highcharts.Chart({
                chart: {
                    renderTo: container,
                    defaultSeriesType: 'bar'
                },
                title: {
                    text: null
                },
                subtitle: {
                    text: null
                },
                xAxis: {
                    categories: [''],
                    title: {
                        text: null
                    },
                    labels: {enabled:true,y : 20, rotation: -45, align: 'right' }

                },
                yAxis: {
                    min: 0,
                    gridLineWidth: 0,
                    title: {
                        text: '',
                        align: 'high'
                    }
                },
                tooltip: {
                    formatter: function () {
                        return '';
                    }
                },
                plotOptions: {
                    bar: {
                        dataLabels: {
                            enabled: true
                        },
                        pointWidth: 35,
                        color: '#D9CDC1'
                    }
                },
                legend: {
                    enabled: false
                },
                credits: {
                    enabled: false
                },
                series: [{
                    name: 'Year 1800',
                    data: [107]
                }]
            });

Javascript Solutions


Solution 1 - Javascript

In HighCharts, bar graphs use inverted axes, so the bottom axis is really the Y axis. (See also "column" graphs where the graphic is rotated 90 degrees, in which case the bottom axis is the X axis.)

You need to add the following to the yAxis config

yAxis: {
  labels: {
    enabled: false
  }
}

See the following for full example: http://jsfiddle.net/k5yBj/433/

Solution 2 - Javascript

To hide labels on X-axis set the option labels: {enabled:false} like this:

    .....
    ........
    ,
                    xAxis: {
                        categories: [''],
                        title: {
                            text: null
                        },
                        labels: {
                         enabled:false,//default is true
                         y : 20, rotation: -45, align: 'right' }
    
                    }


.....
....

To hide labels on y-axis set the option labels: {enabled:false} like this:

.....
.......
,
                yAxis: {
                    min: 0,
                    gridLineWidth: 0,
                    title: {
                        text: '',
                        align: 'high'
                    },
                    labels:{
                        enabled:false//default is true
                    }
                },
.........
......

[Refer the documentation][1] for futher understanding. [1]: http://api.highcharts.com/highcharts#xAxis.labels.enabled

Solution 3 - Javascript

The above popular answer hides the labels only, this left tick marks for me which I also wished to remove.

In that case this works well

    xAxis: {
            visible: false
        },

This is a simple solution to remove everything on the x/y axis for anyone interested. For more information please look here https://api.highcharts.com/highcharts/xAxis.visible

Solution 4 - Javascript

If hiding x data, then look at this https://jsfiddle.net/anrilafosel/3g4z5kc3/

chart.xAxis[0].setCategories(newCategories);
for (i = 0; i < chart.series.length; i++) {
  var newData = [];
  for (j = 0; j < toggler_hc13.length; j++)
    if (toggler_hc13[j] === 1)
      newData.push(series_hc13[i].data[j]);
  chart.series[i].setData(newData);
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNurul AsadView Question on Stackoverflow
Solution 1 - JavascriptNick BView Answer on Stackoverflow
Solution 2 - JavascriptRahul GuptaView Answer on Stackoverflow
Solution 3 - JavascriptRS3View Answer on Stackoverflow
Solution 4 - Javascript23 45View Answer on Stackoverflow