pawel_r Posted September 11, 2009 Share Posted September 11, 2009 HiI am using grouping in order to put my data into 2 categories, but on the chart I would like to have also additional category, wich sums the values of two prevoius. Can it be done with jasperreports or I simply need to fetch additional field from database RegardsPaweł Link to comment Share on other sites More sharing options...
mdahlman Posted September 14, 2009 Share Posted September 14, 2009 Paweł, I personally find it easier in most cases to perform the calculation in the SQL and return the extra value. But it's also possible to create a variable in the report and use this variable in the chart. The end result should be the same. If you are new to variables, I recommend to start with just printing the values of the fields and the variables in a simple tabular report. Make sure you have the values that you expect. After confirming this, then put the variable into the chart. Regards,Matt Link to comment Share on other sites More sharing options...
pawel_r Posted September 14, 2009 Author Share Posted September 14, 2009 Thanks MattHowever I think you misunderstood my question a little. Yes, generally I know how to use variables in jasperreport. The problem is that I don't see a way how my data can fall into 2 categories at ones (like "Car", "Truck", "All vehicles" - any car is an vehicle and any truck is an vehicle, so on the chart the "all vehicles" category would sum up the values of two previous). I know how to put those data on separate charts - but I would like to get it at single chart as additional category.(Writing this post I just realized I could change my chart and use series for this aim -however I am already using series for another king of grouping) Link to comment Share on other sites More sharing options...
lucianc Posted September 22, 2009 Share Posted September 22, 2009 If the report structure allows it, you can try to create a new group to sum the vehicle values, and add a new category series using the sum variable as value. The value will be fed multilple times to the chart, but if we're lucky the last (final) value will be used in the chart.Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now