Reputation: 26856
I'm drawing a time series chart with JFreeChart. The automated tickmark generation algorithm seems good; however it delivers more tickmarks than I want - about 15, where I really want 5-10.
Is there a way I can adjust the number of tickmarks that the standard algorithm generates? I don't want to have to explicitly set each tickmark, and the number of tickmarks doesn't have to exactly match the number I specify - more of a hint than a specific number.
Upvotes: 1
Views: 357
Reputation: 4477
There is nothing in the API to provide such a hint, the NumberAxis
class just tries to select a standard tick size that shows the largest number of tick marks without any of the labels overlapping. You could modify that behaviour by overriding the selectAutoTickUnit()
method in the NumberAxis
class.
If you don't want to modify the code, you could encourage less ticks to be displayed by increasing the insets for the tick labels with the setTickLabelInsets(RectangleInsets insets)
method.
Upvotes: 3