How does the X axis time scale of the highcharts chart correspond to the time of database records?

Source: Internet
Author: User
The above is a real-time outdoor temperature statistics chart. The data is taken from mysql and the database adds a new record every five minutes. Now I want to display it through the highcharts chart. The problem I encountered is: 1) now you need to fix the horizontal axis. The horizontal axis is 24 hours. 2) because the database format is...

The above is a real-time outdoor temperature statistics chart. The data is taken from mysql and the database adds a new record every five minutes. Now I want to display it through the highcharts chart. The problem I encountered is:

1) now the horizontal axis needs to be fixed, and the horizontal axis is 24 hours
2) because the database format is 03:00:00, how can we display the time in the corresponding time area of the horizontal axis?
That is to say, the database has a record. The datetime value is 09:01:23, and the data value is 20.4. You need to display the data between the scales from.

How can this problem be achieved? Thank you!

Reply content:

The above is a real-time outdoor temperature statistics chart. The data is taken from mysql and the database adds a new record every five minutes. Now I want to display it through the highcharts chart. The problem I encountered is:

1) now the horizontal axis needs to be fixed, and the horizontal axis is 24 hours
2) because the database format is 03:00:00, how can we display the time in the corresponding time area of the horizontal axis?
That is to say, the database has a record. The datetime value is 09:01:23, and the data value is 20.4. You need to display the data between the scales from.

How can this problem be achieved? Thank you!

If the horizontal axis is a timeline, we recommend that you use highstock instead of highcharts. Highstock is a more professional timeline.

The X axis is measured in seconds from 0 to 86400.

Convert datetime to seconds

Your Database adds a record every five minutes, so you can make your horizontal axis a 5-minute trial, just like expanding the clock scale into a line, accurate numbers are used to mark a punctuality. I don't know. It's just a guess!

Let's take a look ~~ Can it be solved?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.