Is there any way to set no label for specifics values ?
I explain : I have a GraphView for which Y values cannot be higher than 3. And I only want verticals labels for the values 1, 2 and 3.
I tried to use the following method :
myGraph.getGraphViewStyle().setNumVerticalLabels(3);
But this one puts my labels for the Y values 0,1.5 and 3. This is not what I want.
Then I tried to set a custom label formatter. But the thing is I did not succeed in putting no values for the other labels.
Here is my current code :
myGraph.setCustomLabelFormatter(new CustomLabelFormatter() {
@Override
public String formatLabel(double value, boolean isValueX) {
if(!isValueX) {
String res = null;
if(value == 1.0) {
res = getString(R.string.my_label_1);
} else if(value == 2.0) {
res = getString(R.string.my_label_2);
} else if(value == 3.0) {
res = getString(R.string.my_label_3);
}
return res;
}
return null;
}
}
So I return null when I don't want to display the value but the library makes that when we return null, it puts the double value of the label. I tried to return an empty string or a string with blank spaces but it makes my app crashes.
Have you any idea about a way to do what I want ?
It would be great !
Thanks in advance ;)