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 Maximum Stuck at 1 #26

Open
bmdalton opened this issue Jun 22, 2016 · 2 comments
Open

Viewport Maximum Stuck at 1 #26

bmdalton opened this issue Jun 22, 2016 · 2 comments

Comments

@bmdalton
Copy link

If you set graph.getViewport().setXAxisBoundsManual(true); for both the X and Y axes but then only supply a minimum for both (0 for each), the X axis will increase automatically with data while the Y axis is initiated at 1 on the graph and will not move. How do you get around this? In an older version of the code I'm running, this bug didn't happen.

Note: the data I have is coming in VIA bluetooth and being appended to a series in real time, so I cannot set a maximum value to begin with.

@jjoe64
Copy link
Owner

jjoe64 commented Jun 29, 2016

please provide a isolated mini example where i can reproduce it

@bmdalton
Copy link
Author

In my example, I am streaming data VIA bluetooth. Using an app like the one below, I set up two phones next to each other and send an number from one phone to the next, where I would like it to be graphed.
screenshot_20160630-093223

As you can see, before any numbers are received, the window is automatically 0 to 1 on the y-axis and 0 to 0.75+ on the x-axis. My code for this uses a GraphView object named graph and the viewport is set as follows:

graph.getViewport().setXAxisBoundsManual(true); // set manual X bounds
graph.getViewport().setMinX(0);
graph.getViewport().setMaxX(count);
graph.getViewport().setYAxisBoundsManual(true); // set manual Y bounds
graph.getViewport().setMinY(0);

where count is an integer variable that increases by one for each integer received from the other phone. Count is initialized to 0.

When running this code, while the x axis increases as count increases, the y-axis never moves from the initial 0 to 1 position seen here.

Additionally, as you can see in the picture the "Vertical" is being covered by the 0.5. When the viewport is NOT specified, the spacing between the axis label and the axis numbering is automatically done. When the viewport is specified, this issues occurs. (This is not my primary issue but it is another I encountered with the viewport, FYI).

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