Android – achart engine limits pan valid data points

I have an Android application that uses achart to create two charts. Line charts and bar charts. Each time the application runs, these graphs will be filled with additional data points. Therefore, after 10 runs, there will be enough data to cover the visible x-axis

What I want is to be able to pan the graph after the 11th use so that the user can see the historical data (back to the first data point). I have set it

    renderer.setPanEnabled(true, false);
    renderer.setZoomEnabled(false, false);
    renderer.setYAxisMin(0);
    renderer.setXAxisMin(0.5);
    renderer.setXAxisMax(10.5);
    renderer.setYAxisMax(100);

All this is good, but when I translate the data, I can translate to the - ve value on the x-axis and surpass the maximum data points I already have

I've tried to set up a panlistener, which I think is the way to go, but I'm just not sure what I should set in this listener to limit the translation to valid data points

Any ideas?

resolvent:

User panning only modifies the minimum and maximum values of the X axis. To avoid this, you must add a panlistener and reset these values

You can also set translation limits

renderer.setPanLimits(limits);

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>