Mahesh
Mahesh

Reputation: 1

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, i.e. as per dates that are there in x-axis.

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

please find the jsfiddle.

Thanks

Upvotes: 0

Views: 983

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37588

You can refer to navigator xaxis and use the same formatter, but better is using datetime type of xAxis as wergeld suggested.

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

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

Upvotes: 0

wergeld
wergeld

Reputation: 14462

Why are you not sending in your data as time/value? This way navigator does this for you automatically? 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? And you have duplicate values in your dates array. You are making much more work for yourself.

Send in data like below with your x as 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. I assume you meant the time to go up without duplicates.

Upvotes: 1

Related Questions