owid-grapher icon indicating copy to clipboard operation
owid-grapher copied to clipboard

Support for more time intervals than yearly and daily

Open marcelgerber opened this issue 1 year ago • 4 comments

Core problem

We have some datasets that have monthly, quarterly, decadal, or once-per-century observations. Right now we can present them already using daily or yearly, but there are some drawbacks:

  • For monthly data, we have to pick some (somewhat arbitrary) point in the month, and it's not immediately that the point ranges over the whole month.

    Example

    image

  • For decadal data, for example, going on the map tab will append e.g. "1910" to the title, rather than the more clear "1910s" or "1910-1919".

    Example

    image

  • For line charts, the x axis will show axis ticks for "irrelevant" increments.

    Example

    image

Proposed solution

Introduce new time intervals. These would be specified in the variable metadata file, and interpreted by Grapher on load. The following time intervals seem useful:

  • monthly
  • quarterly
  • decadal
  • per-century

Challenges

In the past, we had issues when trying to combine variables using different time units in a scatterplot. That'll probably continue into the future.

In addition, we have to come up with reasonable serialisation schemes for the different time units. For example, we could serialise "August 2022" to "2022-08", or 202208, or 2022 * 12 + 8. Ideally, this serialization format sorts correctly (bonus points for negative values, like "August, 100 BCE"), and is integer-continuous (i.e. if n is a valid value, then n + 1 is also a valid value).

Alternatives

Leave it as-is.

Context

We already have a few charts that basically use one of these time intervals:

In addition, we have a very bare-bones implementation of using quarterly observations already (which can only be used in explorers, and is never used in production). See this example explorer.

Slack discussion here

marcelgerber avatar Mar 15 '23 15:03 marcelgerber

This could be a good one to discuss in a #data-viz chat.

larsyencken avatar Apr 05 '23 13:04 larsyencken

For reference, there is also a proposal in Notion

sophiamersmann avatar Apr 25 '23 11:04 sophiamersmann

Saloni requested this, for nicer tick marks in the flu explorer.

marcelgerber avatar May 22 '23 07:05 marcelgerber

This issue has had no activity within 10 months. It is considered stale and will be closed in 7 days unless it is worked on or tagged as pinned.

github-actions[bot] avatar Mar 18 '24 07:03 github-actions[bot]