Java 类org.jfree.chart.encoders.KeypointPNGEncoderAdapter 实例源码

项目:Openfire    文件:GraphEngine.java   
/**
 * Generates a Sparkline type graph. Sparkline graphs
 * are "intense, simple, wordlike graphics" so named by Edward Tufte. The big
 * difference between the graph produced by this method compared to the
 * graph produced by the <code>generateGraph</code> method is that this one
 * produces graphs with no x-axis and no y-axis and is usually smaller in size.
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateSparklinesGraph(String key, int width, int height, String color, long startTime,
                                      long endTime, int dataPoints) throws IOException
{
    Statistic[] def = statsViewer.getStatistic(key);
    if (def == null) {
        return null;
    }

    JFreeChart chart;
    switch (def[0].getStatType()) {
        case count:
            chart = generateSparklineBarGraph(key, color, def, startTime, endTime, dataPoints);
            break;
        default:
            chart = generateSparklineAreaChart(key, color, def, startTime, endTime, dataPoints);
    }

    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:g3server    文件:GraphEngine.java   
/**
 * Generates a Sparkline type graph. Sparkline graphs
 * are "intense, simple, wordlike graphics" so named by Edward Tufte. The big
 * difference between the graph produced by this method compared to the
 * graph produced by the <code>generateGraph</code> method is that this one
 * produces graphs with no x-axis and no y-axis and is usually smaller in size.
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateSparklinesGraph(String key, int width, int height, String color, long startTime,
                                      long endTime, int dataPoints) throws IOException
{
    Statistic[] def = statsViewer.getStatistic(key);
    if (def == null) {
        return null;
    }

    JFreeChart chart;
    switch (def[0].getStatType()) {
        case count:
            chart = generateSparklineBarGraph(key, color, def, startTime, endTime, dataPoints);
            break;
        default:
            chart = generateSparklineAreaChart(key, color, def, startTime, endTime, dataPoints);
    }

    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:openfire    文件:GraphEngine.java   
/**
 * Generates a Sparkline type graph. Sparkline graphs
 * are "intense, simple, wordlike graphics" so named by Edward Tufte. The big
 * difference between the graph produced by this method compared to the
 * graph produced by the <code>generateGraph</code> method is that this one
 * produces graphs with no x-axis and no y-axis and is usually smaller in size.
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateSparklinesGraph(String key, int width, int height, String color, long startTime,
                                      long endTime, int dataPoints) throws IOException
{
    Statistic[] def = statsViewer.getStatistic(key);
    if (def == null) {
        return null;
    }

    JFreeChart chart;
    switch (def[0].getStatType()) {
        case count:
            chart = generateSparklineBarGraph(key, color, def, startTime, endTime, dataPoints);
            break;
        default:
            chart = generateSparklineAreaChart(key, color, def, startTime, endTime, dataPoints);
    }

    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:openfire-bespoke    文件:GraphEngine.java   
/**
 * Generates a Sparkline type graph. Sparkline graphs
 * are "intense, simple, wordlike graphics" so named by Edward Tufte. The big
 * difference between the graph produced by this method compared to the
 * graph produced by the <code>generateGraph</code> method is that this one
 * produces graphs with no x-axis and no y-axis and is usually smaller in size.
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateSparklinesGraph(String key, int width, int height, String color, long startTime,
                                      long endTime, int dataPoints) throws IOException
{
    Statistic[] def = statsViewer.getStatistic(key);
    if (def == null) {
        return null;
    }

    JFreeChart chart;
    switch (def[0].getStatType()) {
        case count:
            chart = generateSparklineBarGraph(key, color, def, startTime, endTime, dataPoints);
            break;
        default:
            chart = generateSparklineAreaChart(key, color, def, startTime, endTime, dataPoints);
    }

    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:Prism-gsoc16    文件:Graph.java   
/**
 * Renders the current graph to a JPEG file.
 * 
 * @param file
 *             The file to export the JPEG data to.
 * @throws GraphException, IOException
 *             If file cannot be written to.
 */
public static void exportToPNG(File file, JFreeChart chart, int width, int height, boolean alpha) throws GraphException, IOException
{   

    FileOutputStream fileOutputStream = new FileOutputStream(file);

    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(alpha);

    Paint bgPaint = chart.getBackgroundPaint();

    if (alpha)
    {
        chart.setBackgroundPaint(null);         
    }

    BufferedImage bufferedImage = chart.createBufferedImage(width, height, alpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB, null);

    if (alpha)
    {
        chart.setBackgroundPaint(bgPaint);          
    }

    encoder.encode(bufferedImage, fileOutputStream);

    fileOutputStream.flush();
    fileOutputStream.close();

    //ChartUtilities.saveChartAsPNG(file, chart, width, height, null, alpha, 9);
}
项目:Openfire    文件:GraphEngine.java   
/**
 * Creates a graph in PNG format.  The PNG graph is encoded by the KeypointPNGEncoderAdapter
 * so that the resulting PNG is encoded with alpha transparency.
 *
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateGraph(String key, int width, int height, String color, long startTime, long endTime,
                            int dataPoints) throws IOException
{

    JFreeChart chart = generateChart(key, width, height, color, startTime, endTime,dataPoints);
    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:g3server    文件:GraphEngine.java   
/**
 * Creates a graph in PNG format.  The PNG graph is encoded by the KeypointPNGEncoderAdapter
 * so that the resulting PNG is encoded with alpha transparency.
 *
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateGraph(String key, int width, int height, String color, long startTime, long endTime,
                            int dataPoints) throws IOException
{

    JFreeChart chart = generateChart(key, width, height, color, startTime, endTime,dataPoints);
    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:openfire    文件:GraphEngine.java   
/**
 * Creates a graph in PNG format.  The PNG graph is encoded by the KeypointPNGEncoderAdapter
 * so that the resulting PNG is encoded with alpha transparency.
 *
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateGraph(String key, int width, int height, String color, long startTime, long endTime,
                            int dataPoints) throws IOException
{

    JFreeChart chart = generateChart(key, width, height, color, startTime, endTime,dataPoints);
    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}
项目:openfire-bespoke    文件:GraphEngine.java   
/**
 * Creates a graph in PNG format.  The PNG graph is encoded by the KeypointPNGEncoderAdapter
 * so that the resulting PNG is encoded with alpha transparency.
 *
 * @param key
 * @param width
 * @param height
 * @param startTime
 * @param endTime
 * @param dataPoints
 * @return
 * @throws IOException
 */
public byte[] generateGraph(String key, int width, int height, String color, long startTime, long endTime,
                            int dataPoints) throws IOException
{

    JFreeChart chart = generateChart(key, width, height, color, startTime, endTime,dataPoints);
    KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
    encoder.setEncodingAlpha(true);
    return encoder.encode(chart.createBufferedImage(width, height, BufferedImage.BITMASK, null));
}