I have the following code:
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
int intValue = (int) value;
int xVal = intValue / 120 / 12;
if (xVal > prevXVal) {
prevXVal = xVal;
return ConvertUnits.toString(xVal);
} else {
return "";
}
}
});
For some unknown reason, no values are being displayed on the XAxis. I initialize prevXVal
to 0, and if I remove the if statement I can see that the values on the X axis are correct. I basically want to remove repeated values from the X axis and only display the values when xVal
changes. I'm not sure why this code wouldn't work, since I don't see how the if statement would always be false considering when I remove it I see the values changing.
Does anyone know what I am doing wrong?