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

showing multiple charts together in a report


anupfrancis

Recommended Posts

I want to know whether it is possible to display two or more graph details in a single chart. To be more precise, graphs which will share the x-axis but y-axis will be different for both. suppose a bar graph and a line graph have to be displayed in the same chart.

 

both will have the same x-axis value expression but different y-axis value expressions.

I want know whether it is possible using the features of ireport to design such a jrxml.

 

Will try to get an image of chart which meets my requirements and upload it asap.

 

I believe JFreechart API supports it. But what i want to know is whether ireport helps us in designing such a report.

 

Any help in this regard will be appreciated.

 

given below is one specific case of using multiple graphs in a single chart. If anybody has coded to achieve something like this please mail it to me.

(i hope the image has been uploaded)

 

size=386]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/ParetoChartDemo-ee26bb874fd1c92a06cd82e33ada3f47.png

Post edited by: anupfrancis, at: 2006/07/27 12:58

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Yes you can do this, what you need to do is write a customizer class for your chart. So what you have to do is build out the bar chart, then write the customizer class, in the class add in the second axis and the data for that axis, then send back the JFreeChart object and iReport will compile it fine. There is a small amount of information regarding how to hook that up in the manual.

 

Nate

Link to comment
Share on other sites

Thanks for the info you have provided about how to resolve my issue. I already have extended the jrAbstractChartCustomizer class to achieve different coloring for the different bands in the charts. Anyways, i will try out what you have mentioned.

 

The real issue is that i have to provide a GUI interface as a plugin to allow the user to do this if iReport doesn't already support it.

 

The reason why it has to be a plugin is that i can't expect a customer to manually write a customizer class when he wants to club together some graphs.

 

The issue is actually more generic than the specific scenario which i had mentioned before. I had used an example of bar and line graph clubbed together in the same chart. It could be actually any two types of graph

which the user may want to put together.

 

I don't have the manual right now. Our company is in the process of obtaining a commercial license. So getting a manual could take sometime. So if possible send me the small information regarding how to hook that up in the manual.

 

Also, please do send me any code samples of how this can be achieved,

if possible.

 

my email id is anup.francis@gmail.com

Post edited by: anupfrancis, at: 2006/07/27 12:51

Link to comment
Share on other sites

...then write the customizer class, in the class add in the second axis and the data for that axis

 

hello,

the question is, after I write the customizer class, how do I get the data for the second axis. The whole report is started from the IReport and for me its the only source of data for the report. My cust. class is called from the IReport so how do I get this data for the second axis?

 

regards

Marcin

Link to comment
Share on other sites

  • 6 months later...

Hi

This is Atanu. I am very new in ireport and also in java environment. In the ireport I have designed a template .like this.

please look on attach file

size=150C:Documents and SettingsAtanuMy Documentsgraph.jpeg[/img]

Now I want to plot a line graph on the basis of the each data like t1 t2 ---t5 and lcl, ucl, actual value for each row.

That I have done. Now my problem is that I have to change the color of points of t1 t2 ---t5 on the basis of Lcl and Ucl . If the value of t1 ,or t2 or ----t5 are between Ucl and Lcl the color will be blue. And if it out side of Lcl and Ucl then it will be red..

I want the following figure. Where the upper bold line is Ucl and lower bold line isLcl

size=150C:Documents and SettingsAtanuMy Documentsdata.jpeg[/img]

Actually I have got a information that for that I have to write a customizer class for chart. Also I have write it .

 

Code:

import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JREmptyDataSource;
import java.util.*;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
import javax.sql.*;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.*;
import org.jfree.chart.renderer.*;
import org.jfree.chart.ChartRenderingInfo;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.LevelRenderer;
import org.jfree.chart.renderer.category.LayeredBarRenderer;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import java.lang.String;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRChartPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.axis.CategoryLabelPositions;


