-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Renaming old attributes should not replace existing current attributes if both provided #3423
Conversation
src/plot_api/helpers.js
Outdated
@@ -319,11 +319,11 @@ exports.cleanData = function(data) { | |||
|
|||
// scl->scale, reversescl->reversescale | |||
if('scl' in trace) { | |||
trace.colorscale = trace.scl; | |||
if(!('colorscale' in trace)) { trace.colorscale = trace.scl; } |
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.
Could this be just one if-statement?
if('scl' in trace && !('colorscale' in trace)) {
// ...
}
?
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.
It could be namely if we want to leave scl
on the input trace in that scenario.
test/jasmine/tests/plot_api_test.js
Outdated
|
||
Plotly.plot(gd, data); | ||
expect(gd.data[0].colorscale).toBe('Greens'); | ||
expect(gd.data[0].scl).toBe(undefined); |
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.
.... this here would be 'Reds'
, but that's not a big deal, right?
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.
Yes now that the logic changed it should not
be undefined
.
Done in 168bb68
test/jasmine/tests/plot_api_test.js
Outdated
expect(gd.data[0].reversescl).toBe(undefined); | ||
}); | ||
|
||
it('should not rename \'scl\' to \'colorscale\' when colorscale is defined ', 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.
Wrong description it looks like
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.
Good 👁️ Thanks.
💃 - thanks for fixing 4+ year-old deprecation logic 😄 |
Fix #3419
@plotly/plotly_js