forked from observablehq/plot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
default multi-line time format (observablehq#1718)
* 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]>
Showing
34 changed files
with
4,185 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,5 @@ | ||
import {format, utcFormat} from "d3"; | ||
import {formatIsoDate} from "./format.js"; | ||
import {constant, isTemporal, string} from "./options.js"; | ||
import {isOrdinalScale} from "./scales.js"; | ||
|
||
export function inferFontVariant(scale) { | ||
return isOrdinalScale(scale) && scale.interval === undefined ? undefined : "tabular-nums"; | ||
} | ||
|
||
// D3 doesn’t provide a tick format for ordinal scales; we want shorthand when | ||
// an ordinal domain is numbers or dates, and we want null to mean the empty | ||
// string, not the default identity format. TODO Remove this in favor of the | ||
// axis mark’s inferTickFormat. | ||
export function maybeAutoTickFormat(tickFormat, domain) { | ||
return tickFormat === undefined | ||
? isTemporal(domain) | ||
? formatIsoDate | ||
: string | ||
: typeof tickFormat === "function" | ||
? tickFormat | ||
: (typeof tickFormat === "string" ? (isTemporal(domain) ? utcFormat : format) : constant)(tickFormat); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.