File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 73
73
locale: ' en-US' ,
74
74
numberFormat: {
75
75
style: ' decimal' ,
76
- notation: ' compact' ,
76
+ // notation: 'compact',
77
77
compactDisplay: ' short'
78
78
},
79
79
markerDotRadius: 3 ,
Original file line number Diff line number Diff line change 89
89
)
90
90
);
91
91
92
- let tickFmt = $derived (tickFormat || plot .options .x .tickFormat );
92
+ const tickFmt = $derived (tickFormat || plot .options .x .tickFormat );
93
93
94
- let useTickFormat = $derived (
94
+ const useTickFormat = $derived (
95
95
typeof tickFmt === ' function'
96
96
? tickFmt
97
97
: plot .scales .x .type === ' band' || plot .scales .x .type === ' point'
107
107
: // auto
108
108
(d : RawValue ) =>
109
109
Intl .NumberFormat (plot .options .locale , {
110
+ // use compact notation if range covers multipe magnitudes
111
+ ... (new Set (ticks .map (Math .log10 ).map (Math .round )).size > 1
112
+ ? { notation: ' compact' }
113
+ : {}),
110
114
... DEFAULTS .numberFormat ,
111
115
style: plot .options .x .percent ? ' percent' : ' decimal'
112
116
}).format (d )
Original file line number Diff line number Diff line change 105
105
: // auto
106
106
(d : RawValue ) =>
107
107
Intl .NumberFormat (plot .options .locale , {
108
+ // use compact notation if range covers multipe magnitudes
109
+ ... (new Set (ticks .map (Math .log10 ).map (Math .round )).size > 1
110
+ ? { notation: ' compact' }
111
+ : {}),
108
112
... DEFAULTS .numberFormat ,
109
113
style: plot .options .y .percent ? ' percent' : ' decimal'
110
114
}).format (d )
You can’t perform that action at this time.
0 commit comments