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

Ensure axis autorange is computed after transform operations #1260

Merged
merged 5 commits into from
Jan 4, 2017

Conversation

etpinard
Copy link
Contributor

To fix the bug, we need to clear the ax._min and _ax._max arrays (generated in Axes.expand done in the _module.calc call before the calcTransform loop) before the final module.calc call.

To do so in the least intrusive way possible, this PR splits Plots.doCalcdata operations into separate loops - which hopefully will also help readability.

- one loop for relinking calcdata
- one loop for transform ops
- one loop for regular _module.calc

  in an effort to make transform less intrusive.
- so that axis autorange is computed after transfroms
  are made.
@etpinard etpinard added status: in progress bug something broken labels Dec 19, 2016
cd = [];

// If traces were specified and this trace was not included, then transfer it over from
// the old calcdata:
if(Array.isArray(traces) && traces.indexOf(i) === -1) {
calcdata[i] = oldCalcdata[i];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this part isn't new here, but... it isn't used anywhere, right? Looks to me like it was already broken by transforms (calcdata index and trace index aren't the same) and will be broken MORE by this PR (any trace not included will be dropped from autorange) so I'd remove it until we decide to do it right AND use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, is that a bug to be using that as an array index like that? If so, that may well be my fault. Unless I'm wrong, the intention was to reduce the work when animating. Use case: two traces. One contains 10MB of data, the other has two points. When animating the two points, it's best to avoid touching the 10MB trace. Perhaps we need to fix this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

right, makes a lot of sense to want to do that. I guess for autorange we just need to store the various _min and _max entries in a different way so we can selectively replace only the ones for the traces we're recalculating. And trace index, depending on how this gets used (it's not yet, right?) you just have to be careful about what you mean by index, before or after transforms potentially insert new traces.

@alexcjohnson
Copy link
Collaborator

LGTM. Great tests! nonblocking comment, 💃

@VeraZab
Copy link

VeraZab commented Dec 21, 2016

🎉
range
this fixes: https://github.com/plotly/streambed/issues/8802
💃 💃 💃

@etpinard
Copy link
Contributor Author

will be part of 1.21.3 set to be released in the week of Jan 2.

// clear stuff ...
for(i = 0; i < axList.length; i++) {
axList[i]._min = [];
axList[i]._max = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note to self: maybe we should clear _categories too to fix #1181 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 775dbb5

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool - note though that this only fixes the first part of 1181, not the variant of it mentioned in #1181 (comment)

@alexcjohnson
Copy link
Collaborator

nice. 💃

@etpinard etpinard merged commit fc6dfe1 into master Jan 4, 2017
@etpinard etpinard deleted the transform-calc-loops branch January 4, 2017 20:44
@etpinard etpinard mentioned this pull request Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants