Skip to content
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

scattergl errorbars fixes #2620

Merged
merged 6 commits into from
May 22, 2018
Merged

scattergl errorbars fixes #2620

merged 6 commits into from
May 22, 2018

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented May 8, 2018

Fixes #2600 and the last item off #2450 (comment) (x errorbars aren't supported?).

Does not attempt to fix the on-relayout issue of #2450 (comment) nor the incorrect errorbar layering order described in #2450, @dy will take care of them once he finishes his regl-component module.

cc @alexcjohnson

- for example, when 'x' array is given (i.e. the x0/dx case)
  or when numeric string are inputted.
var calcFromTrace = Registry.getComponentMethod('errorbars', 'calcFromTrace');
var vals = calcFromTrace(trace, gd._fullLayout);
var count = positions.length / 2;
var _trace = Lib.extendFlat({}, trace, {x: x, y: y});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird to me - putting arrays of calcdata values into a fake trace. I don't know if category or date data would make any sense in this context but if we were to support them this would break.

This is the only caller of calcFromTrace, right? Can we just pass in the x and y calc'ed arrays separately from the trace?

Copy link
Contributor Author

@etpinard etpinard May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Using calcFromTrace made things very dry 🌴 but added a lot of overhead and many (many) object creations. So yeah good riddance 🔪 -> 82290a2

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice - that's more of a refactor than I was expecting but you're right, much better. 🌴 before, but as well as the 🐎 overhead, the scaffolding meant it didn't even really result in shorter code.

var opts = trace['error_' + axLetter];

if(opts && opts.visible && (ax.type === 'linear' || ax.type === 'log')) {
var computeError = makeComputeError(trace['error_' + axLetter]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makeComputeError(opts)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good eye!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> 7e77bb4

@alexcjohnson
Copy link
Collaborator

Very nice! 💃 after the minor comment above.

@etpinard etpinard merged commit e004a09 into master May 22, 2018
@etpinard etpinard deleted the scattergl-errors branch May 22, 2018 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scattergl calculates wrong error bar value if y value is a string
2 participants