Package org.jfree.chart

Examples of org.jfree.chart.ChartRenderingInfo


   * @param logger
   *          The logger to log any messages to
   */
  public static void saveChart( final Dataset dataset, final String title, final String units, final String fileName,
      final int width, final int height, final int outputType, final PrintWriter writer, final ILogger logger ) {
    ChartRenderingInfo info = new ChartRenderingInfo();
    JFreeChartEngine.saveChart( dataset, title, units, fileName, width, height, outputType, writer, info, logger );
  }
View Full Code Here


      // create temporary file names
      String[] tempFileInfo = createTempFile();
      String fileName = tempFileInfo[AbstractChartComponent.FILENAME_INDEX];
      String filePathWithoutExtension = tempFileInfo[AbstractChartComponent.FILENAME_WITHOUT_EXTENSION_INDEX];

      ChartRenderingInfo info = new ChartRenderingInfo( new StandardEntityCollection() );
      JFreeChartEngine.saveChart( chartDataDefinition, chartTitle,
          "", filePathWithoutExtension, width, height, JFreeChartEngine.OUTPUT_PNG, printWriter, info, this ); //$NON-NLS-1$
      applyOuterURLTemplateParam();
      populateInfo( info );
      Element chartElement = root.addElement( "chart" ); //$NON-NLS-1$
