Jump to content
We've recently updated our Privacy Statement, available here ×

Integers rather than decimals in the value axe


bob007

Recommended Posts

 

Hi,

 

How to show only integers values in the value axe of bar chart. (no decimals )

ex: I want  0, 1, 2, 3, 4, 5  instead of  0, 0.5, 1, 1.5, 2, 2.5

 

Thank you,



Post Edited by bob007 at 05/01/2009 16:59
Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Like this:

                <barPlot>
                    <plot/>
                    <valueAxisFormat>
                        <axisFormat tickLabelMask="#"/>
                    </valueAxisFormat>
                </barPlot>
 

Link to comment
Share on other sites

  • 2 months later...

Apparently you need to have less tick marks on your axis.

In order to do that, you'll need iReport v3.1.4 or later. There are 2 possibilities to solve your problem:

  1. set the custom net.sf.jasperreports.chart.domain.axis.tick.interval and/or net.sf.jasperreports.chart.range.axis.tick.interval element properties to a numeric value representing the desired numeric interval between 2 consecutive tick marks on that axis.
  2. set the custom net.sf.jasperreports.chart.domain.axis.tick.count and/or net.sf.jasperreports.chart.range.axis.tick.count element properties to an integer value representing the desired number of ticks on that axis.

For more information, see

http://jasperreports.sourceforge.net/config.reference.html?group_id=252#net.sf.jasperreports.chart.domain.axis.tick.count

Hope this helps,

sanda

 

 




Post Edited by shertage at 07/16/2009 13:16

Link to comment
Share on other sites

  • 2 months later...

kehlers
Wrote:

I am having the same problem to display only integer values on the axis. Where do I set those properties? Also I see a "Range Axis Max Value Expression" when will this be evaluated? Can I set it to a value which is my max value + x? Thanks

These are custom report element properties, and are set in JRXML as below.

The range max value expression is evaluated at the moment given by the chart's evaluation time.

Regards,

Lucian

Code:
<barChart>	<chart evaluationTime="..">		<reportElement ..>			<property name="net.sf.jasperreports.chart.range.axis.tick.interval" value="10"/>		</reportElement>	</chart>	..
Link to comment
Share on other sites

  • 4 weeks later...
  • 4 years later...

Any solution to this problem ??? Has anyone solved it ?? I have tried setting these properties from my code but its not working.

       parameters.put(DefaultChartTheme.PROPERTY_RANGE_AXIS_INTEGER_UNIT, true);
       parameters.put(DefaultChartTheme.PROPERTY_DOMAIN_AXIS_TICK_INTERVAL, 10);

Anything is missing ??? or Am I forgetting anything?? I have assumed that these parameters will be already there in Jasper (or Do I need to create them ??!!).

 

Link to comment
Share on other sites

net.sf.jasperreports.chart.range.axis.integer.unit

Flag property enabling the JFreeCharts engine to use integer tick units on a range value axis. If set to true, it will take precedence over the net.sf.jasperreports.chart.range.axis.tick.interval and net.sf.jasperreports.chart.range.axis.tick.count properties.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...