how to assign date time to highchart with intervals and date start

前端 未结 2 1685
长发绾君心
长发绾君心 2021-01-07 04:34

HI In highchart is there any way to give time on x-axis as below

1) pass start time
2) give an array of time points
3) give unit of time

for example<

相关标签:
2条回答
  • 2021-01-07 05:17

    Set the initial date with pointStart:

    plotOptions: {
        column: {
            pointStart: Date.UTC(2015, 1, 12) // feb 12, 2015
        }
    }
    

    Set the interval in the xAxis:

    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
                second: '%H:%M:%S',
                minute: '%H:%M',
                hour: '%H:%M',
                day: '%e. %b',
                week: '%e. %b',
                month: '%b \'%y',
                year: '%Y'
        },
        tickInterval: 24 * 3600 * 1000 // interval of 1 day (in your case = 60)
    }
    

    Test: http://jsfiddle.net/ppazos/jjn7noqg/

    0 讨论(0)
  • If I understand correctly, pointInterval is what you are looking for:

    http://api.highcharts.com/highcharts#plotOptions.series.pointInterval

    If that doesn't do what you need, then it should just be a matter of parsing your object to get it do what you need...

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