Вопрос

I am developing an Android app that plots the gyroscope sensor input in a graph with the GraphView 3.1 library.

The data that I am feeding the GraphView is values between -90 and 90.

Due to that I want the graph to show both positive and negative values, I consequently want origo to be in the middle of the graph (vertically).

Demo of the graph: http://www.youtube.com/watch?v=NtQOVU0GEEY

As you can see in the video, the graph starts with the x- and y-axis values in the top/bottom, this is unwanted, as it the values are 0 in both cases. They should both be in the middle (vertical center i.e. origo) when the x- and y-axis are 0. The graph should never shift the curve depending on subsequent values either, which is shown as soon as I tilt the device.

Do any of you have an idea of how to fix this? I would like the plot consistent and not relative to the subsequent values.

The code that I am using is almost identical to the one jjoe64 has created in his demo: https://github.com/jjoe64/GraphView-Demos/blob/master/src/com/jjoe64/graphviewdemos/RealtimeGraph.java

Thanks! Best Regards, Tim

Это было полезно?

Решение

Try to fix the y bounds with the method

graphview.setManualYAxisBounds(-100d, 100d);

http://jjoe64.github.io/GraphView/com/jjoe64/graphview/GraphView.html#setManualYAxisBounds(double, double)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top