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

Viewport transX jumping when zooming Y scale (dynamic/realtime data) #2719

Closed
kzhaowmm opened this issue Aug 14, 2017 · 2 comments
Closed

Viewport transX jumping when zooming Y scale (dynamic/realtime data) #2719

kzhaowmm opened this issue Aug 14, 2017 · 2 comments

Comments

@kzhaowmm
Copy link

I've noticed that the viewport's transX (position on the X) jumps around when pinching the zoom on the Y scale.
I also notice that the amount that the data jumps seems dependent on the left axis maximum. Setting this to smaller amounts tends to make the jump less.

Lastly, note that I have real time data coming that calls notifyDataSetChanged() and setNeedsDisplay() roughly once per second.

Is there any way to fix the transX to not move when zooming on the Y scale? Currently the x axis jumps back a few hundred data points when pinching to zoom in, and then jumps back to the original state when zooming back out.

@liuxuan30
Copy link
Member

are you able to debug on your side? We could use your help

@kzhaowmm
Copy link
Author

I figured it out: the trans X was jumping when the viewport offset rescaling based on the Y axis label width.

For example, if the Y label max jumped from 100 down to 90, the extra spacing on the left (3 characters down to 2 characters in label length) caused the viewport's left offset to be automatically rescaled. This rescaling causes a glitch in the transX when the new chart rerenders with extra pixels to the left.

I fixed this by manually setting the offset of the viewport, overriding any automatic resizing.

chart?.setViewPortOffsets(left: 25, top: 20, right: 20, bottom: 25)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants