Example usage for org.jfree.chart JFreeChart setBorderPaint

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

Introduction

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

Prototype

public void setBorderPaint(Paint paint) 

Source Link

Document

Sets the paint used to draw the chart border (if visible).

Usage

From source file:fr.ign.cogit.simplu3d.rjmcmc.generic.visitor.StatsVisitor.java

/**
 * Creates a sample chart./*from ww  w  .ja v a 2s .co m*/
 * 
 * @param dataset
 *            the dataset.
 * @return A sample chart.
 */
private JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart result = ChartFactory.createXYLineChart("volution de l'nergie", "Itration",
            "nergie", dataset, PlotOrientation.VERTICAL, true, true, true);

    result.setBorderPaint(Color.white);

    result.setBackgroundPaint(Color.white);

    final XYPlot plot = result.getXYPlot();

    Font font = new Font("Verdana", Font.PLAIN, 32);
    Font font2 = new Font("Verdana", Font.PLAIN, 28);

    // axe x
    ValueAxis axis = plot.getDomainAxis();

    axis.setLabelFont(font);
    axis.setTickLabelFont(font2);

    axis.setAutoRange(true);
    // axis.setFixedAutoRange(60000.0); // 60 seconds
    axis = plot.getRangeAxis();

    // axe y
    ValueAxis axis2 = plot.getRangeAxis();

    axis2.setLabelFont(font);
    axis2.setTickLabelFont(font2);

    axis2.setAutoRange(true);
    // axis.setFixedAutoRange(60000.0); // 60 seconds
    axis2 = plot.getRangeAxis();

    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setBackgroundPaint(Color.white);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();

    renderer.setSeriesPaint(0, new Color(255, 0, 0));
    renderer.setSeriesStroke(0, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f));

    renderer.setLegendTextFont(0, font2);

    renderer.setSeriesPaint(1, new Color(2, 157, 116));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f));

    renderer.setLegendTextFont(1, font2);

    renderer.setSeriesPaint(2, new Color(112, 147, 219));
    renderer.setSeriesStroke(2, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f));

    renderer.setLegendTextFont(2, font2);

    renderer.setSeriesPaint(3, new Color(140, 23, 23));
    renderer.setSeriesStroke(3, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 6.0f, 6.0f }, 0.0f));

    renderer.setLegendTextFont(3, font2);

    // axis.setRange(0.0, 200.0);
    return result;
}

From source file:probe.com.view.body.quantcompare.PieChart.java

private String initPieChart(int width, int height, String title) {
    DefaultPieDataset dataset = new DefaultPieDataset();
    for (int x = 0; x < labels.length; x++) {
        dataset.setValue(labels[x], values[x]);

    }// w w w .  j  av  a  2  s  .c  om
    PiePlot plot = new PiePlot(dataset);
    plot.setNoDataMessage("No data available");
    plot.setCircular(true);

    plot.setLabelGap(0);

    plot.setLabelFont(new Font("Verdana", Font.BOLD, 10));
    plot.setLabelGenerator(new PieSectionLabelGenerator() {

        @Override
        public String generateSectionLabel(PieDataset pd, Comparable cmprbl) {
            return valuesMap.get(cmprbl.toString());
        }

        @Override
        public AttributedString generateAttributedSectionLabel(PieDataset pd, Comparable cmprbl) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });
    plot.setSimpleLabels(true);

    plot.setLabelBackgroundPaint(null);
    plot.setLabelShadowPaint(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelOutlinePaint(null);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setInteriorGap(0);
    plot.setShadowPaint(Color.WHITE);
    plot.setOutlineVisible(false);
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(1.2f));
    plot.setInteriorGap(0.05);
    for (String label : labels) {
        plot.setSectionPaint(label, defaultKeyColorMap.get(label));
    }

    JFreeChart chart = new JFreeChart(plot);
    //        chart.setTitle(new TextTitle(title, new Font("Verdana", Font.BOLD, 13)));
    chart.setBorderPaint(null);
    chart.setBackgroundPaint(null);
    chart.getLegend().setFrame(BlockBorder.NONE);
    chart.getLegend().setItemFont(new Font("Verdana", Font.PLAIN, 10));
    String imgUrl = saveToFile(chart, width, height);

    return imgUrl;

}

From source file:org.psystems.dicom.browser.server.stat.UseagStoreChartServlet.java

