Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p><strong>UPDATE</strong> This is now supported directly in the Chart API using the advanced graphs "annotated chart" feature - <a href="https://developers.google.com/chart/interactive/docs/gallery/annotationchart" rel="nofollow noreferrer">https://developers.google.com/chart/interactive/docs/gallery/annotationchart</a></p> </blockquote> <p>I have done this on my <s><a href="http://rehash.dustinfineout.com/db_stats.php" rel="nofollow noreferrer" title="ReHash Database Statistics">ReHash Database Statistics</a></s> chart (even though the dates turned out to be evenly spaced, so it doesn't exactly demonstrate that it's doing this).</p> <p>First, you want to get your <strong>overall time period</strong>, which will be analogous to the overall width of your chart. To do this we subtract the earliest date from the latest. I prefer to use Unix-epoch timestamps as they are integers and easy to compare in this way, but you could easily calculate the number of seconds, etc.</p> <p>Now, loop through your data. For each date we want the <em>percentile</em> in the overall period that the date is from the beginning (i.e. the earliest date is 0, the latest is 100). For each date, you first want to calculate the <strong>distance of the present date</strong> from the earliest date in the data set. Essentially, "how far are we from the start". So, subtract the earliest date from the present date. Then, to find the percentile, we divide the <strong>distance of the present date</strong> by the <strong>overall time period</strong>, and then multiply by 100 and truncate or round any decimal to give our integral <strong>x-coordinate</strong>.</p> <p>And it is as simple as that! Your x-values will range from 0 (the left-side of the chart) to 100 (the right side) and each data point will lie at a distance from the start respective of its true temporal distance.</p> <p>If you have any questions, feel free to ask! I can post pesudocode or PHP if desired.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload