Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add tests for tick formatting of small numbers in exponential n…
…otation and add draftlog
  • Loading branch information
Hasnaathussain committed Jun 27, 2026
commit 8a3a1ccdfec3eb1598f5aafdf08bcff2ac3598ce
1 change: 1 addition & 0 deletions draftlogs/7768_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Format tick labels correctly for small numbers in exponential notation [[#7768](https://github.com/plotly/plotly.js/pull/7768)]
44 changes: 44 additions & 0 deletions test/jasmine/tests/axes_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3627,6 +3627,50 @@ describe('Test axes', function() {
});
});

it('formats tick labels correctly for small numbers in exponential notation', function() {
var textOut = mockCalc({
type: 'linear',
tickmode: 'linear',
exponentformat: 'none',
showexponent: 'all',
tick0: 0,
dtick: 1e-9,
range: [8.5e-9, 11.5e-9]
});

expect(textOut).toEqual([
'0.000000009', '0.00000001', '0.000000011'
]);

textOut = mockCalc({
type: 'linear',
tickmode: 'linear',
exponentformat: 'none',
showexponent: 'all',
tick0: 0,
dtick: 1e-15,
range: [8.5e-15, 11.5e-15]
});

expect(textOut).toEqual([
'0.000000000000009', '0.00000000000001', '0.000000000000011'
]);

textOut = mockCalc({
type: 'linear',
tickmode: 'linear',
exponentformat: 'e',
showexponent: 'all',
tick0: 0,
dtick: 1e-15,
range: [8.5e-15, 11.5e-15]
});

expect(textOut).toEqual([
'0.9e\u221214', '1e\u221214', '1.1e\u221214'
]);
});

it('provides a new date suffix whenever the suffix changes', function() {
var ax = {
type: 'date',
Expand Down
Loading