How can I format the x axis scale to a logarithmic scale in the android library GraphView?

StackOverflow https://stackoverflow.com/questions/22745557

  •  24-06-2023
  •  | 
  •  

Вопрос

I want to port a Bode Chart application from PC to Android devices. I found this library (GraphView) to plot in a simply way in Android. The only problem that stop me is that I cannot find a solution to set a logarithmic scale for my graphs. I need it because they're supposed to be in a Bode Chart for the correct plotting. In the other Java libraries for PC plotting I used simply a method called setDomainAxis and I give to it a NumberAxis or in my case a LogAxis. I found out a method to set min and max range value but no min and max domain value method founded and no reference in their documentation. Did someone find a fix, a solution to this scaling problem? Thanks to anyone in advance.

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

Решение

I made a simple solution using native components to plot a Logarithmic background and plot here, so, no third party library dependencies.

To smooth-out the curves, you can use any available Bezier Curve alogorithm.

Другие советы

This should work out of the box, but you can do the trick yourself with label formatting and feeding in skewed data. There is a demo on label formatting here:

CustomLabelFormatterActivity

You feed in the logarithmic data, and for the labels you do the corresponding (reverse, I believe) transformation in the setCustomLabelFormatter method for the y axis.

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