Android GraphView Library - Zoom and scroll not working in small X increments (seconds)

I am using the GraphView library (see or ). Working with GraphView-Demos-master, I am modifying the "public DateAsXAxis .." class to slightly increment the date in seconds rather than days. Scaling and scrolling do not work with seconds increments in the X-axis.

Calendar calendar = Calendar.getInstance();
Date d1 = calendar.getTime();
DataPoint[] datos = new DataPoint[50];
        for (int i=0; i<50; i++){
            datos[i]= new DataPoint(d1,i%4);
//            d1.setTime(d1.getTime() + 86400000); // 1 day works ok, but with some jumps in scale
            d1.setTime(d1.getTime() + 60000); // 1 min doesn't work scrolling not scaling.
        LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(datos);

    // set date label formatter
    graph.getGridLabelRenderer().setLabelFormatter(new DateAsXAxisLabelFormatter(getActivity()));
    graph.getGridLabelRenderer().setNumHorizontalLabels(3); // only 4 because of the space

    // set manual x bounds to have nice steps



source to share

All Articles