ESala
ESala

Reputation: 7058

JasperReports Chart category ticks stack over each other

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

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?

Upvotes: 1

Views: 3697

Answers (2)

Sharad
Sharad

Reputation: 3548

You can add the additional properties of chart through property of the chart.

To add additional properties like tick interval , select the element on which you want to add the property and select the “Properties expression” in Property Pane.

enter image description here

Once you click on Properties expression click on “Add” button, you will get “Add/modify property” window.

enter image description here

Just add the Property name that you want to use as in the above screen shot in this report I am using tick interval property and trying to set the tick intervals for value axis.

      net.sf.jasperreports.chart.range.axis.tick.interval

Property specifying the interval between 2 consecutive ticks on a range value axis. If the net.sf.jasperreports.chart.range.axis.tick.count property is set, this interval will be neglected. If it is not set, the JFreeCharts engine will use its own defaults to instantiate the axis. By default, it is not set.

Full list of Properties A very large set of special properties are now available in the current version. Over the upgrade history, many new properties have enriched the list.

The full API is available at http://jasperreports.sourceforge.net/config.reference.html and http://jasperreports.sourceforge.net/api/index.html.

You can see the full post :- here

Upvotes: 1

ESala
ESala

Reputation: 7058

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.

Upvotes: 0

Related Questions