View Full Code Here

          }
          sbi.setShowAxis(options.getShow_axis())
          sbi.setThresholdValues(thresholdValues);
       
          JFreeChart chart = sbi.createChart();
          ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
          String requestIdentity = null;
          UUIDGenerator uuidGen  = UUIDGenerator.getInstance();
          UUID uuid = uuidGen.generateTimeBasedUUID();
          requestIdentity = uuid.toString();
          requestIdentity = requestIdentity.replaceAll("-", "");
          String path_param = requestIdentity;
          String dir=System.getProperty("java.io.tmpdir");
          String path=dir+"/"+requestIdentity+".png";
          java.io.File file1 = new java.io.File(path);
          logger.debug("Where is the image: "+path);
          try {
            ChartUtilities.saveChartAsPNG(file1, chart, 89, 11, info);
          } catch (IOException e) {
            e.printStackTrace();
            logger.error("Error in saving chart",e);
          }
          String urlPng=GeneralUtilities.getSpagoBiHost()+GeneralUtilities.getSpagoBiContext() + GeneralUtilities.getSpagoAdapterHttpUrl() +
          "?ACTION_NAME=GET_PNG2&NEW_SESSION=TRUE&path="+path_param+"&LIGHT_NAVIGATOR_DISABLED=TRUE";
          urlPng = "new java.net.URL(\""+urlPng+"\")";
          logger.debug("Image url: "+urlPng);
         
          image1.setAttribute("reportElement.y", yValue.toString());
          image1.setAttribute("reportElement.x", new Integer(310).toString());
          image1.setAttribute("reportElement.width", 90);
          SourceBean imageValue=(SourceBean)image1.getAttribute("imageExpression");
          imageValue.setCharacters(urlPng);
        }
        ThresholdValue tOfVal = line.getThresholdOfValue();
        if (tOfVal!=null && tOfVal.getPosition()!=null && tOfVal.getThresholdCode()!=null){
          String fileName ="position_"+tOfVal.getPosition().intValue();
          String dirName = tOfVal.getThresholdCode();
          String urlPng=GeneralUtilities.getSpagoBiHost()+GeneralUtilities.getSpagoBiContext() + GeneralUtilities.getSpagoAdapterHttpUrl() +
          "?ACTION_NAME=GET_THR_IMAGE&NEW_SESSION=TRUE&fileName="+fileName+"&dirName="+dirName+"&LIGHT_NAVIGATOR_DISABLED=TRUE"
         
          urlPng = "new java.net.URL(\""+urlPng+"\")";
          logger.debug("url: "+urlPng);
         
          extraimageToAdd=new SourceBean(image);
          extraimageToAdd.setAttribute("reportElement.y", yValue.toString());
          extraimageToAdd.setAttribute("reportElement.width",35);
          extraimageToAdd.setAttribute("reportElement.x", new Integer(408).toString());
          SourceBean imageValue=(SourceBean)extraimageToAdd.getAttribute("imageExpression");
          imageValue.setCharacters(urlPng);     
        }
      }else if(options.getDisplay_bullet_chart() && !options.getDisplay_threshold_image()){
        //only bullet chart has to be seen
        if ( kpiValue!=null &&  kpiValue.getValue()!= null && kpiValue.getThresholdValues()!=null && !kpiValue.getThresholdValues().isEmpty()) {

          List thresholdValues = kpiValue.getThresholdValues();     
          // String chartType = value.getChartType();
          String chartType = "BulletGraph";
          Double val = new Double(kpiValue.getValue());
          Double target = kpiValue.getTarget();
          ChartImpl sbi = ChartImpl.createChart(chartType);
          sbi.setValueDataSet(val);
          if (target != null) {
            sbi.setTarget(target);
          }
          sbi.setShowAxis(options.getShow_axis())
          sbi.setThresholdValues(thresholdValues);
         
          JFreeChart chart = sbi.createChart();
          ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
          String requestIdentity = null;
          UUIDGenerator uuidGen  = UUIDGenerator.getInstance();
          UUID uuid = uuidGen.generateTimeBasedUUID();
          requestIdentity = uuid.toString();
          requestIdentity = requestIdentity.replaceAll("-", "");
View Full Code Here

         GfrOptionPaneAbs.s_showDialogError(null, strError);
         System.exit(1);
      }

      Point2D p2d = ((GfrChartPanelDstAbs) super._tot).translateScreenToJava2D(new java.awt.Point(x, y));
      ChartRenderingInfo info = ((GfrChartPanelDstAbs) super._tot).getChartRenderingInfo();
     
      /*
       * THE FOLLOWING: NOT GOOD !!!!!!!
       */
      final int f_intIdInfo = 0;
      Rectangle2D dataArea = info.getPlotInfo().getSubplotInfo(f_intIdInfo).getDataArea();

    
      //-- Min max
      double dblValueMax = pltSource.getRangeAxis().java2DToValue(dataArea.getMaxX(), dataArea,
      pltSource.getRangeAxisEdge());
View Full Code Here

      if (pop != null)
      {
         if (this._mimPicked != null)
         {
            Point2D p = super.translateScreenToJava2D(new java.awt.Point(x, y));
            ChartRenderingInfo info = super.getChartRenderingInfo();
            Rectangle2D dataArea = info.getPlotInfo().getDataArea();
            XYPlot plt = (XYPlot) super.getPlot();

            double dblDepth = plt.getDomainAxis().java2DToValue(p.getY(), dataArea,
                     plt.getDomainAxisEdge());
           
View Full Code Here

   public void saveChart(String filename) throws IOException {
      OutputStream out = new BufferedOutputStream(new FileOutputStream(filename));
      try {
         chart.getXYPlot().getRangeAxis().setVisible(false);
         chart.getXYPlot().getDomainAxis().setVisible(false);
         ChartRenderingInfo renderingInfo = new ChartRenderingInfo();
         BufferedImage image = chart.createBufferedImage(width, height, renderingInfo);
         EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out);
      } finally {
         out.close();
      }
View Full Code Here

   public void saveRange(String filename) throws IOException {
      OutputStream out = new BufferedOutputStream(new FileOutputStream(filename));
      try {
         chart.getXYPlot().getRangeAxis().setVisible(true);
         chart.getXYPlot().getDomainAxis().setVisible(false);
         ChartRenderingInfo renderingInfo = new ChartRenderingInfo();
         BufferedImage image = chart.createBufferedImage(width, height, renderingInfo);
         image = image.getSubimage(0, 0, (int) renderingInfo.getPlotInfo().getDataArea().getX(), height);
         EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out);
      } finally {
         out.close();
      }
   }
View Full Code Here

   public void saveRelativeDomain(String filename) throws IOException {
      OutputStream out = new BufferedOutputStream(new FileOutputStream(filename));
      try {
         chart.getXYPlot().getRangeAxis().setVisible(false);
         chart.getXYPlot().getDomainAxis().setVisible(true);
         ChartRenderingInfo renderingInfo = new ChartRenderingInfo();
         BufferedImage image = chart.createBufferedImage(width, height, renderingInfo);
         int maxY = (int) renderingInfo.getPlotInfo().getDataArea().getMaxY();
         image = image.getSubimage(0, maxY + DOMAIN_OFFSET, width, height - maxY - DOMAIN_OFFSET);
         EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out);
      } finally {
         out.close();
      }
View Full Code Here

         chart.getXYPlot().getRangeAxis().setVisible(false);
         Font labelFont = chart.getXYPlot().getDomainAxis().getLabelFont();
         chart.getXYPlot().setDomainAxis(new DateAxis("Time"));
         chart.getXYPlot().getDomainAxis().setRange(startTimestamp, endTimestamp);
         chart.getXYPlot().getDomainAxis().setLabelFont(labelFont);
         ChartRenderingInfo renderingInfo = new ChartRenderingInfo();
         BufferedImage image = chart.createBufferedImage(width, height, renderingInfo);
         int maxY = (int) renderingInfo.getPlotInfo().getDataArea().getMaxY();
         image = image.getSubimage(0, maxY + DOMAIN_OFFSET, width, height - maxY - DOMAIN_OFFSET);
         EncoderUtil.writeBufferedImage(image, ImageFormat.PNG, out);
      } finally {
         out.close();
      }
View Full Code Here

  private Font getFont() {
    return new Font(font,fontstyle,fontsize);
  }

  private void writeOut(JFreeChart jfc) throws PageException, IOException {
    final ChartRenderingInfo info=new ChartRenderingInfo();
       
    // map name
    chartIndex++;
    if(chartIndex<0)chartIndex=0;
    String mapName="chart_"+(chartIndex++);
View Full Code Here

TOP

Related Classes of org.jfree.chart.ChartRenderingInfo

Copyright © 2018 www.massapicom. 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.