Nadya
Nadya

Reputation: 73

Select custom date range on highstock control

I am using highstock control and I want to set a custom highlighted date range for a control via js. Example of task: load data for a week to control and highlight only data for last day since 16:00

I tried using this code when initializing chart control:

rangeSelector: {                
            buttons: [{
              type: 'day',
              count: 1,
              text: '1d'
             }],
            selected: 0
        }

But this code highlights whole timespan for last 24 hours, while I need to highlight last day from 16:00. How can I set this custom date?

Upvotes: 1

Views: 3252

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

Instead of using rangeSelector, use min and max for xAxis, for example:

xAxis: {
  min: Date.UTC(2013, 6, 17, 16, 00), //previous day  at 16.00
  max: new Date().getTime() //get actual time
}

Upvotes: 3

Related Questions