javaandroidandroid-graphview

Display all values on X-axis android studio


I have implemented a line graph using graphview in my app that allows the user to input data daily and records it by the date, but I am having an issue to display all the values on the x-axis. I used this line of to separate the blocks weightGraph.getGridLabelRenderer().setNumHorizontalLabels(5); and then looks like the image below where the values are overlapping each other. enter image description here

and if I change the value of 5 to 3 in this codeweightGraph.getGridLabelRenderer().setNumHorizontalLabels(3); then it does not display all the values like the picture below.

enter image description here

Is there any other way to display it so all the x-axis values are visible, with it overlapping.


Solution

  • You can show vertical (or at least at an angle) using .setHorizontalLabelsAngle(90);