import org.jfree.chart.renderer.category.LineRenderer3D;
import java.awt.*;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartCustomizer;
import org.jfree.chart.JFreeChart;
import net.sf.jasperreports.engine.*;
import java.awt.Color;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartCustomizer;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import java.lang.Object;



public class LineChartCustomizer extends JRAbstractChartCustomizer {

public void customize(JFreeChart chart, JRChart jasperChart) {

LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer();


renderer.setSeriesPaint(1, Color.green);
renderer.setSeriesPaint(4, Color.orange);

chart.setTitle("Setting the title "«»);
}


}

Now this customize class ok running successfully with creating jar files.

Now I want to create a logic to check the value of t1 t2 t3 t5 with respect to UCL and LCL. How can I fetch data from report.

Or is there any other way to do this.

Is there any way to pass value from iReport to customizer class ?

 

What should I do. Please please help me. It’s urget for me.

 

Any help would be greatly appreciated.

Thanks in advance.

[file name=query-37ab101e3a539a71be9c962f72749d92.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-37ab101e3a539a71be9c962f72749d92.doc[/file]

[file name=query-dbe8d650ab388f1df8827b2cf1b2c701.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-dbe8d650ab388f1df8827b2cf1b2c701.doc[/file]

Link to comment
Share on other sites

Hi

This is Atanu. I am very new in ireport and also in java environment. In the ireport I have designed a template .like this.

please look on attach file

size=150C:Documents and SettingsAtanuMy Documentsgraph.jpeg[/img]

Now I want to plot a line graph on the basis of the each data like t1 t2 ---t5 and lcl, ucl, actual value for each row.

That I have done. Now my problem is that I have to change the color of points of t1 t2 ---t5 on the basis of Lcl and Ucl . If the value of t1 ,or t2 or ----t5 are between Ucl and Lcl the color will be blue. And if it out side of Lcl and Ucl then it will be red..

I want the following figure. Where the upper bold line is Ucl and lower bold line isLcl

size=150C:Documents and SettingsAtanuMy Documentsdata.jpeg[/img]

Actually I have got a information that for that I have to write a customizer class for chart. Also I have write it .

 

Code:

import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.JREmptyDataSource;
import java.util.*;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
import net.sf.jasperreports.engine.JRAbstractChartCustomizer;
import javax.sql.*;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.*;
import org.jfree.chart.renderer.*;
import org.jfree.chart.ChartRenderingInfo;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.category.LevelRenderer;
import org.jfree.chart.renderer.category.LayeredBarRenderer;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import java.lang.String;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRChartPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.chart.renderer.category.LineAndShapeRenderer;
import org.jfree.chart.axis.CategoryLabelPositions;


import org.jfree.chart.renderer.category.LineRenderer3D;
import java.awt.*;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartCustomizer;
import org.jfree.chart.JFreeChart;
import net.sf.jasperreports.engine.*;
import java.awt.Color;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartCustomizer;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.renderer.category.BarRenderer3D;
import java.lang.Object;



public class LineChartCustomizer extends JRAbstractChartCustomizer {

public void customize(JFreeChart chart, JRChart jasperChart) {

LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer();


renderer.setSeriesPaint(1, Color.green);
renderer.setSeriesPaint(4, Color.orange);

chart.setTitle("Setting the title "«»);
}


}

Now this customize class ok running successfully with creating jar files.

Now I want to create a logic to check the value of t1 t2 t3 t5 with respect to UCL and LCL. How can I fetch data from report.

Or is there any other way to do this.

Is there any way to pass value from iReport to customizer class ?

 

What should I do. Please please help me. It’s urget for me.

 

Any help would be greatly appreciated.

Thanks in advance.

[file name=query-37ab101e3a539a71be9c962f72749d92.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-37ab101e3a539a71be9c962f72749d92.doc[/file]

[file name=query-17c75ceafc23f4185621a5dfb15f6fdf.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-17c75ceafc23f4185621a5dfb15f6fdf.doc[/file]

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