Package org.jfree.chart

Examples of org.jfree.chart.ChartRenderingInfo


   * @throws CewolfException
   */
  private static RenderedImage renderChart(ChartImage cd, Object chart) throws CewolfException {
    try {
      final ByteArrayOutputStream baos = new ByteArrayOutputStream();
      final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
      final String mimeType = cd.getMimeType();
      if (MIME_PNG.equals(mimeType)) {
        handlePNG(baos, (JFreeChart)chart, cd.getWidth(), cd.getHeight(), info);
      } else if (MIME_JPEG.equals(mimeType)) {
          handleJPEG(baos, (JFreeChart)chart, cd.getWidth(), cd.getHeight(), info);
View Full Code Here


      // chart in the state we received it.
      if (!haslegend) {
        removeLegend(chart);
      }

      return new RenderedImage(out.toByteArray(), "image/jpeg", new ChartRenderingInfo(new StandardEntityCollection()));
    } catch (IOException ioex) {
      log.error("Renderer.renderLegend: "+ioex.getMessage());
      throw new ChartRenderingException(ioex.getMessage(), ioex);
    }
  }
View Full Code Here

      String mapTagContent = "<" + MAP_TAGNAME;
      mapTagContent += " " + NAME_ATTRIBUTE + "=\"" + chartId + "\"";
      mapTagContent += " " + ID_ATTRIBUTE + "=\"" + chartId + "\"";
      mapTagContent += " >";
      out.write(mapTagContent);
      ChartRenderingInfo info = (ChartRenderingInfo) root.getRenderingInfo();
      Iterator entities = info.getEntityCollection().iterator();
      boolean altAttrbInserted, hasContent;
      StringBuffer sb = new StringBuffer(200);
      while (entities.hasNext()) {
        altAttrbInserted = false;
        hasContent = false;
View Full Code Here

        }

        chart.setBackgroundPaint(java.awt.Color.white);

        try {
            final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
            ChartUtilities.saveChartAsPNG(tempTestSummaryFile, chart, 600, 400, info);
        } catch (IOException e) {
            logger.error("Problem saving png chart", e);
        }
View Full Code Here

    if (chart == null) return null;   
   
    chart.setBackgroundPaint(Color.WHITE);
   
    ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());

    BufferedImage bufferedImage =  chart.createBufferedImage(reportChart.getWidth(), reportChart.getHeight(),info);
    byte[] image = null;
   
    try
View Full Code Here

            if (this.regionEnd != null) {
                endpoint = this.chartPanel.translateScreenToJava2D(this.regionEnd);
            }

            ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
            Rectangle2D dataArea = info.getPlotInfo().getDataArea();
            ValueAxis domainAxis = this.renderer.getPlot().getDomainAxis();
            RectangleEdge edge = this.renderer.getPlot().getDomainAxisEdge();

            // define the limits for the region to be shaded
View Full Code Here

        } else if (this.currentMouseMode == MOUSEMODE.PICKPEAK) {

            this.renderer.getPlot().setDomainCrosshairVisible(false);
            this.renderer.getPlot().clearDomainMarkers();
            Point2D point = this.chartPanel.translateScreenToJava2D(e.getPoint());
            ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
            Rectangle2D dataArea = info.getPlotInfo().getDataArea();
            ValueAxis domainAxis = this.renderer.getPlot().getDomainAxis();
            RectangleEdge edge = this.renderer.getPlot().getDomainAxisEdge();

            // define the point for the peaks
            double peakPoint = domainAxis.java2DToValue(point.getX(), dataArea, edge);
View Full Code Here

    protected static String writeImageMap(JFreeChart chart, OutputElement outputElement, HttpSession session, PrintWriter pw) {
        String filename;
        try {
            //  Write the chart image to the temporary directory
            ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
            filename = ServletUtilities.saveChartAsPNG(chart,
                    outputElement.getChart().getWidth().intValue(),
                    outputElement.getChart().getHeight().intValue(),
                    info, session);
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        ChartRenderingInfo i1 = new ChartRenderingInfo();
        ChartRenderingInfo i2 = new ChartRenderingInfo();
        assertTrue(i1.equals(i2));

        i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
        assertFalse(i1.equals(i2));
        i2.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
        assertTrue(i1.equals(i2));

        i1.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
        assertFalse(i1.equals(i2));
        i2.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
        assertTrue(i1.equals(i2));

        StandardEntityCollection e1 = new StandardEntityCollection();
        e1.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
        i1.setEntityCollection(e1);
        assertFalse(i1.equals(i2));
        StandardEntityCollection e2 = new StandardEntityCollection();
        e2.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
        i2.setEntityCollection(e2);
    }
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        ChartRenderingInfo i1 = new ChartRenderingInfo();
        ChartRenderingInfo i2 = null;
        try {
            i2 = (ChartRenderingInfo) i1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(i1 != i2);
        assertTrue(i1.getClass() == i2.getClass());
        assertTrue(i1.equals(i2));

        // check independence
        i1.getChartArea().setRect(4.0, 3.0, 2.0, 1.0);
        assertFalse(i1.equals(i2));
        i2.getChartArea().setRect(4.0, 3.0, 2.0, 1.0);
        assertTrue(i1.equals(i2));

        i1.getEntityCollection().add(new ChartEntity(new Rectangle(1, 2, 2,
                1)));
        assertFalse(i1.equals(i2));
        i2.getEntityCollection().add(new ChartEntity(new Rectangle(1, 2, 2,
                1)));
        assertTrue(i1.equals(i2));

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