Highcharts X-Axis labels as Text

highcharts xaxis labels: ( style)
highcharts custom labels
highcharts xaxis labels formatter
highcharts x axis units
highcharts xaxis tick
highcharts set x axis values
highcharts logarithmic x axis
highcharts x axis height

In this fiddle, with out changing the series data, Is it possible to show x-axis labels as text i.e. {"apple","orange","mango"} instead of decimals i.e {0,1,2} with out separating labels from JSON and providing it to Categories.

$(function () {
    $('#container').highcharts({
        chart: {
        },
        xAxis: {

            labels: {
                enabled: true
            }
        },

        series: [{
            data: [["apple",29.9], ["orange",71.5], ["mango",106.4]]        
        }]
    });
});

Try this:

 $(function () {

var seriesData = [["apple",29.9], ["orange",71.5], ["mango",106.4]];     
$('#container').highcharts({
    chart: {
    },
    xAxis: {
        tickInterval: 1,
        labels: {
            enabled: true,
            formatter: function() { return seriesData[this.value][0];},
        }
    },

    series: [{
        data: seriesData     
     }]
  });
});

SEE DEMO

xAxis.title.text, xAxis.labels.style. CSS styles for the label. Use whiteSpace: 'nowrap' to prevent wrapping of category labels. Use textOverflow: 'none' to prevent ellipsis (dots). 'flap': Rotated text along the axis to compensate for the chart orientation. This tries to maintain text as legible as possible on all orientations. 'ortho': Rotated text along the axis direction so that the labels are orthogonal to the axis. This is very similar to 'flap', but prevents skewing the labels (X and Y scaling are still present).

You can use catgories in xAxis

xAxis: {
    categories: ["apple", "orange", "mango"],
}

I've updated your fiddle: http://jsfiddle.net/Lq6me/1/

If you don't want to use categories you can go for

labels: {
    formatter: function() {}
}

xAxis.labels.style, Try this: $(function () { var seriesData = [["apple",29.9], ["orange",71.5], ["mango",​106.4]]; $('#container').highcharts({ chart: { }, xAxis:  These pages outline the chart configuration options, and the methods and properties of Highcharts objects. Feel free to search this API through the search bar or the navigation tree in the sidebar. xAxis.labels.x

No need to do it manually the better solution is just pass type: 'category' in xAxis block. Look below snippet

xAxis: {
        type: 'category',
        labels: {
          rotation: -45,
          style: {
                  fontSize: '13px',
                  fontFamily: 'Verdana, sans-serif'
               },
          }
     }

Highcharts X-Axis labels as Text, The x-axis labels of this sub-plot only correspond to one of the series being Dependencies. highcharts-xaxis-labels text { font-family: century gothic; } ABC is​  xAxis.labels.step. To show only every n'th label on the axis, set the step to n. Setting the step to 2 shows every other label. By default, the step is calculated automatically to avoid overlap. To prevent this, set it to 1. This usually only happens on a category axis, and is often a sign that you have chosen the wrong axis type.

Highcharts xaxis labels, 2. chart: {. 3. marginBottom: 80. 4. },. 5. xAxis: {. 6. categories: ['Jan', 'Feb', 'Mar', '​Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],. 7. labels: {. 8. rotation: 90. Welcome to the Highcharts JS (highcharts) Options Reference. These pages outline the chart configuration options, and the methods and properties of Highcharts objects. Feel free to search this API through the search bar or the navigation tree in the sidebar.

Highcharts Demo - JSFiddle, Expected behaviour x-Axis label aligned in the correct position under the relevant added style="width: 100%; text-align: center;" to labels formatter. querySelectorAll('div.highcharts-axis-labels.highcharts-xaxis-labels ')[0] . The axis labels show the number or category for each tick. Learn how to properly format the “y” axis values of your Highcharts chart. The following code shows how to add two y axis in opposite sides with different text. highcharts-xaxis-labels text { font-family: century gothic; } ABC is the class name.

x-Axis labels position bug when useHtml: true with drilldown · Issue , Highcharts: How can I achiveve multiple rows on chart labels? 0. text, but things are different in terms of xAxis. The maximum value that is displayed on the  Highcharts X-Axis labels as Text. In this fiddle, with out changing the series data, Is it possible to show x-axis labels as text i.e. {"apple","orange","mango"} instead of decimals i.e {0,1,2} with out separating labels from JSON and providing it to Categories.

Comments
  • Thanks @Nitish Kumar. Your answer really helped me. FYI if you're using drilldown charts and your data looks like this: var chartTransactionList = [{'drillDown':'Diverse','name':'Diverse','y':135.9},{'drillDown':'Health','name':'Health','y':10142.4}] then you can set the xAxis values with xAxis: { labels: { formatter: function() { return chartTransactionList[this.value].name; } } } - note you get the name of the object attribute from after getting the element using this.value