Reputation: 21
I created a line chart that displays time every 10 minutes on the x-axis. The data can be for a month long, so the x-axis labels are blended together (unreadable). Also, the grid lines are too close together. I need to figure out how to hide the x-axis chart labels and grid lines and create custom labels and grid lines to only show every hour (or maybe every month if I need to display the graph for a 6 month period). Currently, the x-axis labels are date time format. If 24 hour period is graphed, I need to only show the time every hour. If more than 1 month is graphed, I need to show the date.
Upvotes: 2
Views: 6180
Reputation: 2778
The 10-minute ticks are way to much to display, instead you should either:
setAutoRange()
to true
TickUnit
.For dates and time go check out DateTickUnit, and for numbers in general it is NumberTickUnit
If you can determine what range is displayed, it is only a matter of creating the correct DateTickUnit
. If it for example is hours:
numberAxis.setTickUnit(new DateTickUnit(DateTickUnitType.HOUR, 1));
The gridlines you mention will be the same place as the tick marks so this should solve both problems.
Upvotes: 1
Reputation: 205785
Note that a month's data is 6 * 24 * 30 = 4320; that's too many values to view with much precision, and 6 moths is worse. As an alternative, you can slide or page the data set. The default axis labels should adjust automatically. If you have problems, please post an sscce.
Upvotes: 1