Example usage for org.jfree.chart JFreeChart draw

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

Introduction

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

Prototype

@Override
public void draw(Graphics2D g2, Rectangle2D area) 

Source Link

Document

Draws the chart on a Java 2D graphics device (such as the screen or a printer).

Usage

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

/**
 * Starting point for the demo./*w ww.j  a v  a2s. c om*/
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    CanvasGraphics2D g2 = new CanvasGraphics2D("id");
    int width = 600;
    int height = 400;
    chart.draw(g2, new Rectangle(0, 0, width, height));
    File f = new File("CanvasPieChartDemo1.html");
    CanvasUtils.writeToHTML(f, "CanvasPieChartDemo1", g2.getCanvasID(), width, height, g2.getScript());
}

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

/**
 * Starting point for the demo./*from  w ww.  j a v a2s.co  m*/
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    SVGGraphics2D g2 = new SVGGraphics2D(600, 400);
    Rectangle r = new Rectangle(0, 0, 600, 400);
    chart.draw(g2, r);
    File f = new File("SVGBarChartDemo1.svg");
    SVGUtils.writeToSVG(f, g2.getSVGElement());
}

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

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

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

/**
 * Starting point for the demo.//from w  w w  .ja v  a  2  s. c  o  m
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    CanvasGraphics2D g2 = new CanvasGraphics2D("id");
    int width = 600;
    int height = 400;
    Rectangle r = new Rectangle(0, 0, width, height);
    chart.draw(g2, r);
    File f = new File("CanvasBarChartDemo1.html");
    CanvasUtils.writeToHTML(f, "CanvasBarChartDemo1", g2.getCanvasID(), width, height, g2.getScript());
}

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

/**
 * Starting point for the demo.//from www.j a  v a 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.PDFBarChartDemo1.java

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

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

/**
 * Starting point for the demo.//from  w  w w  .  j a v a 2 s.  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.CanvasTimeSeriesChartDemo1.java

/**
 * Starting point for the demo.//from w  ww .  ja  va  2s  . co m
 * 
 * @param args  ignored.
 * 
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
    JFreeChart chart = createChart(createDataset());
    CanvasGraphics2D g2 = new CanvasGraphics2D("id");
    int width = 600;
    int height = 400;
    chart.draw(g2, new Rectangle(0, 0, width, height));
    File f = new File("CanvasTimeSeriesChartDemo1.html");
    CanvasUtils.writeToHTML(f, "CanvasTimeSeriesChartDemo1", g2.getCanvasID(), width, height, g2.getScript());
}

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

/**
 * Starting point for the demo./*from   ww  w .j  a v a  2 s.co 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("SVGTimeSeriesChartDemo1.svg");
    SVGUtils.writeToSVG(f, g2.getSVGElement());
}

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

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