Jump to content

silvi

Members
  • Posts

    28
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Posts posted by silvi

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


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

     

     


       

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

     

     

     

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

     

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

     

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

  8. Hello all,

     

    I have a subreport with Chart pro which is working fine. However, when I am adding subreport into the main report, it is not executing. Main report without subreport is working fine too. I have linked up the parameters, path is correct. I am not able to understand what am I doing wrong? Please help, it's urgent.

     

     

    Thanks in advance

    Silvi  

  9. Hi jasuser,

    Thanks for your suggestion.

    i did but it's  syaing install missing plugin even though I have installed  ( adobe-release-i386-1.0-1.noarch.rpm) package.

    Can you give me some more suggestions..

    Thanks

    Silvi

     

  10. Hello All,

    I need to display stacked Column 3D chart Pro. However, when I am using, it is not displaying in the report and also not giving me an error.  I am not able to understand what is the problem? 

     

    Please help, it's important for me.

     

    Thanks

    Silvi

     

     

  11. Hello ,

    I am using ireport pro4.0.1. I used timeseries chart  to display my data. I am wondering can I compress and extend the values on y-axis. For example I want to display  0,2,4, 6, 8, 10, 50, 60, 70, 72, 74, 76, 78, 80, 85, 90, 95, 100, 105, 110. If yes, please How can I do it? 

     

    Thanks for help in advance..

     

  12. I want to generate a report for any number of weeks defiend by user.
    I put two input parameters -- No of weeks and any end date. Suppose user choose 1 week and end date 7th August 2011. As a result, report gets generated from 1st Aug to 7th Aug 2011.

    I want these dates to be displayed on Page Header  like " Period from 1st August to 7th August".
     I am not sure how can I get dates to be dispalyed like this. Any suggestions would be highly appreciable.

     

    Thanks for your help..

     

     

       

  13. Hello all,

    I  installed jaspersoft plugin in "eclipse-reporting-helios-SR2-linux-gtk-x86_64" linux version. It installed successfully but when I am trying to open .jrxml file in eclispse version, it's giving me an error:

    Could not open the editor: An exception was thrown during initialization

    java.lang.NullPointerException
        at com.jaspersoft.studio.editor.JrxmlEditor.init(JrxmlEditor.java:376)
        at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
        at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
        at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
        at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
        at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:271)
        at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1429)
        at org.eclipse.ui.internal.EditorManager$5.runWithException(EditorManager.java:942)
        at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3515)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3164)
        at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
        at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
        at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3515)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3164)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

    Any suggestions would be appreciated.

    Thanks..

    Silvi

     

     


     

  14. Hello all,

    I  need to create a parameter  for my report  to which I can give  value either in days(1, 2, 3, ...30) or in months (like Jan(01), Feb(02), March(03)) or in years (2011, 2010). This means that I need to set parameter having multiple units so that user will have choice. Can we do it in single parameter,? If yes, then please tell me how? 

    Thanks in advance..

     

     

×
×
  • Create New...