By: mslepak - mslepak
Bar3DChart font size - please help
2006-07-10 11:32
I will appreciate any help on how to change font on Bar3DChart. It seems like the only element that might possibly affect the font size (of labels, etc.) on the Bar3DChart is the style attribute of the reportElement under chart. However, it doesn't work for me.
By: bpatel@exitrealty.com - bpatel96
RE: Bar3DChart font size - please help
2006-07-10 12:47
Its good to learn jfree chart . it comes with the manual which is really good for customization for now you can a class in same directory as jasper file .
I did this with piechart
public class HSrptCustomChart implements JRChartCustomizer {
public void customize(JFreeChart jFreeChart, JRChart jRChart) {
PiePlot plot = (PiePlot) jFreeChart.getPlot();
plot.setSectionPaint(0, new java.awt.Color(160, 160, 255));
plot.setSectionPaint(1, new java.awt.Color(128, 128, 255 - 32));
plot.setSectionPaint(2, new java.awt.Color(96, 96, 255 - 64));
}
}
Bar3DChart font size - please help
2006-07-10 11:32
I will appreciate any help on how to change font on Bar3DChart. It seems like the only element that might possibly affect the font size (of labels, etc.) on the Bar3DChart is the style attribute of the reportElement under chart. However, it doesn't work for me.
By: bpatel@exitrealty.com - bpatel96
RE: Bar3DChart font size - please help
2006-07-10 12:47
Its good to learn jfree chart . it comes with the manual which is really good for customization for now you can a class in same directory as jasper file .
I did this with piechart
public class HSrptCustomChart implements JRChartCustomizer {
public void customize(JFreeChart jFreeChart, JRChart jRChart) {
PiePlot plot = (PiePlot) jFreeChart.getPlot();
plot.setSectionPaint(0, new java.awt.Color(160, 160, 255));
plot.setSectionPaint(1, new java.awt.Color(128, 128, 255 - 32));
plot.setSectionPaint(2, new java.awt.Color(96, 96, 255 - 64));
}
}
1 Answer:
Posted on February 6, 2007 at 10:50am
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
[img size=150]C:\Documents and Settings\Atanu\My Documents\graph.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
[img size=150]C:\Documents and Settings\Atanu\My Documents\data.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 .
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
[img size=150]C:\Documents and Settings\Atanu\My Documents\graph.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
[img size=150]C:\Documents and Settings\Atanu\My Documents\data.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: |
<br /> import net.sf.jasperreports.engine.*;<br /> import net.sf.jasperreports.view.JasperViewer;<br /> import net.sf.jasperreports.engine.JREmptyDataSource;<br /> import java.util.*;<br /> import java.sql.DriverManager;<br /> import java.sql.Connection;<br /> import java.sql.SQLException;<br /> import net.sf.jasperreports.engine.JRAbstractChartCustomizer;<br /> import javax.sql.*;<br /> import org.jfree.chart.axis.CategoryAxis;<br /> import org.jfree.chart.plot.CategoryPlot;<br /> import org.jfree.chart.renderer.category.*;<br /> import org.jfree.chart.renderer.*;<br /> import org.jfree.chart.ChartRenderingInfo;<br /> import org.jfree.chart.renderer.category.BarRenderer;<br /> import org.jfree.chart.renderer.category.LevelRenderer;<br /> import org.jfree.chart.renderer.category.LayeredBarRenderer;<br /> import java.sql.DriverManager;<br /> import java.sql.SQLException;<br /> import java.sql.Connection;<br /> import java.util.HashMap;<br /> import java.util.Map;<br /> import java.lang.String;<br /> import net.sf.jasperreports.engine.JRException;<br /> import net.sf.jasperreports.engine.JasperExportManager;<br /> import net.sf.jasperreports.view.JasperViewer;<br /> import net.sf.jasperreports.engine.xml.JRXmlLoader;<br /> import net.sf.jasperreports.engine.JasperCompileManager;<br /> import net.sf.jasperreports.engine.JasperFillManager;<br /> import net.sf.jasperreports.engine.JasperPrint;<br /> import net.sf.jasperreports.engine.design.JasperDesign;<br /> import net.sf.jasperreports.engine.JasperReport;<br /> import net.sf.jasperreports.engine.JRChartDataset; <br /> import net.sf.jasperreports.engine.JRChartPlot; <br /> import org.jfree.chart.renderer.category.BarRenderer3D; <br /> import org.jfree.chart.renderer.category.LineAndShapeRenderer;<br /> import org.jfree.chart.axis.CategoryLabelPositions;<br /> <br /> <br /> import org.jfree.chart.renderer.category.LineRenderer3D;<br /> import java.awt.*;<br /> import net.sf.jasperreports.engine.JRChart;<br /> import net.sf.jasperreports.engine.JRChartCustomizer;<br /> import org.jfree.chart.JFreeChart;<br /> import net.sf.jasperreports.engine.*;<br /> import java.awt.Color;<br /> import net.sf.jasperreports.engine.JRChart;<br /> import net.sf.jasperreports.engine.JRChartCustomizer;<br /> <br /> import org.jfree.chart.JFreeChart;<br /> import org.jfree.chart.axis.CategoryAxis;<br /> import org.jfree.chart.axis.CategoryLabelPositions;<br /> import org.jfree.chart.plot.CategoryPlot;<br /> import org.jfree.chart.renderer.category.BarRenderer3D;<br /> import java.lang.Object;<br /> <br /> <br /> <br /> public class LineChartCustomizer extends JRAbstractChartCustomizer {<br /> <br /> public void customize(JFreeChart chart, JRChart jasperChart) {<br /> <br /> LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer(); <br /> <br /> <br /> renderer.setSeriesPaint(1, Color.green); <br /> renderer.setSeriesPaint(4, Color.orange); <br /> <br /> chart.setTitle("Setting the title "«»); <br /> } <br /> <br /> <br /> }<br /> </td></tr></tbody></table><br /> Now this customize class ok running successfully with creating jar files.<br /> 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.<br /> Or is there any other way to do this.<br /> Is there any way to pass value from iReport to customizer class ?<br /> <br /> What should I do. Please please help me. It’s urget for me.<br /> <br /> Any help would be greatly appreciated. <br /> Thanks in advance.<br /> [file name=query-37ab101e3a539a71be9c962f72749d92.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-37ab101e3a539a71be9c962f72749d92.doc[/file]<br /> [file name=query-53f6e49791657a60c8095f8d0a2c4077.doc size=49152]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/query-53f6e49791657a60c8095f8d0a2c4077.doc[/file] |