Highcharts doesn't display all categories

后端 未结 1 1894
别跟我提以往
别跟我提以往 2021-01-22 08:32

I\'m using HighCharts but I don\'t understand why it doesn\'t display a categorie in xAxis if there is no data in yAxis...

I checked in API documentation and showEmpty e

相关标签:
1条回答
  • 2021-01-22 09:00

    You can do this by telling the xAxis how many points to show regardless of how much data you have. This is a bit of a hack as the xAxis has no values exactly - but, it does have index values for each category starting with 0. So, you have 21 categories which means max index is 20. Then you xAxis property would look like:

    xAxis: {
        categories: ['08:00', '08:30', '09:00', '09:30', '10:00',
                    '10:30', '11:00', '11:30', '12:00', '12:30',
                    '13:00', '13:30', '14:00', '14:30', '15:00',
                    '15:30', '16:00', '16:30', '17:00', '17:30',
                    '18:00'],
        min: 0,
        max: 20
    },
    
    0 讨论(0)
提交回复
热议问题