ali
ali

Reputation: 11

Highchart in long array group categories

i use bar chart in highchart if my array became more than 15 then it merge them and not show the category in x of

legend: {
    enabled: false
},
plotOptions: {

    series: {
    startFromThreshold: false,
        threshold: null,
        borderWidth: 0,
        dataLabels: {
            enabled: true,
            format: '{point.y:.1f}'
        }
    },
    bar: {
        cropThreshold:1,
        turboThreshold:10000

    }

},

jsfid how can i change the threshold of merging my array items ?

Upvotes: 1

Views: 80

Answers (1)

Halvor Holsten Strand
Halvor Holsten Strand

Reputation: 20536

The category labels are hidden ("grouped") because the x-axis is too crowded with labels. You can use xAxis.tickPositioner to override the default tickInterval, as tickInterval may remove ticks if it is too crowded to properly display the labels. You then need to implement the tickPositioner to return all the tick positions you want. In your case, all of them.

For example (JSFiddle), in ES6:

tickPositioner: function() {
    return [...Array(this.max - this.min).keys()];
}

Or if you don't want to do ES6:

tickPositioner: function() {
    return Array.apply(null, Array(this.max - this.min)).map(function (_, i) {return i;});
}

Where this is the x-axis, and min and max are are the are used to find the range of the axis.

Upvotes: 1

Related Questions