Example usage for org.jfree.chart JFreeChart KEY_SUPPRESS_SHADOW_GENERATION

List of usage examples for org.jfree.chart JFreeChart KEY_SUPPRESS_SHADOW_GENERATION

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart KEY_SUPPRESS_SHADOW_GENERATION.

Prototype

RenderingHints.Key KEY_SUPPRESS_SHADOW_GENERATION

To view the source code for org.jfree.chart JFreeChart KEY_SUPPRESS_SHADOW_GENERATION.

Click Source Link

Document

The key for a rendering hint that can suppress the generation of a shadow effect when drawing the chart.

Usage

From source file:org.jfree.graphics2d.demo.SVGPieChartDemo1.java

/**
 * Starting point for the demo./* w  ww.  j  a  va 2  s  .c o m*/
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    SVGGraphics2D g2 = new SVGGraphics2D(600, 400);
    g2.setRenderingHint(JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION, true);
    Rectangle r = new Rectangle(0, 0, 600, 400);
    chart.draw(g2, r);
    File f = new File("SVGPieChartDemo1.svg");
    SVGUtils.writeToSVG(f, g2.getSVGElement());
}

From source file:com.orsonpdf.demo.PDFPieChartDemo1.java

/**
 * Starting point for the demo./*  w  w w .j a v a  2s  .c  om*/
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    PDFDocument pdfDoc = new PDFDocument();
    pdfDoc.setTitle("PDFPieChartDemo1");
    pdfDoc.setAuthor("Object Refinery Limited");
    Page page = pdfDoc.createPage(new Rectangle(612, 468));
    PDFGraphics2D g2 = page.getGraphics2D();
    g2.setRenderingHint(JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION, true);
    chart.draw(g2, new Rectangle(0, 0, 612, 468));
    File f = new File("PDFPieChartDemo1.pdf");
    pdfDoc.writeToFile(f);
}

From source file:org.jfree.graphics2d.demo.SVGTimeSeriesChartDemo1.java

/**
 * Starting point for the demo./*  w w w .  j  av a  2s.com*/
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    SVGGraphics2D g2 = new SVGGraphics2D(600, 400);
    g2.setRenderingHint(JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION, true);
    Rectangle r = new Rectangle(0, 0, 600, 400);
    chart.draw(g2, r);
    File f = new File("SVGTimeSeriesChartDemo1.svg");
    SVGUtils.writeToSVG(f, g2.getSVGElement());
}

From source file:ec.util.chart.swing.Charts.java

private static String generateSVG(JFreeChart chart, int width, int height) throws IOException {
    try {//from  www.  java2s  . c  o m
        Class<?> svgGraphics2d = Class.forName("org.jfree.graphics2d.svg.SVGGraphics2D");
        Graphics2D g2 = (Graphics2D) svgGraphics2d.getConstructor(int.class, int.class).newInstance(width,
                height);
        // we suppress shadow generation, because SVG is a vector format and
        // the shadow effect is applied via bitmap effects...
        g2.setRenderingHint(JFreeChart.KEY_SUPPRESS_SHADOW_GENERATION, true);
        chart.draw(g2, new Rectangle2D.Double(0, 0, width, height));
        return (String) g2.getClass().getMethod("getSVGElement").invoke(g2);
    } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException
            | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
        throw new IOException("Cannot generate SVG", ex);
    }
}