user3612172
user3612172

Reputation: 41

Last label is not showing in stepped labels of highchart

I have a highchart which shows date label on x-axis, When there are more than 10 dates I'm using a logic of dividing the total dates by 10 and giving the resulting value to step. Because of step value it is not showing the last label. Please help if anybody know's the solution. I tried with showLastLabel and endOnTick but these are not working.

xAxis: {
   categories: xcategories,
   labels: {
              step: getStep(chartJson.length)
           }
}

function getStep(jsonLength){
    var step =1;
    if(jsonLength>=10){
        step= (parseInt)(jsonLength/10);
    }
    return step;;
}

Upvotes: 4

Views: 1437

Answers (2)

abhishek1191
abhishek1191

Reputation: 145

try setting max value for the xAxis. You would have to calculate last step dynamically if your categories are not fixed. Documentation here : https://api.highcharts.com/highcharts/xAxis.max

Upvotes: 0

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

Set showLastLabel parameter as true

Upvotes: 2

Related Questions