posit-dev / posit-dev/ggsql

More powerful number formatting

Open
#470 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plot building
Dominant language
Rust
Stars
554
Forks
30
Avg merge
17h 27m
Merged PRs (30d)
8

Description

We currently rely on the sprintf crate for printf like formatting in the {:num ...} formatter. While it handles a lot it does not handle everything (e.g. thousand separator etc). While this is fine for now with only break values needing this, we may need stronger support when table support lands:

Two options:

  • numfmt: Arguably the largest feature addition, but using a formatting spec that is somewhat foreign to most.
  • format_num: Adds comma-only thousand separator with familiar (but slightly different - based on D3) printf syntax (minus % prefix). Also adds SI-unit and a bunch of other features (but fewer than numfmt)

Both are negligible in terms of binary size/compile time so a real option is to have both options available. Very little is lost by switching to format_num for the {:num ...} formatter and we could have auto detection of the format string to conditionally pass it to numfmt or format_num

Contributor guide

No contributing guide indexed for this repository

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 locating the current {:num ...} formatter and its use of the sprintf crate. Compare the proposed numfmt and format_num approaches, including auto-detection and future table support, then define the supported formatting behavior and tests before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.