Question: The number of tick marks is so high that they overlap/are truncated, and it is impossible to read them! What can I do?Answer:
The tick marks or "tick labels" are created by the axis. Axes that extend
ValueAxis (
DateAxis,
NumberAxis,
LogAxis...) will by default show the labels for as many ticks as possible without tick label overlap. A
CategoryAxis will create a label for each unique column key in the respective
CategoryDataset.
If your are dealing with overlappig tick marks, you have probably used a
CategoryPlot with a CategoryDataset which has a too large number of column keys. Check whether the Comparable instances that you use as column keys are in fact Numbers or Dates. If that is the case, switch to an
XYSeriesCollection or
TimeSeriesCollection, and build an
XYPlot. The ChartFactory contains a number of static methods to create those plots.
If you really need to use a CategoryDataset with a large number of column keys, you can try to wrap that in a
SlidingCategoryDataset and expose only a subset of the original dataset to the plot at a time.
If this is not an option as well, you should hide the (useless) tick marks completely (axis.setTickLabelsVisible(false)). In a desktop enviroment (Swing GUI), you can still make the column keys visible by assigning a suitable
CategoryToolTipGenerator to the renderer. You will probably want to show the column keys as tool tip. Check
StandardCategoryToolTipGenerator as an example.