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

fix support for typed arrays in bar 'width' and 'offset' #3169

Merged
merged 2 commits into from
Oct 29, 2018

Conversation

etpinard
Copy link
Contributor

fixes #3142 and a similar unlisted bug for bar offset.

cc @plotly/plotly_js

@etpinard etpinard added bug something broken status: reviewable labels Oct 26, 2018
assertArrayField(cd[1][0], 't.poffset', o);
assertPointField(cd, 'x', [
[0.5, 1.8, 3.1],
[0.5, 1.8, 3.099]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Huh, took me a while to figure out where these numbers came from... surprised I had never noticed this before but it seems weird that offset sets the left edge of each bar rather than its center. Oh well, a little late to change that. Why does the second one get 3.099 instead of 3.1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure.

With a regular array, we get:

[0.5, 1.7999999999999998, 3.1]

with a typed array, we get:

[0.5000000014901161, 1.8000000059604644, 3.099999988079071]

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah ok, that's just because it's a Float32Array ie single precision, not double. But it's still closer to 3.1 than to 3.099 😏

@alexcjohnson
Copy link
Collaborator

💃 💪

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.

width.bar doesnt show if width is typed array
2 participants