Examples of MyDialPlot


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

  public JFreeChart createChart(DatasetMap datasets) {
    logger.debug("IN");
    JFreeChart chart = null;
    try{
      MyDialPlot plot = new MyDialPlot();
     
      HashMap hmDataset = datasets.getDatasets();
      Set keyDataset = hmDataset.keySet();
      int i = 0;
     
      Iterator itDataset = keyDataset.iterator();
      while(itDataset.hasNext()) {
        String key = (String) itDataset.next();
        Dataset dataset = (Dataset)hmDataset.get(key);
        plot.setDataset(i, (ValueDataset)dataset);
        if (key.indexOf("__") > 0)
          setName(key.substring(0, key.indexOf("__")));
        else
          setName(key);
        i++;
      }
         
      plot.setDialFrame(new StandardDialFrame());
 
      plot.setBackground(new DialBackground());
     
      if(dialtextuse){
        DialTextAnnotation annotation1 = new DialTextAnnotation(dialtext);     
        annotation1.setFont(styleTitle.getFont());
        annotation1.setRadius(0.7);
 
        plot.addLayer(annotation1);
      }
     
      StandardDialScale scale = new StandardDialScale(lower,
          upper, -120, -300, 10.0, 4);
     
      if(! ( increment > 0) ){
        logger.warn("increment cannot be less than 0, put default to 0.1 ");
        increment=0.1;
      }
     
      scale.setMajorTickIncrement(increment);
      scale.setMinorTickCount(minorTickCount);
      scale.setTickRadius(0.88);
      scale.setTickLabelOffset(0.15);
      //set tick label style
      scale.setTickLabelsVisible(true);
      Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize());
      scale.setTickLabelFont(tickLabelsFont);
      scale.setTickLabelPaint(labelsTickStyle.getColor());
     
     
      plot.addScale(0, scale);
 
      DialCap cap = new DialCap();
      plot.setCap(cap);
 
      // sets intervals
      for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(),
            interval.getColor());
        range.setInnerRadius(0.50);
        range.setOuterRadius(0.85);
       
        range.setPaint(interval.getColor());
       
        plot.addLayer(range);
 
      }

      plot.setBackground(new DialBackground());

      logger.debug("Set values color");
      Vector arValuesName =  getValuesNames();
      legendItems = new LegendItemCollection();
      for (int j = 0; j < arValuesName.size(); j++) {
        DialPointer.Pin p = new DialPointer.Pin(j);
        if(colorMap!=null){
          String valueName=(String)arValuesName.get(j);
          Color color=(Color)colorMap.get(valueName);
          if(color!=null) p.setPaint(color)
                 
          if (serieLegend.equalsIgnoreCase(name)){
            if (j < arValuesName.size()){
              LegendItem item = new LegendItem(valueName, "", "", "", new Ellipse2D.Double(-3, -5, 8, 8),color );
              if (item != null) {
                    legendItems.add(item);
                  }
            }
            if (legend)
              super.height = super.height + (super.height*12/100);
          }
        }
        plot.addLayer(p)
      }
     
      plot.setLegendItems(legendItems);
      chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT,plot, false);
     
      TextTitle title = setStyleTitle(name, styleTitle);
      chart.setTitle(title);
      if(subName!= null && !subName.equals("")){
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.