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

Projects
None yet
2 participants
@etpinard
Copy link
Member

commented Oct 26, 2018

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

cc @plotly/plotly_js

assertArrayField(cd[1][0], 't.poffset', o);
assertPointField(cd, 'x', [
[0.5, 1.8, 3.1],
[0.5, 1.8, 3.099]

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Oct 29, 2018

Contributor

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?

This comment has been minimized.

Copy link
@etpinard

etpinard Oct 29, 2018

Author Member

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]

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Oct 29, 2018

Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Oct 29, 2018

💃 💪

@etpinard etpinard merged commit a04b13d into master Oct 29, 2018

7 checks passed

ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: publish Your tests passed on CircleCI!
Details
ci/circleci: test-image Your tests passed on CircleCI!
Details
ci/circleci: test-image2 Your tests passed on CircleCI!
Details
ci/circleci: test-jasmine Your tests passed on CircleCI!
Details
ci/circleci: test-jasmine2 Your tests passed on CircleCI!
Details
ci/circleci: test-syntax Your tests passed on CircleCI!
Details

@etpinard etpinard deleted the bar-width-offset-typed-arrays branch Oct 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.