Highcharts: 2nd x axis, first and last labels cut

2019-08-12 07:01发布

问题:

I have a chart with 2 linked x axes, mostly duplicated - one on top, one on bottom.

They use categories, and in order to trim extra space off of the left and right of the chart, I have set the min to 0.25, and max to [# of categories].75.

The first x axis responds as desired, and shows all categories correctly.

The 2nd x axis does not show the first or the last category.

If I remove the min/max settings, both axes show correctly, but with more space than I want.

But since the first axis does show all categories, it must be possible for both axes to show all categories.

Axis code:

xAxis  : [{
    min:0.25,
    max:5.75,
    opposite: true,
    categories: catsTop,
    tickmarkPlacement: 'on',
},{
    linkedTo:0,
    categories: catsBot,
    tickmarkPlacement: 'on'
}]

tickmarkPlacement: 'on' is required for this chart.

Fiddle:

  • https://jsfiddle.net/jlbriggs/mvgymfw6/7/

I have tried changing the chart alignTicks property, showFirstLabel/showLastLabel, startOnTick/endOnTick, have placed first axis on top/2nd axis on bottom, first axis on bottom/second axis on top, etc, but can't get the 2nd axis to properly show the labels.

Any tips appreciated.

标签: highcharts