tl; dr È possibile effettuare questa operazione modificando il numero di etichette in onChartScale
.
In primo luogo, si vuole il vostro ascoltatore istituito:
chart.setOnChartGestureListener(this); // set a listener ;)
si tenta di ottenere il fondo disegnato valori/Top e verificare ciò che viene disegnato sullo schermo. Applica alcuni calcoli di base e sei pronto.
Il seguente codice trarrà 2 etichette se il livello di zoom diventa (anche) in alto e fino a 9 altrimenti:
@Override
public void onChartScale(MotionEvent me, float scaleX, float scaleY) {
final YAxis yAxis = mChart.getAxisLeft();
final Transformer transformer = mChart.getTransformer(YAxis.AxisDependency.LEFT);
// ...minor dirty hack
final PointD top = transformer.getValuesByTouchPoint(0, 0);
final PointD bottom = transformer.getValuesByTouchPoint(0, mChart.getHeight());
final int diff = (int)(top.y - bottom.y);
// draw 2-9 axis labels
final int count = Math.min(9, Math.max(diff, 2));
Log.d("scale", String.format("scale %f: diff %d and count %d", scaleY, diff, count));
// "force" the count, for there are drawing issues where none get drawn on high zoom levels (just try it out)
yAxis.setLabelCount(count, true);
}
// todo implement other interface methods
Il valore formattatore e tutto il resto rimane lo stesso.
E alcuni brutti screenshot per dimostrare che funziona: D

fonte
2015-11-09 20:14:39
impostato con il valore massimo per xey –
ritengo in IOS è risolto nell'ultima versione, con chart.getViewPortHandler(). setMaximumScaleX (4f); chart.getViewPortHandler(). SetMaximumScaleY (4f); Ma non funziona ancora in Android – rguerra