public JFreeChart getChart() {

    PreparedStatement psSelect = null;

    try {/* w w w .j a v  a2  s  .c o m*/

        Connection connection = Util.getConnection("main", getServletContext());
        long dcmSizes = 0;
        long imgSizes = 0;
        //
        // ALL_IMAGE_SIZE
        // ALL_DCM_SIZE

        // psSelect = connection
        // .prepareStatement("SELECT ID, METRIC_NAME, METRIC_DATE, METRIC_VALUE_LONG "
        // + " FROM WEBDICOM.DAYSTAT WHERE METRIC_NAME = ?");

        psSelect = connection.prepareStatement(
                "SELECT SUM(METRIC_VALUE_LONG) S " + " FROM WEBDICOM.DAYSTAT WHERE METRIC_NAME = ?");

        psSelect.setString(1, "ALL_DCM_SIZE");
        ResultSet rs = psSelect.executeQuery();
        while (rs.next()) {
            dcmSizes = rs.getLong("S");
        }
        rs.close();

        psSelect.setString(1, "ALL_IMAGE_SIZE");
        rs = psSelect.executeQuery();
        while (rs.next()) {
            imgSizes = rs.getLong("S");
        }
        rs.close();

        String dcmRootDir = getServletContext().getInitParameter("webdicom.dir.src");
        long totalSize = new File(dcmRootDir).getTotalSpace(); //TODO !
        long freeSize = new File(dcmRootDir).getFreeSpace();
        long busySize = totalSize - freeSize;

        //         System.out.println("!!! totalSize=" + totalSize + " freeSize="+freeSize);

        long diskEmpty = freeSize - imgSizes - dcmSizes;

        //         double KdiskEmpty = (double)diskEmpty/(double)totalSize;
        //         System.out.println("!!! " + KdiskEmpty);

        double KdiskBusi = (double) busySize / (double) totalSize * 100;
        //         System.out.println("!!! KdiskBusi=" + KdiskBusi);

        double KdcmSizes = (double) dcmSizes / (double) totalSize * 100;
        //         System.out.println("!!! KdcmSizes=" + KdcmSizes);

        double KimgSizes = (double) imgSizes / (double) totalSize * 100;
        //         System.out.println("!!! KimgSizes=" + KimgSizes);

        double KdiskFree = (double) freeSize / (double) (totalSize - KdcmSizes - KimgSizes) * 100;
        //         System.out.println("!!! KdiskFree=" + KdiskFree);

        DefaultPieDataset dataset = new DefaultPieDataset();
        dataset.setValue("??? (DCM-) " + dcmSizes / 1000 + " .", KdcmSizes);
        dataset.setValue("? (JPG-) " + imgSizes / 1000 + " .", KimgSizes);
        dataset.setValue("?  " + busySize / 1000 + " .", KdiskBusi);
        dataset.setValue(" " + freeSize / 1000 + " .", KdiskFree);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        JFreeChart chart = ChartFactory.createPieChart(
                "? ? ??  ?",
                dataset, legend, tooltips, urls);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        // chart.setBorderVisible(true);
        // chart.setPadding(new RectangleInsets(20 ,20,20,20));

        return chart;

    } catch (SQLException e) {
        logger.error(e);
        e.printStackTrace();
    } finally {

        try {
            if (psSelect != null)
                psSelect.close();
        } catch (SQLException e) {
            logger.error(e);
        }
    }
    return null;

}

From source file:org.ietr.preesm.mapper.ui.BestCostPlotter.java

/**
 * Creates a chart./*  ww w.  j a  v a 2s  . c o  m*/
 * 
 * @return A chart.
 */
private JFreeChart createChart(String title) {

    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
    this.datasets = new TimeSeriesCollection[subplotCount];

    for (int i = 0; i < subplotCount; i++) {
        this.lastValue[i] = 100.0;
        final TimeSeries series = new TimeSeries("Real Time", Millisecond.class);
        this.datasets[i] = new TimeSeriesCollection(series);
        final NumberAxis rangeAxis = new NumberAxis("Schedule");
        rangeAxis.setAutoRangeIncludesZero(false);
        final XYPlot subplot = new XYPlot(this.datasets[i], null, rangeAxis, new XYLineAndShapeRenderer());

        subplot.setBackgroundPaint(Color.white);
        subplot.setDomainGridlinePaint(Color.lightGray);
        subplot.setRangeGridlinePaint(Color.lightGray);
        plot.add(subplot);
    }

    final JFreeChart chart = new JFreeChart(title, plot);

    chart.removeLegend();
    // chart.getLegend().setPosition(RectangleEdge.BOTTOM);

    chart.setBorderPaint(Color.lightGray);
    chart.setBorderVisible(true);

    Paint p = GanttPlotter.getBackgroundColorGradient();
    chart.setBackgroundPaint(p);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.black);

    final ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);

    return chart;

}

