Java – AndroidPlot – Makes the graph scroll with the x-axis labels

AndroidPlot – Makes the graph scroll with the x-axis labels… here is a solution to the problem.

AndroidPlot – Makes the graph scroll with the x-axis labels

I created a line chart with AndroidPlot.
Because I have enough field values (x-axis labels), I need to implement a scroll.
Give this example http://androidplot.com/docs/how-to-pan-zoom-and-scale/ , the graph scrolls, but the x-axis labels change dynamically based on scrolling.
But I just need the entire x-axis value to scroll along with the graph.
This may be related to HorizontalScrollview or thanks for any other help….

Solution

Gridlines are calculated and drawn relative to the origin. By default, the origin is always the leftmost visible value and changes significantly as you scroll.
To lock the grid to a specific value, set a user-defined origin:

setUserDomainOrigin()    and    setUserRangeOrigin()

The grid and its values are now calculated and drawn based on the origin selected by the user and scroll along a fixed origin.

Related Problems and Solutions