简体   繁体   English

如何在Highcharts中显示日期时间轴的所有数据标签

[英]How To Show All Data Labels For Datetime Axis In Highcharts

I'm using a Datetime axis in Highcharts to show a series of columns, and I'd like the date of the data point to appear directly beneath the column rather than a generic time marker as seen in this fiddle: http://jsfiddle.net/4s7t6jg6/2/ 我在Highcharts中使用Datetime轴来显示一系列列,并且我希望数据点的日期显示在列的正下方,而不是像该小提琴中所示的通用时间标记: http:// jsfiddle达网络/ 4s7t6jg6 / 2 /

$(function () {
$('#container').highcharts(

    {"chart":{"type":"column"},"xAxis":{
        "dateTimeLabelFormats":{"month":"%m/%e"},
        "type":"datetime"
    },      

     "series":[{"data":[{"x":1406332800000.0,"y":358.0},

{"x":1408838400000.0,"y":417.0},{"x":1411344000000.0,"y":358.0},{"x":1416355200000.0,"y":323.0},{"x":1418860800000.0,"y":408.0},{"x":1421366400000.0,"y":280.0},{"x":1423872000000.0,"y":305.0},{"x":1426377600000.0,"y":314.0},{"x":1428883200000.0,"y":331.0},{"x":1431388800000.0,"y":412.0},{"x":1433894400000.0,"y":279.0}]}]}

    );
});

To be more specific in case I'm not describing it well, instead of the xAxis reading "09/1, 11/1, 01/1, etc" as it does currently, I would prefer it read "07/26, 08/24, 09/22, etc". 更具体地说,以防万一我没有很好地描述它,而不是xAxis像现在这样显示“ 09 / 1、11 / 1、01 / 1等”,我希望它显示为“ 07/26,08” / 24、09 / 22等”。

You can use the tickPostions property for this. 您可以为此使用tickPostions属性。

Provide your timestamps as an array of values to the property, and it will draw a tick at each stamp. 将时间戳作为值的数组提供给该属性,它将在每个图章上画一个勾号。

Example: 例:

Reference: 参考:

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

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