observablehq / observablehq/plot

A top-level locale option

Open
#384 13 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

Wherever English formatting appears by default, a simple possibility of taking into account any other language could/should be proposed.

E.g.: formatting of numbers or dates on the axes.

Suggestion: a high level locale property in a Plot specification, applying to the whole plot. By default, locale is set to "en".

This would work in a similar way to what has very usefully appeared in the Table component.

Note: vega-lite allows you to globally specify a locale for numbers and for dates:

vl.vega.timeFormatLocale(locale);
vl.vega.formatLocale(locale);

PS: Plot is a great library, very intellectually stimulating, and the 21 beautifully written articles in the https://observablehq.com/collection/@observablehq/plot collection should be read by all data scientists!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting how locale handling works in the Table component and how the Plot specification reaches number and date formatting on axes. Compare the proposed plot-level locale with Vega-Lite’s formatLocale and timeFormatLocale entry points; done means one locale setting controls the relevant formatting throughout a plot.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, javascript
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.