Good day, i have a slight issue. i have created my own Labels on the Y-Axis with the following code below, but they are so clustered together, How can i space them out?.
Here is my code:
renderer.setYLabels(0);
//value_value is an array which would use as the labels for the y axis
int value_size = value_value.length;
int m = 0;
//int add = value_size/10;
int add = largest_size/10; // largest_size is the biggest value in the array value_value
for(int i=0; i< 10; i++){
if(m > value_value.length){
break;
}
renderer.addYTextLabel((double)i, value_value[m].toString(), 1);
m+=add;
}
P.S: from the api docs, there is a 3rd parameter “int scale” which i thought would help me space out the margins but i never seem to use it correctly. if i put any value there, i get a NullPointerException. What does it really do and how to use it?
Any help will be highly appreciated. Thank you.
My Graph:

Adding custom labels can be tricky because you always have to make sure you are not overlapping them. You should add only as many as needed to avoid overlapping. You can also listen for pan and zoom events and update the custom labels accordingly.
The
scaleparameter is useful when you have multiple Y axis scales. If you don’t have then you don’t need to use the parameter.