badbishop
badbishop

Reputation: 1648

Jasperreports: how to set axis interval?

I've got a simple task at hand: to plot integer-integer value pairs using line chart or XY chart or whatever using bean type of datasource. The bean in question returns long value both for X and Y axis. The default behavior one would expect is to show ticks of 1, 2, 3, 4, etc. on both axis.

But no, I get values like 2.5 or 1E1 for the same application running on two different machines! OK, this old post suggests to set tickLabelMask to "#". Now integers are indeed displayed, but with repeating values, like 0, 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, etc. The same post suggests I add two properties to my report,

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

Unfortunately, these have no effect when added at report level in JRXML file. When I try to add them at chart level between <reportElement ..> tags, Jaspersoft Studio removes them once I save the file. So, I take it , something has changed.

So, how could I fix this issue?

I'm using Jaspersoft Studio 6.9.0 and Jasperreports 6.6.0

Upvotes: 2

Views: 2649

Answers (1)

badbishop
badbishop

Reputation: 1648

Nowadays it's done using "Chart customizers". General info can be found here. To put it short, in design view select the chart, go to Properties window, select "Chart" there, scroll down to "Chart customizers" section, click "Add", and the choose range and tick customizer.

Additional artifact must be included into your project: jasperreports-chart-customizers

Upvotes: 1

Related Questions