HighCharts show datetime format on xAxis

后端 未结 4 684
误落风尘
误落风尘 2021-02-08 21:00

I am trying to display dateTime in day/weekly/month format on the x axis of high charts I have the data formatted as x utc date time format and y (magnitude). I was under the im

4条回答
  •  面向向阳花
    2021-02-08 21:42

    You can try format date with

     xAxis: {
       labels: {
        formatter: function(){
    
          return moment(new Date(this.value)).format('DD'); // example for moment.js date library
    
          //return this.value;
        },
    },
    

    Also you can check documentation http://api.highcharts.com/highcharts/xAxis.labels.formatter

提交回复
热议问题