Jump to content

How to move a summary Pie Chart on first page?


partizan1

Recommended Posts

Hi,

Does anyone know if it's possible to have a summary pie chart as the first page of a report (right before the Detail band)? I'm trying to use a subreport to do that, but my pie chart doesn't show.

 

You advice is appreciated!

- Partizan



Post Edited by partizan1 at 06/02/2010 15:36



Post Edited by partizan1 at 06/02/2010 15:36
Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Try this

1. Set up a group in your main report. I call the group graph.

2. Do not group you graph value on anything

3. Put a reference to your subreport in the graph group header

4. Set the print when expression in the graph group band to

new Boolean(($V{PAGE_NUMBER}).intValue() == 1 )

 

Link to comment
Share on other sites

Thanks Svenn for your advice. I'll definitely try it. Until I can actuall try your suggestion I need to successfully start feeding my subreport with data from the parent.

I find it very challenging in my case, because our application is using a custom JRDataSource. I have specified in my parent report, for the subreport element, that the 'Data Source Expression' should use 'new my.data.source.CustomJasperDataSource()'. I know that I can't use an empty constuctor since I need to feed the subreport with data. However, I can't simply pass a field or a parameter in because my CustomJasperDataSource() takes in our own data structure (datagroup). My question is how can I pass from the parent report to the subreport our custom data structure so that the subreport can make use of? Is it possible to have a parameter to  represent my custom 'datagroup', so that I can pass in that parameter in the CustomJasperDataSource()? 

That is, I need to do something like this for 'Data Source Expression' value 'new my.data.source.CustomJasperDataSource(datagroup)' where the datagroup is not currently represented in the parent report by anything. Our application is using xml files that define the datagroup and the CustomJasperDataSource() is making use of it programmatically.

I'm very confused as to how I can pass a custom data stucture i.e. datagroup from the parent report down to the subreport so that the subreport can use the data from it to print the report.

 

Please I need your help.

Thanks,

partizan

Link to comment
Share on other sites

Hi again,

I think I found a close solution. Can you please tell me if that's the way to go. I had to use in the 'Data Source Expression' of my subreport element in the parent report the value '(my.data.source.CustomJasperDataSource) $P{REPORT_DATA_SOURCE}'. It may work just fine without the casting. I'm generating a summary chart so I'll be using its data only once (iReport guide suggests that REPORT_DATA_SOURCE should never be used more than once in a subreport).

 

I tried your solution above, but it didn't work together with my way of feeding the subreport. That is, the chart is displayed on the top of the report, however only one row is printed in the parent Detail band, and not all.

 Do you know how I can display all of the rows in the parent Detail band?

 

Thanks,

Partizan



Post Edited by partizan1 at 06/03/2010 17:31
Link to comment
Share on other sites

You know Giulio...this is what I've been missing the whole time!

The documentation I read on was saying that I should always put my chart in the Summary band, so I did. And I was trying to use subreports to get the chart displaying where I wanted.

Well, now it works the way I needed to. Thank you so much Giulio!

Also thanks to Svenn, because your solution works great with Giulio's recommendation, and both gave me what I needed!

 

Thanks guys! I really appreciate it!

Partizan

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