Jump to content

yaminirathaur

Members
  • Posts

    5
  • Joined

  • Last visited

yaminirathaur's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi, 1. first you have create a parameter value in subreport 2. when you include this subreport into the main report (i.e. drag from the report element ). Use an existing report and browse to that location where subreport is located. after this click on next button then select the datasource after that you have to select the report parameter expression (this is place where you can set the subreport parameter to the value getting from the sql of java code)
  2. just put the field in the column header of the jrxml... I hope this would work
  3. use this ( $F{Field} == "" ? $F{field1_value} :$F{field_value2} ) or ( $F{Field} == "" ? "msg 1" : "msg 2" )
  4. Hi all, I've a datasource with two columns : one number and one color (rgb html-style). I want to draw a bar chart with each bar having the color defined in the datasource. This color is coming randomly with the datasource i.e. there is no predefined order for this. Series color are not enough, as we can't control which color are given to bart. I really want to take the color value in my database. I have used the chart customizer class for this. when I used this class I get the correct data on ireport output console but on preview bar color is not dislpaying according to the data from the datasource. Please help..!! Code: public void customize(JFreeChart chart, JRChart jasperChart) { int i=0; String color_desc ; ArrayList aalist = new ArrayList(); Color cc = new Color(0,0,0); int chk = (Integer)super.getParameterValue("checklist"); try{ aalist = retrieveBarChartColor(chk); BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); renderer.clearSeriesPaints(true); for(i=0;i<(aalist.size());i++) { color_desc = (String) aalist.get(i); if(color_desc.equals("ORANGE")) { cc = new Color(255,128,0); System.out.println("1-> "+cc+" ->"+color_desc); } else if(color_desc.equals("YELLOW")) { cc = new Color(255,255,0); System.out.println("1-> "+cc+" ->"+color_desc); } else if(color_desc.equals("GREEN")) { cc = new Color(0,128,0); System.out.println("1-> "+cc+" ->"+color_desc); } else if(color_desc.equals("RED")) { cc = new Color(255,0,0); System.out.println("1-> "+cc+" ->"+color_desc); } System.out.println("Setting color-> "+cc+" ->"+color_desc); renderer.setSeriesPaint(i, cc); System.out.println("getting color :" +renderer.getSeriesPaint(i)); System.out.println("hiii"); color_desc = null; cc = null; } }catch(Exception e) { System.out.print("Exception in customize() :"+e); } }
×
×
  • Create New...