use of com.jjoe64.graphview.CustomLabelFormatter in project WordPress-Android by wordpress-mobile.
the class StatsBarGraph method setProperties.
private void setProperties() {
GraphViewStyle gStyle = getGraphViewStyle();
gStyle.setHorizontalLabelsIndexDependentColor(new HorizontalLabelsColor());
gStyle.setHorizontalLabelsColor(getResources().getColor(R.color.grey_darken_30));
gStyle.setVerticalLabelsColor(getResources().getColor(R.color.grey_darken_10));
gStyle.setTextSize(getResources().getDimensionPixelSize(R.dimen.text_sz_extra_small));
gStyle.setGridXColor(Color.TRANSPARENT);
gStyle.setGridYColor(getResources().getColor(R.color.grey_lighten_30));
gStyle.setNumVerticalLabels(3);
setCustomLabelFormatter(new CustomLabelFormatter() {
private NumberFormat numberFormatter;
@Override
public String formatLabel(double value, boolean isValueX) {
if (isValueX) {
return null;
}
if (numberFormatter == null) {
numberFormatter = NumberFormat.getNumberInstance();
numberFormatter.setMaximumFractionDigits(0);
}
return numberFormatter.format(value);
}
});
}
Aggregations