Skip to content

default multi-line time format #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2023
Merged

default multi-line time format #1718

merged 5 commits into from
Jun 25, 2023

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jun 23, 2023

Fixes #1285.

TODO

  • utc time
  • local time
  • bottom orientation
  • top orientation
  • left orientation
  • right orientation
  • reversed domains

It would also be nice to have a better format for explicit tick time intervals #932, but I’ve left that for future work.

@mbostock mbostock force-pushed the mbostock/multi-line-time branch 4 times, most recently from 75a2dd2 to 1a05337 Compare June 25, 2023 00:39
@mbostock mbostock marked this pull request as ready for review June 25, 2023 00:39
@mbostock mbostock requested a review from Fil June 25, 2023 00:39
throw new Error("unable to format time ticks");
}

function getTimeTicksInterval(scale, ticks) {
Copy link
Contributor

@Fil Fil Jun 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function being a bit difficult to grokk, I've made a chart to understand at which exact values the transitions happen; e.g., 707ms—the geometric mean of 500ms and 1000ms.

untitled (26)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s gotta match the behavior of d3.utcTicks.

@mbostock mbostock force-pushed the mbostock/multi-line-time branch from 52556e2 to d689f98 Compare June 25, 2023 20:38
@mbostock mbostock merged commit 780c2f9 into main Jun 25, 2023
@mbostock mbostock deleted the mbostock/multi-line-time branch June 25, 2023 21:06
nachocab added a commit to nachocab/plot that referenced this pull request Jun 26, 2023
Probably not needed now that observablehq#1285 was closed by observablehq#1718
Fil pushed a commit that referenced this pull request Jun 26, 2023
Probably not needed now that #1285 was closed by #1718
Fil added a commit that referenced this pull request Jun 27, 2023
mbostock added a commit that referenced this pull request Jun 27, 2023
* document multi-line tick format

(ref: #1718, #1725)

* Update docs/marks/axis.md

Co-authored-by: Mike Bostock <[email protected]>

* better formats for explicit intervals

---------

Co-authored-by: Mike Bostock <[email protected]>
Fil added a commit that referenced this pull request Aug 21, 2023
* remove maybeAutoTickFormat

* multi-line time format

* Update test/plots/covid-ihme-projected-deaths.ts

Co-authored-by: Philippe Rivière <[email protected]>

* link to d3-time

* fix test size

---------

Co-authored-by: Philippe Rivière <[email protected]>
Fil pushed a commit that referenced this pull request Aug 21, 2023
Probably not needed now that #1285 was closed by #1718
Fil added a commit that referenced this pull request Aug 21, 2023
* document multi-line tick format

(ref: #1718, #1725)

* Update docs/marks/axis.md

Co-authored-by: Mike Bostock <[email protected]>

* better formats for explicit intervals

---------

Co-authored-by: Mike Bostock <[email protected]>
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
* remove maybeAutoTickFormat

* multi-line time format

* Update test/plots/covid-ihme-projected-deaths.ts

Co-authored-by: Philippe Rivière <[email protected]>

* link to d3-time

* fix test size

---------

Co-authored-by: Philippe Rivière <[email protected]>
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
…ervablehq#1728)

* document multi-line tick format

(ref: observablehq#1718, observablehq#1725)

* Update docs/marks/axis.md

Co-authored-by: Mike Bostock <[email protected]>

* better formats for explicit intervals

---------

Co-authored-by: Mike Bostock <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A multi-line time format by default
2 participants