Highcharts X-axis side stickers

I use Highcharts, and I used to have labels on the side. But now it does not work. Did I miss something? The red arrow is where I would like the tags as in the following example

http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/bar-basic/

enter image description here

This is the code I'm using, adding a number in a dynamic way.

 credits: {
                enabled: false
            },
            chart: {
                type: 'bar'
            },
            xAxis: {
                categories: ['Jan', 'Feb'],
                labels: {
                    enabled: true,
                }
            },
            yAxis: {
                min: 0,
                max: 100,
                title: {
                    text: 'Score',
                    align: 'high'
                }
            },
            plotOptions: {
                bar: {
                    dataLabels: {
                        enabled: true
                    }
                }
            }
        });

        // Add Series
        var detailchart = $('#chart-detail').highcharts();
        var categories = new Array;

        // Set Chart Title
        detailchart.setTitle({text: results[0].category});

        $.each(results, function(i, data){
            categories.push(data.name);
            detailchart.addSeries({
                name: data.name,
                data: [data.score]
            });
        });

        detailchart.xAxis[0].setCategories(["1", "2"]);
        $('#chart-detail').highcharts().reflow();

Results is an array that looks like this (I get it through ajax)

enter image description here

Any help would be appreciated! Thanks you

+4
source share
1 answer

Only what you need is 4 series, each of which has one data point.

series: [{
        name: 'Year 1800',
        data: [107]
    }, {
        name: 'Year 1900',
        data: [138]
    }, {
        name: 'Year 2008',
        data: [973]
    },{
        name: 'Year 20098',
        data: [973]
    }]

: http://jsfiddle.net/y9wzggc4/

0

All Articles