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

silvi

Members
  • Posts

    28
  • Joined

  • Last visited

silvi's Achievements

Contributor

Contributor (5/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Here you go... import java.awt.Color; import net.sf.jasperreports.engine.JRChart; import net.sf.jasperreports.engine.JRChartCustomizer; import org.jfree.chart.JFreeChart; import org.jfree.data.category.*; import org.jfree.chart.renderer.category.*; import java.util.HashMap; public class StackedChartCustomizer implements JRChartCustomizer { public static HashMap<String,Color> engGroupColor = new HashMap<String, Color>(); static { engGroupColor.put("A", new Color(0xE4, 0x1B, 0x1B)); engGroupColor.put("B", new Color(0xF1, 0xAB, 0x10)); } public void customize(JFreeChart chart, JRChart jasperChart) { // Category Plot: most commonly used to display bar chart // BarRenderer: create bar charts from data in a category dataset BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); // Method required for reading the dataset. // Table of values that can be accessed using row and column keys. CategoryDataset cd = chart.getCategoryPlot().getDataset(); // Row gives the series expression int rc = cd.getRowCount(); for (int i = 0; i < rc; i++) { String egName = cd.getRowKey(i).toString(); Color color = engGroupColor.get(egName); if (color == null) { color = newUniqueColor(); engGroupColor.put(egName, color); } renderer.setSeriesPaint(i, color); } } private Color newUniqueColor() { // just return black for now - later some code to generate a // unique color not already used return Color.BLACK; } }
  2. Please, can someone tell me, how can we specify the class path on server ??? I did lot of reading and surfing but have not found anything.
  3. Hello all, I have a report with parameters using customized class. Report is working fine in i-report and jasper server reporsitory plugin too. I have added my .jar file that contains the class in "Add resources" section of server. But when I am running its throwing me an error saying "Error evaluating expression $P{dateUtils}.getEndDate( $P{DateChoice}, $P{Time_Interval}, $P{InputDate})". In the parameter I have specified the class which is com.redhat.eng.JasperDateUtils. <parameter name="dateUtils" class="com.redhat.eng.JasperDateUtils" isForPrompting="false"> <defaultValueExpression><![CDATA[com.redhat.eng.JasperDateUtils.getInstance()]]></defaultValueExpression> </parameter> <parameter name="endDate" class="java.util.Date" isForPrompting="false"> <defaultValueExpression><![CDATA[$P{dateUtils}.getEndDate( $P{DateChoice}, $P{Time_Interval}, $P{InputDate})]]></defaultValueExpression> </parameter> I am wondering why is it not working in japser server. Most probably, it is not able to get the classpath. Please help...
  4. Hi everyone, I have solved my problem. If anyone needs the code, feel free to aske me.
  5. I want to have the stacked bar chart colors based upon their series values . Like for "A" -- red "B" --- yellow "C" --- green As I am a beginner in creating jasper class, I tried my best and came up with this code.. public class BarColors extends JRAbstractChartCustomizer implements JRChartCustomizer { public class CustomBarRenderer extends BarRenderer { public CustomBarRenderer() { super(); } public Paint getItemPaint(int row, int column) { CategoryDataset cd = getPlot().getDataset(); if (cd != null) { String l_rowKey = (String)cd.getRowKey(row); String l_colKey = (String)cd.getColumnKey(column); double result = cd.getValue(l_rowKey, l_colKey).doubleValue(); String eg = Double.toString(result); if (eg.equals("A")) { new Color(0xE4, 0x1B, 0x1B); } else if (eg.equals("B")) {new Color(0xF1, 0xAB, 0x10); } else if (eg.equals("C")) { new Color(0xEF, 0xC3, 0x5A); } else if (eg.equals("D")) {new Color(0x0B, 0x2E, 0xF0);} else { } } return (Paint)cd; } } public void customize(JFreeChart chart, JRChart jasperchart) { // get the "plot" from the JFreeChart CategoryPlot categoryplot = (CategoryPlot)chart.getCategoryPlot(); // get the dataset CategoryDataset cd = (CategoryDataset)categoryplot.getDataset(); CustomBarRenderer renderer = new CustomBarRenderer(); chart.getCategoryPlot().setRenderer(renderer); } } It build succesfully as .jar file but when I am executing in the report report is blank and showing error(though report is working fine without customize class). I am sure that code has errors in it. Please, help me It's very urgent for me. Any suggestions/comments are appreciable. Thanks Silvi
  6. Thanks Broonyex1.. I read your tutorial and that's what exactly I am looking for. But very sorry to say I am a newbie in using jasper products. So I am not sure how and where use the codes. I would highly appreciate your help if you can explain me in detail and can link me up with documents.
  7. Hello all, I have a date parameter in my report called Auto_Date: <parameter name="Auto_Date" class="java.util.Date"> <defaultValueExpression><![CDATA[($P{Auto_Date} == null || $P{Auto_Date} == " " ? new Date() : $P{Auto_Date})]]></defaultValueExpression> </parameter> Set curdate as default value when null or empty string. Report is working fine in i-report but when I am scheduling on Japser server by leaving visible Auto_Date parameter blank, report is empty. I know that if I will set parameter as "Read-only" on server I can schedule it. My limitation is that I cannot have two jrxml file one for random date and one for scheduling. It is driving me crazy, I have searched all the forum but did not find any answer. Can I schedule my report by using default value of parameter. Please help, it' svery important for me. Thanks Silvi
  8. Hello All, I got sucess in creating report having multiple input parameter on serevr. But I want that instead of running my report for all multiple inputs at same time, it should run for each single input each time. For eg: I put three multiple inputs parameter--- A, B, C. Right now, Query and Report is running for A, B, and C together. Instead, I want query and report should execute first for A, then B, and then C. I don't have any way, how to do. All suggestions are highly appreciable. I have attached my .jrxml file. Please, help me ... its urgent for me Thanks in advance.. Silvi
  9. Yes, it's possible. There is a tool called percentage in Palette
  10. Hello All, I am wondering if someone can help me. I need to fix series colors according to the field values. Suppose i have four fields.. A - Black, B- Red, C-Green, D - Yellow. If all the fields are present then everything is fine. But, if one field is missing in between, then order is changing and that I don't wish to have. Like if B is not present then the results is : A-Black, C-Red, D - Green. How can I force them to have fields their specific colors. I read a lot study of old threads and forums but did not get an answer. Please, help me. Any suggestions would be appreciable. Thanks Silvi
  11. silvi

    Max Value

    Thanks for your response. It works.
  12. silvi

    Max Value

    Hello all, I need help and guidance of experts in i-report for a newbie. I need a variable (or text expression) having one maximum value from all the fileds. For ex: I have four fields. Let's say A , B, C , D . So the variable should get maximum value from all these fields. A > B> C > D. All these are an integer. I am able to get the maximum value for a field like A . But I am not able to get the maximum value from all the fields. How can I get this? I tried various text expressions but no luck. Please help, it's very urgent and important for me. Thanks in advance Silvi
  13. Hi, Yes, you can do it. with the help of Multiaxis Chart. For more knowledge have a look at this tutorial: http://www.jaspersoft.com/creating-multi-axis-charts-ireport#combining Cheers Silvi
  14. Can anyone please, suggests me something How can I do it? Please, it's really important for me.
  15. Sorry about that. Should have attached it before. Here are my .jrxml files .. Thanks for your time
×
×
  • Create New...