Add Space Between Graph And Tick Labels In Graphview?
I am trying out the GraphView Library for creating charts on Android. It looks quite decent, but I am wondering if there is a way to add some space between the tick labels and the
Solution 1:
yes it is possible in the current version in github (will be released in 4.0.1). There is the method:
graph.getGridLabelRenderer().setLabelsSpace(x)
Solution 2:
Follow this example to give your graph a custom label formatter. By doing so, you can at least add space padding to your y-axis labels (if not newline spacing to your x-axis labels).
// GraphView 4.x
graph.getGridLabelRenderer().setLabelFormatter(
newDefaultLabelFormatter() {
@OverridepublicStringformatLabel(double value, boolean isValueX) {
if (isValueX) {
// show normal x valuesreturnsuper.formatLabel(value, isValueX);
} else {
// show currency for y valuesreturnsuper.formatLabel(value, isValueX) + " €";
}
}
}
);
I pulled this example from the GraphView documentation.
Otherwise, I found it interesting that someone chose this answer as the best response for a similar question.
Post a Comment for "Add Space Between Graph And Tick Labels In Graphview?"