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

parameterize chart height & no data chart


Recommended Posts

By: cnrep - cnrep

parameterize chart height & no data chart

2006-03-15 07:36

Hi,

 

1. Is it possible to parameterize chart height and width?

 

My scenario is like this. User specifies height and width of charts through URL query string. These values will be passed into jrxml through report predefined parameters. The chart image should be generated with this height/width values.

 

2. No data charts

Is it possible to generate empty chart with zero data values when query returns no records? By "empty chart" I mean all the chart sections, axes, legend etc visible.

 

The "WhenNoDataType=AllSectionsNoDetail" option entirely hides the chart.

 

Though there are a lot of similar posts, I couldn't find definite answers. So help in any form would be greatly appreciated.

 

I am using 1.2.0 vesion.

 

Thanks in advance

cnrep

 

 

 

 

By: Manfred Moser - mosabua

RE: parameterize chart height & no data chart

2006-03-15 08:38

Hi!

 

I am not sure about chart behaviour but as far as I understand they end up as images and would therefore behave similarilly. In order to get dynamic image size you have to set the image size in the JasperDesign, compile the report and then fill it.

 

That only works for parameters though. If you have an array of images you want to display as a list and they have different sizes you are in trouble. There is currently no option that allows for the image to occupy just its size. Only text fields adjust dynamically at the moment.

 

I have created a feature request to get this done for images. Check it out here

https://sourceforge.net/tracker/index.php?func=detail&aid=1306255&group_id=36382&atid=416706

and leave a comment that this would be useful.

 

manfred

 

 

By: Kip Yeackley - yeackley

RE: parameterize chart height & no data chart

2006-03-15 17:03

Hello,

 

Although it doesn't directly solve the limitations and constraints already discussed, one possible approach might be to use a set of predefined and preset sized chart elements in combination with the use of print when expressions that are driven by a report parameter.

 

For example you could have a small, medium, and large sized chart element on the report each of which are configured identically. Then using a ChartSize report parameter value of "Small", "Medium", or "Large" render the appropriate one using print when expressions such as this: new Boolean($P{ChartSize}.equals("Large"))

 

Now the biggest limitation with this is that you still have to predefine the chart sizes absolutely and have to maintain multiple objects, but it does give the appearance of a little bit of user control over the sizing. Another thing to keep in mind with this approach is that you still have to account for the handling of the whitespace, or band size used when rendering these charts which will often be dictated by the specifications of the "Large" chart element and may lead to challenges with the smaller ones.

 

Similarly you can handle situations of no data for charts, but you would want to create a seperate instance of the chart element that is configured with the options you want (legend, etc.), but not mapped to any data fields since there won't be any returned anyway. Then again with some clever use of print when expressions you could detect the no data situation and choose to show this "blank" chart as long as it wasn't in the detail band which is not rendered when there is no data.

 

I hope the helps.

 

 

By: Manfred Moser - mosabua

RE: parameterize chart height & no data chart

2006-03-16 09:37

I have used this approach in situations where there is only a few choices and it works fine. It is a bit of a pain to maintain the design files though. And once you get to user input with more choices you are doomed and that won't work ;-)

Link to comment
Share on other sites

  • 2 years later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

teamireport
Wrote:

HI All, I want to know how you guys achieved resizing the chart height and widht using parameter. How you pass the parameter value to jrxml? Can someone tell the way to do with sample example?

Setting element height and width via parameters is not possible.  The only solution is to alter the report design programmatically before running the report.

Regards,

Lucian

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...