Draw Y values as integers
Hey, I've added this library and it's superb. However, I am unable to display the Y values as integers. I can't get rid of the decimal(76 shows up as 76.0).
Also, is it possible to change the colour of a line between 2 points(entries) after the line passes a certain Y threshold.
Eg: I have a line from point 32(y axis) to 70(y axis) and back to 50(yaxis).The colour of the line once it crosses 60(my defined threshold) should change and when it dips back below 60 it should change back.
Hey I solved this by using my custom valueformater
class IntegerValueFormatter implements IValueFormatter { private DecimalFormat mFormat;
public IntegerValueFormatter() {
mFormat = new DecimalFormat("###,###,##0");
}
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
return mFormat.format(value);
}
}
On my LineData object I set this
LineData data = chart.getData(); data.setValueFormatter(new IntegerValueFormatter());