From source file:LoggerGUI.DataLogger.java

public DataLogger(String title) {
    super(title);
    initialize();//from w  w  w. jav a  2s. c o m

    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
    this.datasets = new TimeSeriesCollection[INPUT_COUNT];

    this.lastValue[0] = 100.0;
    this.lastValue[1] = 100.0;
    this.lastValue[2] = 100.0;
    this.lastValue[3] = 100.0;
       
        
        
       
        
    final TimeSeries s0 = new TimeSeries("A0", Millisecond.class);
    final TimeSeries s1 = new TimeSeries("A1", Millisecond.class);
    final TimeSeries s2 = new TimeSeries("A2", Millisecond.class);
    final TimeSeries s3 = new TimeSeries("A3", Millisecond.class);
        
        
        
    this.datasets[0] = new TimeSeriesCollection(s0);
    this.datasets[1] = new TimeSeriesCollection(s1);
    this.datasets[2] = new TimeSeriesCollection(s2);
    this.datasets[3] = new TimeSeriesCollection(s3);
       
        

    final NumberAxis rangeAxis = new NumberAxis("ADC Signal");

    rangeAxis.setAutoRangeIncludesZero(false);
    XYPlot subplot;

        
    XYLineAndShapeRenderer renderer =  new XYLineAndShapeRenderer(true,false);
    XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(true,false);
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true,false);
    XYLineAndShapeRenderer renderer3 = new XYLineAndShapeRenderer(true,false);
        
    subplot= new XYPlot(
            new TimeSeriesCollection(), null, rangeAxis, new XYLineAndShapeRenderer(true,false)
    );
       
    plot.add(subplot);
       
        
        
    renderer.setBaseShapesVisible(false);
    renderer.setSeriesPaint(0, Color.red);
    subplot.setDataset(0,datasets[0]);
    subplot.setRenderer(0,renderer);
        
        
    renderer1.setBaseShapesVisible(false);
    renderer1.setSeriesPaint(0, Color.blue);
    subplot.setDataset(1,datasets[1]);
    subplot.setRenderer(1,renderer1);
        
        
    renderer2.setBaseShapesVisible(false);
    renderer2.setSeriesPaint(0, Color.black);
    subplot.setDataset(2,datasets[2]);
    subplot.setRenderer(2,renderer2);
        
    subplot.getRendererForDataset(subplot.getDataset(0)).setSeriesPaint(0, Color.red); 
    subplot.getRendererForDataset(subplot.getDataset(1)).setSeriesPaint(1, Color.blue);
    subplot.getRendererForDataset(subplot.getDataset(2)).setSeriesPaint(2, Color.black);
        
    renderer3.setBaseShapesVisible(false);
    renderer3.setSeriesPaint(0, Color.green);
    subplot.setDataset(3,datasets[3]);
    subplot.setRenderer(3,renderer3);
        
        
        
    final JFreeChart chart = new JFreeChart("Data Logger", plot);
    chart.setBorderPaint(Color.black);
    chart.setBorderVisible(true);
    chart.setBackgroundPaint(Color.white);
        
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    final ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(20000.0);  // 60 seconds

    
    final JPanel content = new JPanel(new BorderLayout());

    final ChartPanel chartPanel = new ChartPanel(chart);
    content.add(chartPanel);

    final JPanel buttonPanel = new JPanel(new FlowLayout());
        
    content.add(buttonPanel, BorderLayout.NORTH);
    chartPanel.setPreferredSize(new java.awt.Dimension(600, 600));
    chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setContentPane(content);
        
        
}

From source file:project16.Home16.java

void RenderChart() {
    CategoryDataset ds = createDataset();

    JFreeChart chart = ChartFactory.createStackedAreaChart("", "", "", ds);
    chart.setBackgroundPaint(new Color(54, 63, 73));
    chart.setBorderVisible(false);//from  w ww . jav a  2 s  .  com
    chart.setBorderPaint(new Color(54, 63, 73));
    chart.getCategoryPlot().setBackgroundPaint(new Color(54, 63, 73));
    chart.getCategoryPlot().setDomainGridlinePaint(new Color(54, 63, 73));
    chart.getCategoryPlot().setDomainGridlinesVisible(false);
    chart.getCategoryPlot().setOutlinePaint(new Color(54, 63, 73));

    ChartPanel cp = new ChartPanel(chart);
    cp.setBackground(new Color(54, 63, 73));

    pnl_chart.add(cp, BorderLayout.CENTER);
    pnl_chart.validate();

}

