Need full highchart bars between months

前端 未结 1 1492
刺人心
刺人心 2021-01-23 16:51

I have created High chart to full fill my requirement as shown in attached Image and i have tried below code in fiddle example code in fiddle is as follows

https://jsfid

相关标签:
1条回答
  • 2021-01-23 17:19

    Instead of category, you should use datetime xAxis type and define x values as timestamps:

    series: [{
        ...,
        data: [
            [17227780000, 15],
            [18523780000, 13],
            [19819780000, 14],
            [21115780000, 17],
            [22411780000, 12],
            [23707780000, 12],
            [25003780000, -12],
            [26299780000, -13],
            [27595780000, 21],
            [28891780000, 11]
        ]
    }]
    

    Live demo: https://jsfiddle.net/BlackLabel/83us07cx/

    or use pointStart and pointInterval properties:

    series: [{
        pointStart: 17227780000,
        pointInterval: 1000 * 60 * 60 * 24 * 15, // 15 days
        name: null,
        color: 'red',
        negativeColor: 'blue',
        data: [15, 13, 14, 17, 12, 12, -12, -13, 21, 11]
    }]
    

    Live demo: https://jsfiddle.net/BlackLabel/sqtha8xm/


    API Reference:

    https://api.highcharts.com/highcharts/series.column.data

    https://api.highcharts.com/highcharts/series.column.pointStart

    https://api.highcharts.com/highcharts/series.column.pointInterval

    https://api.highcharts.com/highcharts/series.column.negativeColor

    0 讨论(0)
提交回复
热议问题