dizzy
Posts: 79
Joined: Mon Aug 01, 2022 5:28 pm

Handling dates

Hi,
im using python to generate a json of some stock data. i convert the pandas TimeStamp to epoch and i serialize the data. the data looks something like this
[[1262822400.0, 1136.27001953125, 1142.4599609375, 1131.3199462890625, 1141.68994140625, 5270680000], [1263427200.0, 1145.6800537109375, 1150.4100341796875, 1143.800048828125, 1148.4599609375, 3915200000], [1264032000.0, 1138.6800537109375, 1141.5799560546875, 1114.8399658203125, 1116.47998046875, 6874290000], [1264636800.0, 1096.9300537109375, 1100.219970703125, 1078.4599609375, 1084.530029296875, 5452400000], [1265241600.0, 1097.25, 1097.25, 1062.780029296875, 1063.1099853515625, 5859690000], [1265846400.0, 1067.0999755859375, 1080.0400390625, 1060.5899658203125, 1078.469970703125, 4400870000], [1266451200.0, 1099.030029296875, 1108.239990234375, 1097.47998046875, 1106.75, 3878620000], [1267056000.0, 1101.239990234375, 1103.5, 1086.02001953125, 1102.93994140625, 4521130000],
here is what it looks like in the javascript:
Screenshot 2022-08-01 134527.png
Screenshot 2022-08-01 134527.png (73.04 KiB) Viewed 293 times
This is weekly data for thursdays from 2010 to present.
id like stock charts to show the year or year/months labels on the x-axis. i also notice that the tooltip shows a time, and that doesnt make sense for this data since it is EOD. i'd prefer it to show the m/d/y only. any help would be appreciated. the tooltip also shows 'monday', not thursday.

See attachement of what the chart looks like right now
Screenshot 2022-08-01 134215.png
Screenshot 2022-08-01 134215.png (41.11 KiB) Viewed 293 times
dizzy
Posts: 79
Joined: Mon Aug 01, 2022 5:28 pm

Re: Handling dates

My issue appears to have been a Pandas datetime conversion issue. All the UTC dates being passed were off by a factor of 1000. once i corrected that, it looks like it is working as expected.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Handling dates

Yep, that could be the issue! I'm glad that you've managed to fix it yourself, but in case of any other questions feel free to contact us!

Best regards
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Stock”