简体   繁体   English

显示列范围高图的yAxsis数据

[英]Displaying yAxsis data for columnrange highchart

I have a column range highchart . 我有一列范围图表。 it works fine but it doesn't display time on yAxsis but tooltip does. 它工作正常,但在yAxsis上不显示时间,但工具提示却可以。 it is in json format (tooltip time ) . 它是json格式(工具提示时间)。

Any help appreciate .. 任何帮助赞赏..

my yAxsis looks like this 我的yAxsis看起来像这样

yAxis: {

  type: 'timepicker',
  labels: {
    formatter: function () { //1262334143000
      return Highcharts.dateFormat('%H:%M %p', this.value);
    }
  },

  title: {
     text: 'Y Sside New'
  }
},

there is this.value it has json date. this.value它有json日期。

Here is the jsfiddle 这是jsfiddle

It displays the time in %H:%M:%P (in your JSFiddle), which is hours, minutes and am/pm. 它以%H:%M:%P (在您的JSFiddle中)显示时间,该时间为小时,分钟和上午/下午。

Why does it all say 00:00:am? 为什么都说00:00:am? Because Highcharts has figured that the most reasonable spacing between ticks is some exact number of days, all starting at midnight. 因为Highcharts已经计算出tick之间最合理的间隔是确切的天数,所有天数都从午夜开始。 To see that they are not all the same you can add day, month, year or similar to the formatter. 要了解它们并不完全相同,可以添加日,月,年或类似的格式。 You can also manually control the tick spacing, if that is desired. 如果需要,您还可以手动控制刻度线间隔。 See tickInterval in the API and similar yAxis options. 请参见tickInterval在API和类似的Y轴选项。

Your formatter isn't selecting when ticks occur, only what text they show. 您的格式化程序不会选择何时出现刻度,而只会选择它们显示的文本。 To check this you can do: 要进行检查,您可以执行以下操作:

yAxis: {
    type: 'datetime',
    labels: {
        formatter: function () {
            return Highcharts.dateFormat('%e. %b %H:%M:%P', this.value);
        }
    },
    title: {
        text: 'Y Sside New'
    }
}

Which adds the day of the month and month name, and you can see that they are different. 这将添加月份中的日期和月份名称,您可以看到它们是不同的。

See this JSFiddle demonstration . 参见此JSFiddle演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM