cevepe
Posts: 8
Joined: Mon Sep 13, 2021 7:18 am

Time is in UTC, export menu have padding and night background in graph

I have time in graph: 1631657100000 = 15. 9. 2021 0:05:00, but the graph shows it as 14. 9. 2021 22:05:00. Why? :roll:
I give him local time, but the time is even 2 hours shorter (Prague).

My head code:
https://code.highcharts.com/highcharts.src.js
https://code.highcharts.com/modules/exporting.js

I'm using Bootstrap 5 and I have a problem with the export menu. The menu is displayed with large spaces. Don't know why?
Image

And the last question. How do I insert a color into the graph, which is drawn as night in the background.

I will be very happy for your help.
cevepe
Posts: 8
Joined: Mon Sep 13, 2021 7:18 am

Re: Time is in UTC, export menu have padding and night background in graph

Image:
4O7y.png
4O7y.png (38.67 KiB) Viewed 557 times
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Time is in UTC, export menu have padding and night background in graph

Hello cevepe,

Welcome to our forum and thanks for contacting us with your questions!

Your date is different than you expected because of useUTC API option which value is by default set to true. Because of that UTC time is used to calculate date based on provided timestamp. Setting that option to false should be what you are looking for.
Demo: https://jsfiddle.net/BlackLabel/nxmL25qv/
API reference: https://api.highcharts.com/highcharts/time.useUTC,

When it comes to that excessive spacing in exporting menu, to tell exactly what is the cause of that behaviour, I need you to provide me with working demo showing that issue. You can start here: https://jsfiddle.net/BlackLabel/6t0cvu5w/
If that spacing is somehow caused by Bootstrap, then I can't really help you with that, because the problem is not related to highcharts.

Regarding your question about inserting a color, I don't understand what exactly you want to achieve, some clarification would be greatly appreciated here. Chart colors can be changed via various available API options like backgroundColor or with CSS. You can also use one of few Highcharts color themes (this dark one might interest you: https://www.highcharts.com/demo/dark-unica), or create your own theme.
More about themes: https://www.highcharts.com/docs/chart-d ... yle/themes,
https://www.highcharts.com/docs/chart-d ... tyled-mode

Best regards!
Mateusz Bernacik
Highcharts Developer
cevepe
Posts: 8
Joined: Mon Sep 13, 2021 7:18 am

Re: Time is in UTC, export menu have padding and night background in graph

For the day / night chart, I thought of the background color to determine the night. Don't know exactly how to do this?
graf-za-poslednch-24-hod.png
graf-za-poslednch-24-hod.png (172.65 KiB) Viewed 519 times
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Time is in UTC, export menu have padding and night background in graph

Hello cevepe,

I would suggest using plotBands.
Demo: https://jsfiddle.net/gh/get/library/pur ... nds-color/
API reference: https://api.highcharts.com/highcharts/yAxis.plotBands

Let me know if you have any further questions!
Best regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”