Skip to content

Commit c40f474

Browse files
committed
add prop separatethousands to layout_attributes
1 parent d61c963 commit c40f474

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/plots/cartesian/axes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,8 @@ function numFormat(v, ax, fmtoverride, hover) {
10921092
tickRound = ax._tickround,
10931093
exponentFormat = fmtoverride || ax.exponentformat || 'B',
10941094
exponent = ax._tickexponent,
1095-
tickformat = ax.tickformat;
1095+
tickformat = ax.tickformat,
1096+
separatethousands = ax.separatethousands;
10961097

10971098
// special case for hover: set exponent just for this value, and
10981099
// add a couple more digits of precision over tick labels
@@ -1156,7 +1157,7 @@ function numFormat(v, ax, fmtoverride, hover) {
11561157
if(dp) v = v.substr(0, dp + tickRound).replace(/\.?0+$/, '');
11571158
}
11581159
// insert appropriate decimal point and thousands separator
1159-
v = Lib.numSeparate(v, ax._gd._fullLayout.separators);
1160+
v = Lib.numSeparate(v, ax._gd._fullLayout.separators, separatethousands);
11601161
}
11611162

11621163
// add exponent

src/plots/cartesian/layout_attributes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,14 @@ module.exports = {
310310
'If *B*, 1B.'
311311
].join(' ')
312312
},
313+
separatethousands: {
314+
valType: 'boolean',
315+
dflt: false,
316+
role: 'style',
317+
description: [
318+
'even 4-digit integers are separated if true'
319+
].join(' ')
320+
},
313321
tickformat: {
314322
valType: 'string',
315323
dflt: '',

src/plots/cartesian/tick_label_defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
4343
if(!tickFormat && axType !== 'date') {
4444
coerce('showexponent', showAttrDflt);
4545
coerce('exponentformat');
46+
coerce('separatethousands');
4647
}
4748
}
4849
}

0 commit comments

Comments
 (0)