Search code examples
javaandroidgraphandroidplot

AndroidPlot - Make graph scrollable along with x-axis labels


I created a line graph with AndroidPlot.
Since I have got pleanty of Domain values(x-axis labels), I need to implement a scroll.
With this example given http://androidplot.com/docs/how-to-pan-zoom-and-scale/ , the graph scrolls, but the x-axis labels changes dynamically according to the scroll.
But I just need the entire x-axis values to get scrolled along with the graph.
Is this possible with HorizontalScrollview or any other help is appreciated....


Solution

  • The gridlines are calculated and drawn in relation to the origin. By default the origin is always the left most visible value, which obviously changes when scrolling. To have a grid locked to specific values set a user defined origin:

    setUserDomainOrigin()    and    setUserRangeOrigin()
    

    now the grid and it's values will be calculated and drawn in relation to this User chosen origin and scroll along with the fixed origin.