Package org.jfree.chart

Examples of org.jfree.chart.JFreeChart.createBufferedImage()


            chart.getXYPlot().setDomainAxis(0, new DateAxis());
            chart.getXYPlot().setDomainAxis(1, new DateAxis());
            chart.getXYPlot().setInsets(new RectangleInsets(-15, 0, 0, 10));

            response.setHeader("Content-type", "image/png");
            response.getOutputStream().write(ChartUtilities.encodeAsPNG(chart.createBufferedImage(width, height)));
        }

        return null;
    }
}
View Full Code Here


        // create the chart...
        final JFreeChart chart = createChart(dataset);
        // return as image
        // Encode as a JPEG
        JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(os);
        jpeg.encode(chart.createBufferedImage(width, height));
    }
   
    /**
     * Creates a sample dataset for the demo.
     *
 
View Full Code Here

        // create the chart...
        final JFreeChart chart = createChart(dataset);
        // return as image
        // Encode as a JPEG
        JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(os);
        jpeg.encode(chart.createBufferedImage(width, height));
    }
   
    /**
     * Creates a sample dataset for the demo.
     *
 
View Full Code Here

        XYItemRenderer renderer = new XYStepRenderer();
        XYPlot plot = new XYPlot(seriesCollection, xAxis, yAxis, renderer);
        plot.setOrientation(PlotOrientation.VERTICAL);
        JFreeChart chart = new JFreeChart(baseName + " best score statistic",
                JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        BufferedImage chartImage = chart.createBufferedImage(1024, 768);
        File graphStatisticFile = new File(solverStatisticFilesDirectory, baseName + "Statistic.png");
        OutputStream out = null;
        try {
            out = new FileOutputStream(graphStatisticFile);
            ImageIO.write(chartImage, "png", out);
View Full Code Here

        );
        CategoryItemRenderer renderer = ((CategoryPlot) chart.getPlot()).getRenderer();
        CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator();
        renderer.setBaseItemLabelGenerator(generator);
        renderer.setBaseItemLabelsVisible(true);
        BufferedImage chartImage = chart.createBufferedImage(1024, 768);
        File chartSummaryFile = new File(solverStatisticFilesDirectory, "summary.png");
        OutputStream out = null;
        try {
            out = new FileOutputStream(chartSummaryFile);
            ImageIO.write(chartImage, "png", out);
View Full Code Here

      ls.busyExecutors.update(0);
      ls.queueLength.update(1);
    }

    JFreeChart chart = ls.createTrendChart(TimeScale.SEC10).createChart();
    BufferedImage image = chart.createBufferedImage(400, 200);
   
    File tempFile = File.createTempFile("chart-", "png");
    FileOutputStream os = new FileOutputStream(tempFile);
    try {
      ImageIO.write(image, "PNG", os);
View Full Code Here

    // Try to fit all the graphs into a 1024 window, with a min of 240 and a max
    // of 480
    final int graphWidth = Math.max(240, Math.min(480,
        (1024 - 10 * results.size()) / results.size()));
    BufferedImage img = chart.createBufferedImage(graphWidth, 240);
    byte[] image = EncoderUtil.encode(img, ImageFormat.PNG);

    response.setContentType("image/png");

    OutputStream output = response.getOutputStream();
View Full Code Here

        if (width < SMALL_PIC || height < SMALL_PIC) {
        } else {
            chart.setTitle(new TextTitle(this.toString(), new Font("Arial", 0, 12)));
        }

        return chart.createBufferedImage(width, height);
    }
   
    @Override
    public abstract String toString();
View Full Code Here

        if (width < SMALL_PIC || height < SMALL_PIC) {
        } else {
            chart.setTitle(new TextTitle(this.toString(), new Font("Arial", 0, 12)));
        }

        return chart.createBufferedImage(width, height);
    }
   
    @Override
    public abstract String toString();
View Full Code Here

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

    BufferedImage bufferedImage =  chart.createBufferedImage(reportChart.getWidth(), reportChart.getHeight(),info);
    byte[] image = null;
   
    try
    {
      image = EncoderUtil.encode(bufferedImage, ImageFormat.PNG);
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.