Commit a6b2c2a
committed
Fix adjustFormat dropping d3-format specs that start with a sign flag
A d3-format specifier beginning with a sign flag (+, -, (, space) was
silently ignored: adjustFormat prepended a trim tilde to the whole
string, producing an invalid spec like ~+.2f. d3.format then threw,
numberFormat fell back to noFormat, and the raw unformatted number was
shown (e.g. %{y:+.2f} rendered 12.3456789 instead of +12.35).
Skip past an optional leading sign flag and symbol ($, #) before the
trim heuristic and reattach it, so the tilde is only added in a valid
position. Formats without such a prefix are unaffected.
Fixes #78971 parent 227bba9 commit a6b2c2a
2 files changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| |||
0 commit comments