Examples of TargetThreshold


Examples of it.eng.spagobi.engines.chart.bo.charttypes.utils.TargetThreshold

    addPointSeries(timeSeries, plot);

    int num = 3;
    for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) {
      Double thres = (Double) iterator.next();
      TargetThreshold targThres=thresholds.get(thres);
      Color color=Color.WHITE;
      if(targThres!=null && targThres.getColor()!=null){
        color=targThres.getColor();
      }
      if(targThres.isVisible()){
        addMarker(num++, thres.doubleValue(), color, 0.5f, plot);
      }
    }

View Full Code Here

Examples of it.eng.spagobi.engines.chart.bo.charttypes.utils.TargetThreshold

        else
          colorToReturn=Color.GREEN;

      }
      else{
        TargetThreshold currThreshold=thresholds.get(thresholdGiveColor);
        colorToReturn=currThreshold.getColor();
        if(colorToReturn==null){
          colorToReturn=Color.BLACK;
        }
      }
    }
View Full Code Here

Examples of it.eng.spagobi.engines.chart.bo.charttypes.utils.TargetThreshold

    if(targets==true){   // Case Target Found on parameters
      useTargets=true;     
      for (Iterator iterator = targetNames.iterator(); iterator.hasNext();) {
        String targetName = (String) iterator.next();
        String valueToParse=(String)parametersObject.get(targetName);
        TargetThreshold targThres=new TargetThreshold(valueToParse);
        if(targThres.getName().equalsIgnoreCase("bottom"))bottomThreshold=targThres;
        else{
          if(targThres.isVisible()){
            thresholds.put(targThres.getValue(), targThres);
            if(targThres.isMain()==true)mainThreshold=targThres.getValue();
          }
        }
      }
      if(bottomThreshold==null) bottomThreshold=new TargetThreshold("bottom",null, Color.BLACK,false, true);   
    }
    else if(baselines==true){ // Case Baselines found on parameters
      useTargets=false;
      for (Iterator iterator = baselinesNames.iterator(); iterator.hasNext();) {
        String targetName = (String) iterator.next();
        String valueToParse=(String)parametersObject.get(targetName);
        TargetThreshold targThres=new TargetThreshold(valueToParse);
        if(targThres.getName().equalsIgnoreCase("bottom"))bottomThreshold=targThres;
        else{
          if(targThres.isVisible()){
            thresholds.put(targThres.getValue(), targThres);
            if(targThres.isMain()==true)mainThreshold=targThres.getValue();
          }
        }
      }
      if(bottomThreshold==null) bottomThreshold=new TargetThreshold("bottom",null, Color.BLACK,false, true);

    }
    //**************************** TEMPLATE TARGET OR BASELINES DEFINITION **********************
    else {                       // Case targets or baselines defined in template
      /* <TARGETS>
       *  <TARGET name='first' value='5' main='true'>
       *  </TARGETS>
       */
      List thresAttrsList=null
      SourceBean thresholdsSB = (SourceBean)content.getAttribute(TARGETS);
      if(thresholdsSB==null){
        thresholdsSB = (SourceBean)content.getAttribute(BASELINES);
        if(thresholdsSB==null)return;
        useTargets=false;
      }

      if(thresholdsSB!=null){
        thresAttrsList = thresholdsSB.getContainedSourceBeanAttributes();
      }
      if(thresAttrsList==null || thresAttrsList.isEmpty()){
        logger.error("targets or baselines not defined; error ");
        return;
      }
      else{
        thresholds=new HashMap<Double, TargetThreshold>();
        //thresholdColors=new HashMap<String, Color>();     
        Iterator targetsAttrsIter = thresAttrsList.iterator();
        while(targetsAttrsIter.hasNext()) {
          SourceBeanAttribute paramSBA = (SourceBeanAttribute)targetsAttrsIter.next();
          SourceBean param = (SourceBean)paramSBA.getValue();
          String name= (String)param.getAttribute("name");
          String value= (String)param.getAttribute("value");
          String main= (String)param.getAttribute("main");
          String colorS = (String)param.getAttribute("color");
          String visibleS = (String)param.getAttribute("visible");

          Color colorC=Color.BLACK;
          boolean isMain=(main!=null && main.equalsIgnoreCase("true")) ? true : false;
          if(colorS!=null){
            try{
              colorC=Color.decode(colorS);
            }
            catch (Exception e) {
              logger.error("error in color defined, put BLACK as default");
            }
          }
          boolean isVisible=(visibleS!=null && (visibleS.equalsIgnoreCase("false") || visibleS.equalsIgnoreCase("0") || visibleS.equalsIgnoreCase("0.0"))) ? false : true;

          // The value of the threshold is bottom or a double value
          if(value!=null){
            if(value.equalsIgnoreCase("bottom")){ //if definin bottom case
              bottomThreshold=new TargetThreshold("bottom",null, colorC,false,true);
            }
            else if(!value.equalsIgnoreCase("bottom")){
              Double valueD=null;
              try{
                valueD=Double.valueOf(value);
              }
              catch (NumberFormatException e) {
                logger.error("Error in converting threshold double", e);
                return;
              }
              if(isVisible==true){
                thresholds.put(valueD, new TargetThreshold(name,valueD,colorC,isMain, isVisible));
                if(isMain==true){
                  mainThreshold=valueD;
                }
              }
            }
View Full Code Here

Examples of it.eng.spagobi.engines.chart.bo.charttypes.utils.TargetThreshold

    LegendItemCollection collection=new LegendItemCollection();

    for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) {
      Double thres = (Double) iterator.next();
      TargetThreshold thresTarg=thresholds.get(thres);
      String thresholdName= thresTarg!=null ? thresTarg.getName() : "";

      Color color=Color.BLACK;

      if(thresTarg.getColor()!=null){
        color=thresTarg.getColor();   
      }
      // could add bottom only if used
      LegendItem item=new LegendItem(thresholdName, thresholdName, thresholdName,thresholdName, new Rectangle(10,10),color);
      collection.add(item);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.