format-currency
Format a numeric break as currency.
Defaults to a leading dollar sign and English thousands separator.
Usage
format-currency(
symbol: "$",
big-mark: ",",
decimal-mark: ".",
digits: 2,
)Parameters
| Parameter | Default | Description |
|---|---|---|
symbol |
"$" |
Currency symbol prepended to the value. |
big-mark |
"," |
Thousands separator. |
decimal-mark |
"." |
Decimal separator. |
digits |
2 |
Decimal digits to keep. |
Returns
A closure value => string.
Examples
Pin a leading pound sign and two decimal digits on the y-axis labels.
#plot(
data: ((x: 1, y: 1234.5), (x: 2, y: 7890.1), (x: 3, y: 12345.6)),
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 3pt),),
scales: (scale-y-continuous(labels: format-currency(symbol: "£")),),
width: 10cm,
height: 6cm,
)