Search code examples
javajasper-reportsireport

JasperReports Chart category ticks stack over each other


I am trying to plot an AreaChart with JasperReports, which has the following structure:

  • 3 series
  • 100 points per serie
  • category is just numbers 1, 2, 3 ... 100

My issue is with the category ticks, since there are 100 points I get the following result:

 -------------------------------------------------------
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20...

but the ticks are so close they overlap, so what I would like to do is skipping ticks, like so:

 --------------------------------------------------------------
                 10                 20               30...

I want to display just 1 tick for every 10, is this possible?


Solution

  • Solved it... just had to use a XY Chart instead of an AreaChart.

    Finally I discovered that an AreaChart always plots a point for each category, so if you use it with series with lots of points per serie (more than 50), your category ticks will overlap.

    Solution: switch to XY Chart for large collections with numeric categories, and all the category ticks will generate automatically to fit the space available.