Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The 'nice numbers' article you linked to mentioned that</p> <blockquote> <p>the nicest numbers in decimal are 1, 2, 5 and all power-of-10 multiples of these numbers</p> </blockquote> <p>So I think for doing something similar with date/time you need to start by similarly breaking down the component pieces. So take the nice factors of each type of interval:</p> <ul> <li>If you're showing seconds or minutes use 1, 2, 3, 5, 10, 15, 30 (I skipped 6, 12, 15, 20 because they don't "feel" right).</li> <li>If you're showing hours use 1, 2, 3, 4, 6, 8, 12</li> <li>for days use 1, 2, 7</li> <li>for weeks use 1, 2, 4 (13 and 26 fit the model but seem too odd to me)</li> <li>for months use 1, 2, 3, 4, 6</li> <li>for years use 1, 2, 5 and power-of-10 multiples</li> </ul> <p>Now obviously this starts to break down as you get into larger amounts. Certainly you don't want to do show 5 weeks worth of minutes, even in "pretty" intervals of 30 minutes or something. On the other hand, when you only have 48 hours worth, you don't want to show 1 day intervals. The trick as you have already pointed out is finding decent transition points.</p> <p>Just on a hunch, I would say a reasonable crossover point would be about twice as much as the next interval. That would give you the following (min and max number of intervals shown afterwards)</p> <ul> <li>use seconds if you have less than 2 minutes worth (1-120)</li> <li>use minutes if you have less than 2 hours worth (2-120)</li> <li>use hours if you have less than 2 days worth (2-48)</li> <li>use days if you have less than 2 weeks worth (2-14)</li> <li>use weeks if you have less than 2 months worth (2-8/9)</li> <li>use months if you have less than 2 years worth (2-24)</li> <li>otherwise use years (although you could continue with decades, centuries, etc if your ranges can be that long)</li> </ul> <p>Unfortunately, our inconsistent time intervals mean that you end up with some cases that can have over 1 hundred intervals while others have at most 8 or 9. So you'll want to pick the size of your intervals such than you don't have more than 10-15 intervals at most (or less than 5 for that matter). Also, you could break from a strict definition of 2 times the next biggest interval if you think its easy to keep track of. For instance, you could use hours up to 3 days (72 hours) and weeks up to 4 months. A little trial and error might be necessary.</p> <p>So to go back over, choose the interval type based on the size of your range, then choose the interval size by picking one of the "nice" numbers that will leave you with between 5 and about 15 tick marks. Or if you know and/or can control the actual number of pixels between tick marks you could put upper and lower bounds on how many pixels are acceptable between ticks (if they are spaced too far apart the graph may be hard to read, but if there are too many ticks the graph will be cluttered and your labels may overlap).</p>
    singulars
    1. This table or related slice is empty.
    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.
    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