Repository navigation
Reset forced minimum tick spacing on every calc pass #7950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Fix box, violin, candlestick and ohlc traces losing their forced minimum tick spacing when a graph div is updated in place with `Plotly.react` or `Plotly.restyle` [[#7950](https://github.com/plotly/plotly.js/pull/7950)] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new test here covers scatter+box via
|
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -8303,6 +8303,45 @@ describe('more react tests', function() { | |||
| expect(gd._fullLayout.xaxis.range).toBeCloseToArray([-0.173, 2]); | ||||
| }).then(done, done.fail); | ||||
| }); | ||||
|
|
||||
| it('should not carry over the forced minimum tick spacing of the previous figure', function(done) { | ||||
| var layout = {width: 700, height: 400}; | ||||
|
|
||||
| var scatterFig = { | ||||
| data: [{y: [1, 2, 3]}], | ||||
| layout: layout | ||||
| }; | ||||
|
|
||||
| // one box per integer position - each box forces a tick of its own | ||||
| var boxFig = { | ||||
| data: [{ | ||||
| type: 'box', | ||||
| x: [1, 1, 2, 2, 3, 3], | ||||
| y: [1, 2, 3, 4, 5, 6] | ||||
| }], | ||||
| layout: layout | ||||
| }; | ||||
|
|
||||
| function getXLabels() { | ||||
| return gd._fullLayout.xaxis._vals.map(function(d) { return d.text; }); | ||||
| } | ||||
|
|
||||
| Plotly.newPlot(gd, boxFig) | ||||
| .then(function() { | ||||
| expect(getXLabels()).toEqual(['1', '2', '3']); | ||||
|
|
||||
| // scatter cancels the forcing for its own figure only | ||||
| return Plotly.newPlot(gd, scatterFig); | ||||
| }) | ||||
| .then(function() { | ||||
| return Plotly.react(gd, boxFig); | ||||
| }) | ||||
| .then(function() { | ||||
| expect(gd._fullLayout.xaxis._minDtick).toBe(1); | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is a useful assertion - it's testing internal details when we actually care about the outcome, which the next line asserts on.
Suggested change
|
||||
| expect(getXLabels()).toEqual(['1', '2', '3']); | ||||
| }) | ||||
| .then(done, done.fail); | ||||
| }); | ||||
| }); | ||||
|
|
||||
| describe('category preservation tests on gd passed to Plotly.react()', function() { | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how
ohlctraces are affected by this. Can you produce a test that confirms this?