简体   繁体   English

Highcharts(highstock),如何将日期传递到导航器

[英]Highcharts(highstock), how to Pass the dates to the navigator

I am trying to pass the dates to the Navigator, but by default the timestamp is passing to the navigator could any one please help me how to pass the dates to the navigator, ie as per dates that are there in x-axis. 我正在尝试将日期传递给导航器,但是默认情况下,时间戳是传递给导航器的,任何人都可以帮助我如何将日期传递给导航器,即按照x轴上的日期。

this is the jsfiddle link : `http://jsfiddle.net/hj22wbe5/16/`

please find the jsfiddle. 请找到jsfiddle。

Thanks 谢谢

Why are you not sending in your data as time/value? 为什么不将数据作为时间/值发送? This way navigator does this for you automatically? 这样, navigator器会自动为您执行此操作吗? You have an array of strings for dates that you then parse in the xAxis.label function to display text - but your time in the data series is an integer starting from 0. Then you want to send in this modified date stamp into your navigator as a string? 您有一个用于日期的字符串数组,然后在xAxis.label函数中解析该xAxis.label以显示文本-但是您在数据系列中的时间是一个从0开始的整数。然后,您需要将此修改的日期戳发送到导航器中,作为一个字符串? And you have duplicate values in your dates array. 而且您的date数组中有重复的值。 You are making much more work for yourself. 您正在为自己做更多的工作。

Send in data like below with your x as Date.UTC() : 使用x作为Date.UTC()发送以下数据:

series: [{
            name: 'RNA',
            data: [{
                x: Date.UTC(2014, 5, 14),
                y: 99.43,
                extprop: 'power issue'
            }, {
                x: Date.UTC(2014, 5, 19),
                y: 99.40,
                extprop: 'flood'
            }...

See update jsFiddle demo . 请参阅update jsFiddle 演示 I assume you meant the time to go up without duplicates. 我认为您的意思是没有重复的时间。

You can refer to navigator xaxis and use the same formatter, but better is using datetime type of xAxis as wergeld suggested. 您可以引用导航器xaxis并使用相同的格式化程序,但更好的方法是使用wergeld建议的xAxis的日期时间类型。

navigator: {
            enabled: true,
             xAxis: {
            labels: {
                rotation: 90,
                align: "left",
                formatter: function () {
                    return dates[this.value];
                },
            },
            tickInterval: 1
        },
},

http://jsfiddle.net/hj22wbe5/18/ http://jsfiddle.net/hj22wbe5/18/

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

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