Jump to content
JasperReports Library 7.0 is now available ×

adding non query data to chart dataset


rja3

Recommended Posts

I am using the chart functionality in version 1.2.8

 

Here is my issue.

 

I am using JFreeChart in two places:

1) Jasper to produce a full report containing the chart

2) jfreechart alone to produce thumbnails for a view

 

Both initially plot data from the same query.

 

However there are a number of other data series in the chart that are calculated (rather than coming from the database).

 

To avoid duplication of code, I want to use the same classes for both places.

 

This is simple in the case where I just use jfreechart. I create a series from the query and add it to the dataset. Then I pass that dataset to a utility class that adds the additional calculated series. Finally, the chart is created using the combined dataset.

 

Using Jasper seems a bit more complicated. I am using the chart properties to assign the series expression and value expressions from the fields in the query. Jasper takes care of creating the chart from there.

 

Is there any point in the flow when I can intervene and add additional series to the dataset before the chart is produced? It does not seem that you can do this in the customizer class. The chart does not seem to know its dataset.

 

I was going to just create all the series in the query, but others don't like this option.

 

In older versions we used to use afterdetail in a Scriptlet to build the dataset and then create the chart, rendering an image to the report. Would it make sense to go back to this older technique?

 

Any ideas?

Link to comment
Share on other sites

  • 7 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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