From source file:org.jfree.eastwood.ChartEngine.java

/**
 * Creates a pie chart with 3D effect.//from   www.  j av  a2 s  .c om
 *
 * @return A pie chart.
 */
private static JFreeChart createPieChart3D() {
    JFreeChart chart = ChartFactory.createPieChart3D(null, null, false, true, false);
    chart.setBackgroundPaint(Color.white);
    chart.setBorderPaint(Color.white);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setDarkerSides(true);
    plot.setBaseSectionOutlinePaint(new Color(0, 0, 0, 0));
    plot.setStartAngle(0.0);
    plot.setInteriorGap(0.10);
    plot.setLabelGenerator(null);
    plot.setOutlineVisible(false);
    plot.setLabelBackgroundPaint(Color.white);
    plot.setLabelOutlinePaint(null);
    plot.setLabelShadowPaint(null);
    plot.setLabelPadding(RectangleInsets.ZERO_INSETS);
    plot.setLabelFont(new Font("Dialog", Font.PLAIN, 12));
    plot.setLabelPaint(Color.darkGray);
    plot.setToolTipGenerator(new StandardPieToolTipGenerator("{2}"));
    return chart;
}

From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java

/**
 * Creates a new monitor panel./*  w  ww. j a v  a2  s  . co  m*/
 *
 * @return the monitor panel
 */
public JPanel createPanel() {

    JPanel mainPanel = new JPanel(new BorderLayout());
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
    this.datasets = new TimeSeriesCollection[4];
    this.datasets[0] = addSubPlot(plot, "#Tiles");
    this.datasets[1] = addSubPlot(plot, "#Hits");
    this.datasets[2] = addSubPlot(plot, "#Misses");
    this.datasets[3] = addSubPlot(plot, "Mem (kB)");

    JFreeChart chart = new JFreeChart(plot);
    LegendTitle legend = (LegendTitle) chart.getSubtitle(0);
    legend.setPosition(RectangleEdge.RIGHT);
    legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4));
    chart.setBorderPaint(Color.black);
    chart.setBorderVisible(true);
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(60000.0); // 60 seconds

    textarea = new JTextArea();
    tableModel = new TileCacheTableModel();
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 470));
    chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    tabbedPane = new JTabbedPane();
    tabbedPane.add(CACHE_INFO_TAB, new JScrollPane(textarea));
    tabbedPane.add(CACHE_CHART_TAB, chartPanel);
    tabbedPane.add(IMAGES_TAB, new JScrollPane(new JTable(tableModel)));
    tabbedPane.setSelectedIndex(0);

    mainPanel.add(tabbedPane);

    return mainPanel;
}

From source file:dk.netarkivet.harvester.harvesting.monitor.StartedJobHistoryChartGen.java

/**
 * Generates a chart in PNG format./*w  ww  . ja va 2 s  .c  o m*/
 * @param outputFile the output file, it should exist.
 * @param pxWidth the image width in pixels.
 * @param pxHeight the image height in pixels.
 * @param chartTitle the chart title, may be null.
 * @param xAxisTitle the x axis title
 * @param yDataSeriesRange the axis range (null for auto)
 * @param yDataSeriesTitles the Y axis titles.
 * @param timeValuesInSeconds the time values in seconds
 * @param yDataSeries the Y axis value series.
 * @param yDataSeriesColors the Y axis value series drawing colors.
 * @param yDataSeriesTickSuffix TODO explain argument yDataSeriesTickSuffix
 * @param drawBorder draw, or not, the border.
 * @param backgroundColor the chart background color.
 */
