2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Dariusz Filipski - darekf How to put data to scriptlet? (JFreeCharts) 2003-06-30 07:27 Hello! I'm working on integration JasperReport with JFreeCharts - I want to create report with dinamic generated chart contains data from the report. I can do that using JFreeCharts as scriptlet. All data needed for chart generate I'm taking in afterDetailEval() and put into Vector scriptlet variables. I'm invoking scriptlet chart generating function In report "summary" section. It's working but I think it's very dirty solution. Is there any other way to insert report data to the scriptlet? Best regards Dariusz Filipski By: Giulio Toffoli - gt78 RE: How to put data to scriptlet? (JFreeCharts) 2003-06-30 09:55 I'm implementig for iReport a different way to generate charts. I think to generate a chart starting by a JRDataSource. The chart is incapsulated in a image report element that has as expression a call to a static method (that return an image) from a special class that I have named "ChartFactory". I.E.: ChartFactory public static java.awt.Image createChart(JRDataSource ds, int typeOfChart, int chartWidth, int chartHeight, String title, bool useLegend, String[] legendStrings,.... ....) This interface will use a kind of driver to use a low level JFreeChart or JCharts as charter engine. The development for this topics is still at experimental phase. Giulio By: Dariusz Filipski - darekf RE: How to put data to scriptlet? (JFreeCharts) 2003-06-30 22:55 I uderstand. But there you have to take data from database twice if you want to put both normal report and chart at one report. And you can't describe chart in report xml file. I prefer to generate report first (and take data from database while doing this) and after that generate chart (on the same data which i want to send from report to charting engine). It is possible to access all data gathered by report once (for example from predefined variable or sth like that)? Or I have to store data field-by-field like I'm doing it now? Best regards Dariusz Filipski By: Giulio Toffoli - gt78 RE: How to put data to scriptlet? (JFreeCharts) 2003-07-02 12:37 A good way could be implements a custom data source capable to store field yourself. At the right moment, you can traverse again your datasource from the interested record. This is just an idea, but I think that if the queries are simple and the charts one or two, make additional queries don't rapresents a relevant cost: I have tested it with reports contains lot of subreports that use exaxtly this concept (but this is just my opinion). A big cost in terms of time you have when you must open a connection, but if you can use an already opened connection, the game is played. Giulio By: Dariusz Filipski - darekf RE: How to put data to scriptlet? (JFreeCharts) 2003-07-03 04:32 Yes, I think like that too. I wan't to do my own dataset (derived from CategoryDataset for example) storing data in Vector variables. But now I'm not sure how should I do this (which methods should I write). Can you send me a sample from your code, please (priv: Dariusz.Filipski@comarch.pl)? Thank you for your help. Best regards Dariusz Filipski 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