-
-
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
fix errorbars for Plotly.react and for uneven data arrays #2360
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ module.exports = function plot(traces, plotinfo, transitionOpts) { | |
|
||
var path; | ||
|
||
var yerror = errorbar.select('path.yerror'); | ||
if(yObj.visible && isNumeric(coords.x) && | ||
isNumeric(coords.yh) && | ||
isNumeric(coords.ys)) { | ||
|
@@ -88,8 +89,6 @@ module.exports = function plot(traces, plotinfo, transitionOpts) { | |
|
||
if(!coords.noYS) path += 'm-' + yw + ',0h' + (2 * yw); // shoe | ||
|
||
var yerror = errorbar.select('path.yerror'); | ||
|
||
isNew = !yerror.size(); | ||
|
||
if(isNew) { | ||
|
@@ -105,7 +104,9 @@ module.exports = function plot(traces, plotinfo, transitionOpts) { | |
|
||
yerror.attr('d', path); | ||
} | ||
else yerror.remove(); | ||
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. another bug fixed here (and tested below) - if you deleted some data from your errorbar data arrays, the corresponding errorbar was not removed. 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. Good catch 🎣 |
||
|
||
var xerror = errorbar.select('path.xerror'); | ||
if(xObj.visible && isNumeric(coords.y) && | ||
isNumeric(coords.xh) && | ||
isNumeric(coords.xs)) { | ||
|
@@ -117,8 +118,6 @@ module.exports = function plot(traces, plotinfo, transitionOpts) { | |
|
||
if(!coords.noXS) path += 'm0,-' + xw + 'v' + (2 * xw); // shoe | ||
|
||
var xerror = errorbar.select('path.xerror'); | ||
|
||
isNew = !xerror.size(); | ||
|
||
if(isNew) { | ||
|
@@ -134,6 +133,7 @@ module.exports = function plot(traces, plotinfo, transitionOpts) { | |
|
||
xerror.attr('d', path); | ||
} | ||
else xerror.remove(); | ||
}); | ||
}); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,11 @@ | |
], | ||
"visible": true | ||
}, | ||
"error_x": { | ||
"type": "data", | ||
"symmetric": false, | ||
"visible": true | ||
}, | ||
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. added x errorbars with no data so that the image wouldn't change, but it would have failed before this fix in 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. thanks for the comment 📚 |
||
"type": "scatter" | ||
} | ||
] | ||
|
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.
Note that this (removing
|| arrayminus === undefined
) isn't actually a change in behavior, since we were filling in[]
at thesupplyDefaults
step anyway