final void generatePngChart(File outputFile, int pxWidth, int pxHeight, String chartTitle, String xAxisTitle,
        String[] yDataSeriesTitles, double[] timeValuesInSeconds, double[][] yDataSeriesRange,
        double[][] yDataSeries, Color[] yDataSeriesColors, String[] yDataSeriesTickSuffix, boolean drawBorder,
        Color backgroundColor) {

    // Domain axis
    NumberAxis xAxis = new NumberAxis(xAxisTitle);
    xAxis.setFixedDimension(CHART_AXIS_DIMENSION);
    xAxis.setLabelPaint(Color.black);
    xAxis.setTickLabelPaint(Color.black);

    double maxSeconds = getMaxValue(timeValuesInSeconds);
    TimeAxisResolution xAxisRes = TimeAxisResolution.findTimeUnit(maxSeconds);
    xAxis.setTickUnit(new NumberTickUnit(xAxisRes.tickStep));
    double[] scaledTimeValues = xAxisRes.scale(timeValuesInSeconds);

    String tickSymbol = I18N.getString(locale, "running.job.details.chart.timeunit.symbol." + xAxisRes.name());
    xAxis.setNumberFormatOverride(new DecimalFormat("###.##'" + tickSymbol + "'"));

    // First dataset
    String firstDataSetTitle = yDataSeriesTitles[0];
    XYDataset firstDataSet = createXYDataSet(firstDataSetTitle, scaledTimeValues, yDataSeries[0]);
    Color firstDataSetColor = yDataSeriesColors[0];

    // First range axis
    NumberAxis firstYAxis = new NumberAxis(firstDataSetTitle);

    firstYAxis.setFixedDimension(CHART_AXIS_DIMENSION);
    setAxisRange(firstYAxis, yDataSeriesRange[0]);
    firstYAxis.setLabelPaint(firstDataSetColor);
    firstYAxis.setTickLabelPaint(firstDataSetColor);
    String firstAxisTickSuffix = yDataSeriesTickSuffix[0];
    if (firstAxisTickSuffix != null && !firstAxisTickSuffix.isEmpty()) {
        firstYAxis.setNumberFormatOverride(new DecimalFormat("###.##'" + firstAxisTickSuffix + "'"));
    }

    // Create the plot with domain axis and first range axis
    XYPlot plot = new XYPlot(firstDataSet, xAxis, firstYAxis, null);

    XYLineAndShapeRenderer firstRenderer = new XYLineAndShapeRenderer(true, false);
    plot.setRenderer(firstRenderer);

    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    firstRenderer.setSeriesPaint(0, firstDataSetColor);

    // Now iterate on next axes
    for (int i = 1; i < yDataSeries.length; i++) {
        // Create axis
        String seriesTitle = yDataSeriesTitles[i];
        Color seriesColor = yDataSeriesColors[i];
        NumberAxis yAxis = new NumberAxis(seriesTitle);

        yAxis.setFixedDimension(CHART_AXIS_DIMENSION);
        setAxisRange(yAxis, yDataSeriesRange[i]);

        yAxis.setLabelPaint(seriesColor);
        yAxis.setTickLabelPaint(seriesColor);

        String yAxisTickSuffix = yDataSeriesTickSuffix[i];
        if (yAxisTickSuffix != null && !yAxisTickSuffix.isEmpty()) {
            yAxis.setNumberFormatOverride(new DecimalFormat("###.##'" + yAxisTickSuffix + "'"));
        }

        // Create dataset and add axis to plot
        plot.setRangeAxis(i, yAxis);
        plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_LEFT);
        plot.setDataset(i, createXYDataSet(seriesTitle, scaledTimeValues, yDataSeries[i]));
        plot.mapDatasetToRangeAxis(i, i);
        XYItemRenderer renderer = new StandardXYItemRenderer();
        renderer.setSeriesPaint(0, seriesColor);
        plot.setRenderer(i, renderer);
    }

    // Create the chart
    JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    // Customize rendering
    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setBorderPaint(Color.BLACK);

    // Render image
    try {
        ChartUtilities.saveChartAsPNG(outputFile, chart, pxWidth, pxHeight);
    } catch (IOException e) {
        LOG.error("Chart export failed", e);
    }
}

From source file:code.google.gclogviewer.GCLogViewer.java

private JFreeChart createGCTrendChart(GCLogData data) {
    XYDataset gcTrendDataset = createGCTrendDataset(data, null);
    JFreeChart chart = ChartFactory.createXYLineChart("GC Trend", "Time(S)", "Pause Time(ms)", gcTrendDataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(java.awt.Color.white);
    chart.setBorderVisible(true);/*w w w .  java  2s .  c  om*/
    chart.setBorderPaint(java.awt.Color.BLACK);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(java.awt.Color.lightGray);
    plot.setDomainGridlinePaint(java.awt.Color.white);
    plot.setRangeGridlinePaint(java.awt.Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.getRangeAxis().setFixedDimension(15.0);
    return chart;
}