Phil35
Posts: 3
Joined: Thu Mar 23, 2023 3:22 pm

About json data

Hi,
I discover HighCharts and that's great. I will use it only for my personal purpose.
I'm trying to use my own data lik the demo zoomable : "examples/line-time-series/index.html"
but I did'nt success.
I looked to https://cdn.jsdelivr.net/gh/highcharts/ ... sdeur.json
and don't understand the three trailing 0 at then of each "unix date"

0
0 1167609600000
1 0.7537

First question: why the trailing zero caracters?
If you convert 1167609600000 to real date .. hum if is a far future
if you convert 1167609600 (remove the last three zeros caracters) it is ok : 2007-01-02

second question: I try to use data as hereunder, but without any success in term of display.
[[1677625200,0],[1677711600,0],[1677798000,0],[1677884400,0.1],[1677970800,0],[1678057200,0],[1678143600,0.9],[1678230000,16.9],[1678316400,6.2],[1678402800,1.3],[1678489200,1],[1678575600,3],[1678662000,1
.7],[1678748400,1],[1678834800,0],[1678921200,0],[1679007600,2.7],[1679094000,0.4],[1679180400,7.2],[1679266800,0],[1679353200,0.6],[1679439600,1.3]]

In detail, I replace the current url by mine.
Highcharts.getJSON(
// 'https://cdn.jsdelivr.net/gh/highcharts/ ... sdeur.json',
'http://192.168.6.17/meteo/sumrain.json',

I also try to find information on what is it needed in a json file to have a correct computation by highcharts but no clearly success

Any help will be greatly appreciated.
Thank You
Phil
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: About json data

Hi,

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

Highcharts support unix dates in milliseconds, therefore it has 3 more zeros than unix date written in seconds.

The second question's problem may be caused by the fact that the data link is HTTP and the demo is on HTTPS. It's hard for me to say exactly if that's it because I can't see the code in action. If that's not it, you can send the code in the form of a demo, e.g. in jsfiddle, it will be easier to help me then.

I hope you will find it useful
Best regards!
Dawid Draguła
Highcharts Developer
Phil35
Posts: 3
Joined: Thu Mar 23, 2023 3:22 pm

Re: About json data

Hi @dawid.d,
Thank your for your time taken to answer to a newbie with highcharts. I appreciate.
#1: ok so no choice to have, unix time, i use, must be multiplied by 1000, to add the three zeros trailers.
#2: The only line changed is the URL to get json data. I moved html and json files on a https server. It works nice. I am sharing the URL via mp.

Do you know if it is possible to display on the same graphic, several json data series?
something like
- 2020 from january to december
- 2021 from january to december
- 2022 from january to december
- 2023 from january to december
In this case, of course, data should be prepared before, remove unixtime and replace with a series of number

Thank you again.
Phil
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: About json data

Hi,

You can concatenate arrays of data into one array, which you set as the data source for the series, as in the demo below.

Demo: https://jsfiddle.net/BlackLabel/dm6xs3a1/

Best regards!
Dawid Draguła
Highcharts Developer
Phil35
Posts: 3
Joined: Thu Mar 23, 2023 3:22 pm

Re: About json data

Thank you david.d for your time, patience and answer
I need to spend some time on this
Phli
User avatar
dawid.d
Posts: 807
Joined: Thu Oct 06, 2022 11:31 am

Re: About json data

You're welcome!

If I may clarify any issues I'm available at your convenience!
Kind regards
Dawid Draguła
Highcharts Developer

Return to “Highcharts Usage”