Android: AChartEngine mRenderer.setPanLimits in dates

I have a line chart using the achartengine library. The x-axis has Dates. I need to set a minimum viewing date. How to do this if the x axis is made of objects Dateand setPanLimits is set to double?

    Date minDate = new GregorianCalendar(2008, 1, 01).getTime();
    Date maxDate = new GregorianCalendar(2008, 1, 30).getTime();
    // mRenderer.setPanLimits(new double[] { minX, maxX, minY, maxY});
    mRenderer.setPanLimits(new double[] { minX, maxX, 0, 1000});
    mRenderer.setZoomLimits(new double[] { minXe, maxX, 0, 1000 });

If I set the minimum x axis to 0, I cannot move the x axis at all, but it shows all the x values ​​in the field of view. I need to set a little less than x for min and a little more x for max, so that you can move the chart a little left and right

I found out that 3 days private static final double THREEDAYS = 81300000 *3;, but what about switching from a date to this double, so that I can subtract to get minX?

I hope you understand my question. thank

+3
source share
1 answer

This extends the viewing area to 3 days.

double THREEDAYS = 81300000 *3;
double minX = minDate.getTime() - THREEDAYS;
double maxX = maxDate.getTime() + THREEDAYS;

Hope this helps others.

+2
source

All Articles