fmt attributes (and variants y_fmt, x_fmt) to format values in components.
The following formats are supported:
Dates
ddd- Sundddd- Sundaymmm- Janmmmm- Januaryyyyy- 2022shortdate- Jan 9/22longdate- January 9, 2022fulldate- Sunday January 9, 2022mdy- 1/9/22dmy- 9/1/22hms- 11:45:03 AM
Currencies
The following currencies are supported:- USD
- AUD
- BRL
- CAD
- CNY
- EUR
- GBP
- JPY
- INR
- KRW
- NGN
- SEK
- a number indicating the number of decimal places to show (0-2)
- a letter indication the order of magnitude to show ("",“k”, “m”, “b”)
usd- $412usd0- $412usd1- $412.1usd2- $412.12usd0k- $412kusd1k- $412.1kusd2k- $412.12kusd0m- $412musd1m- $412.1musd2m- $412.12musd0b- $412busd1b- $412.1busd2b- $412.12b
Numbers
The default number format (when no fmt is specified) automatically handles decimal places and summary units (in the same way that usd does for currency).num0- 11num1- 11.2num2- 11.23num3- 11.232num4- 11.2317num0k- 64knum1k- 64.2knum2k- 64.20knum0m- 43Mnum1m- 42.5Mnum2m- 42.54Mnum0b- 1Bnum1b- 1.4Bnum2b- 1.38Bid- 921594675mult- 5.3xmult0- 5xmult1- 5.3xmult2- 5.32xsci- 1.65E+4
Percentages
pct- 25.1%pct0- 25%pct1- 25.1%pct2- 25.12%pct3- 25.123%
Title Formatting
SQL expressions are automatically formatted into readable titles for legends, tooltips, and axis labels:| Expression | Display | Rule |
|---|---|---|
y="sum(total_sales)" | Sum of Total Sales | Auto-formatted to Title Case |
y="sum(total_sales) as total_sales" | total_sales | Alias used exactly as written |
y="sum(total_sales) as `Total Sales (USD)`" | Total Sales (USD) | Quoted alias preserves spaces/special chars |
y_axis_options={ title="My Title" }.
