Highchart setextreme plots 1 day less in different timezone - highcharts

I have a line chart plotted using Highchart as shown in below fiddle:
https://jsfiddle.net/48e0mngq/1/
Now In above fiddle, I have two text boxes which accepts from and to date in (yyyy/mm/dd) format. And when user click on the "Set" button, X-Axis extreme should set accordingly. This is how I set the extremes:
$('#set').click(function(){
var start = Date.parse($('#startDate').val());
var end = Date.parse($('#endDate').val());
console.log(start);
console.log(end);
chart.xAxis[0].setExtremes(start, end);
});
But its behavior differs on different timezones.
For example, my timezone in "India Standard Time" in this time zone it plots one day less than date selected and in EST timezone it works fine.
Is there any workaround to get rid of this?

Related

Highcharts: Display average hour values from a series of quarter-hourly values

My weather station collects every 15 minutes the current temperature. With Highcharts I created a chart to display the last 24h. So I pass all the 96 quarter-hourly values to the chart. This looks not so pretty. Instead I would just display the average of each hour.
Is it possible to display the average value for each hour based on a series of quarter-hourly values and leaving the calculation to Highcharts and not doing it myself?
You can use highstock which allows to use datagrouping.

Highstocks ordinal xAxis formatting

My case: Plot a stockchart with stock data for 5 days without weekends displaying, each day should have equal space even though data can be irregular.
What i need to do is plot an xAxis with static intervals of one day, however i cant display weekends and the data can be very irregular between the days. I've tried tinkering with tickInterval, tickPositioner but so far no luck.
I can hide weekends with:
ordinal: true,
My current fiddle:
http://jsfiddle.net/svedino/h9448fk0/1/
Setting the ordinal to false gives me correct interval but with the weekends included.
An example of this kind of graph seems to be working can be found here:
https://www.avanza.se/aktier/om-aktien.html/229675/jays

Highcharts - date on xAxis label difference on tooltip

I have a problem with HighCharts xAxis label. Date on xAxis label difference on tooltip and there are have 2 gridLine on a tick point. I thing have problem with json data but I don't know why.
Here is my code http://jsfiddle.net/jevgzgjx/1/
My data as a json array with timestamp:
var json = [[[1362783600000,5691],[1362870000000,6503],[1362956400000,15574],[1363042800000,16211],[1363129200000,16427],[1363215600000,16486],[1363302000000,14737],[1363388400000,5838],[1363474800000,5542],[1363561200000,15560],[1363647600000,18940]],[[1362783600000,4346],[1362870000000,4112],[1362956400000,11356],[1363042800000,11876],[1363129200000,11966],[1363215600000,12086],[1363302000000,10916],[1363388400000,4507],[1363474800000,4202],[1363561200000,11523],[1363647600000,14431]]];
The problem here is that your timestamps are all for 23:00 (11pm). Therefore the point is being drawn slightly to the left of each grid line (since the gridline is for 00:00 each day). It also causes the tooltip of each point to show the day before, since the point is in fact not on the day that the gridline displays, but one hour prior to that.
You can visualize this problem by modifying dateTimeLabelFormats, so that the hours are shown in the tooltip, like this (see this JSFiddle):
dateTimeLabelFormats: {
day:"%A, %b %e, %Y, %H:%M"
}
I'm not sure about the origin of your problem, but it can be solved by adding 3600000 (one hour in ms) to all your timestamps. The problem may be timezone related as timestamps in Highcharts are treated as UTC by default, so look into getting your timestamps in UTC as well.
If you use Date objects you can specify the timezone before getting the timestamp. You can disable using UTC by default with global.useUTC: false (API), but then you'll risk ending up with different results depending on where you are viewing the chart.

Wrong start date in irregular intervals chart

Start date in irregular series is not same with date which is shown on mouse-over tip.
Also, you can check this on HC demo page for Winter serie start date: http://www.highcharts.com/demo/spline-irregular-time
How can I fix this, so both date point to regular one.
TY
There is no error. XAxis labels is calculated for only to fit the screen. There may be no point on label. For this example, time is fragmented per-14-days. If time is too long, may be fragmented more than 14, OR less than 14.
XAxis labels not represent points. It only shows timeInterval.

Highcharts - changing x-axis labels with rangeselector

I am trying to use the highstock graph. I want to update the xAxis labels according to the range which is selected from the rangeselector. eg. if it's a 1-year graph, i want the ticks to be at the end of each month with labels as Jan-12,Feb-12 etc.(by default it shows each month as the beginning of that month). And if it's a monthly graph i want the labels to be positioned at each friday ie. at an interval of 7 days.
Is there a way i can dynamically change which labels are displayed on the axis based on the extremes?
You can use tickPositioner (http://api.highcharts.com/highcharts#xAxis.tickPositioner) or formatter to change labels name http://api.highcharts.com/highcharts#xAxis.labels.formatter

Resources