Example usage for org.jfree.chart JFreeChart DEFAULT_TITLE_FONT

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

Introduction

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

Prototype

Font DEFAULT_TITLE_FONT

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

Click Source Link

Document

The default font for titles.

Usage

From source file:KIDLYFactory.java

/**
 * Creates a ring chart with default settings.
 * <P>/*  w  ww  . j av a2s  .c o  m*/
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param locale  the locale (<code>null</code> not permitted).
 *
 * @return A ring chart.
 *
 * @since 1.0.7
 */
public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, boolean tooltips,
        Locale locale) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
* Creates a chart that displays multiple pie plots.  The chart object     
* returned by this method uses a {@link MultiplePiePlot} instance as the    
* plot.    //from  w w  w .  jav a  2s  .c  om
*    
* @param title  the chart title (<code>null</code> permitted).    
* @param dataset  the dataset (<code>null</code> permitted).    
* @param order  the order that the data is extracted (by row or by column)    
*               (<code>null</code> not permitted).    
* @param legend  include a legend?    
* @param tooltips  generate tooltips?    
* @param urls  generate URLs?    
*    
* @return A chart.    
*/
public static JFreeChart createMultiplePieChart(String title, CategoryDataset dataset, TableOrder order,
        boolean legend, boolean tooltips, boolean urls) {

    if (order == null) {
        throw new IllegalArgumentException("Null 'order' argument.");
    }
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);

    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }

    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}

From source file:KIDLYFactory.java

/**
 * Creates a ring chart with default settings.
 * <P>//w w w.j av a 2  s . c o  m
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A ring chart.
 */
public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, boolean tooltips,
        boolean urls) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;

}

From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java

private static JFreeChart createMultiplePieChart3D_2(CategoryDataset dataset) {

    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(TableOrder.BY_ROW);
    plot.setBackgroundPaint(null);/*  w  w w.jav a 2s .c o  m*/
    plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(seriesTitle);
    pieChart.removeLegend();
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);

    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }

    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }

    JFreeChart chart = new JFreeChart("MultiplePie Chart 3D Demo 2", JFreeChart.DEFAULT_TITLE_FONT, plot,
            legend);
    chart.setBackgroundPaint(Color.white);

    return chart;

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample thermometer chart.
 *
 * @return a sample thermometer chart.//from  ww  w.j a  v  a  2 s.  co m
 */
public JFreeChart createThermometerChart() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("meter.thermo.title");
    final String subtitleStr = this.resources.getString("meter.thermo.subtitle");
    final String units = this.resources.getString("meter.thermo.units");

    final DefaultValueDataset data = new DefaultValueDataset(new Double(34.0));
    final ThermometerPlot plot = new ThermometerPlot(data);
    plot.setUnits(units);
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    return chart;

}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
* Creates a 3D pie chart using the specified dataset.  The chart object     
* returned by this method uses a {@link PiePlot3D} instance as the    
* plot.    //ww w .  j  av  a2s.  c o  m
*    
* @param title  the chart title (<code>null</code> permitted).    
* @param dataset  the dataset for the chart (<code>null</code> permitted).    
* @param legend  a flag specifying whether or not a legend is required.    
* @param tooltips  configure chart to generate tool tips?    
* @param locale  the locale (<code>null</code> not permitted).    
*    
* @return A pie chart.    
*     
* @since 1.0.7    
*/
public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips,
        Locale locale) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}

From source file:org.jfree.chart.demo.JFreeChartDemoBase.java

/**
 * Creates and returns a sample meter chart.
 *
 * @return a meter chart.//from  www.jav  a  2s . c o  m
 */
public JFreeChart createMeterChartCircle() {

    // create a default chart based on some sample data...
    final String title = this.resources.getString("meter.meter.title");
    final String subtitleStr = this.resources.getString("meter.meter.subtitle");
    //String units = resources.getString("meter.meter.units");
    //DefaultMeterDataset data = DemoDatasetFactory.createMeterDataset();
    final DefaultValueDataset data = new DefaultValueDataset(50.0);
    //data.setUnits(units);
    final MeterPlot plot = new MeterPlot(data);
    plot.setMeterAngle(270);
    plot.setDialShape(DialShape.CIRCLE);
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    // then customise it a little...
    final TextTitle subtitle = new TextTitle(subtitleStr, new Font("SansSerif", Font.BOLD, 12));
    chart.addSubtitle(subtitle);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));
    return chart;
}

From source file:KIDLYFactory.java

/**
 * Creates a chart that displays multiple pie plots.  The chart object
 * returned by this method uses a {@link MultiplePiePlot} instance as the
 * plot./*from w  w  w.j  a v  a2 s .  co  m*/
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               (<code>null</code> not permitted).
 * @param legend  include a legend?
 * @param tooltips  generate tooltips?
 * @param urls  generate URLs?
 *
 * @return A chart.
 */
public static JFreeChart createMultiplePieChart(String title, CategoryDataset dataset, TableOrder order,
        boolean legend, boolean tooltips, boolean urls) {

    if (order == null) {
        throw new IllegalArgumentException("Null 'order' argument.");
    }
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);

    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }

    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;

}

From source file:com.qspin.qtaste.reporter.testresults.html.HTMLReportFormatter.java

private void generatePieChart() {
    if (currentTestSuite == null) {
        return;//ww  w .j a  va2s  .  c o  m
    }

    File testSummaryFile = new File(reportFile.getParentFile(), testSummaryFileName);
    File tempTestSummaryFile = new File(testSummaryFile.getPath() + ".tmp");

    final DefaultPieDataset pieDataSet = new DefaultPieDataset();

    pieDataSet.setValue("Passed", new Integer(currentTestSuite.getNbTestsPassed()));
    pieDataSet.setValue("Failed", new Integer(currentTestSuite.getNbTestsFailed()));
    pieDataSet.setValue("Tests in error", new Integer(currentTestSuite.getNbTestsNotAvailable()));
    pieDataSet.setValue("Not executed",
            new Integer(currentTestSuite.getNbTestsToExecute() - currentTestSuite.getNbTestsExecuted()));
    JFreeChart chart = null;
    final boolean drilldown = true;

    // create the chart...
    if (drilldown) {
        final PiePlot plot = new PiePlot(pieDataSet);

        Color[] colors = { new Color(100, 230, 40), new Color(210, 35, 35), new Color(230, 210, 40),
                new Color(100, 90, 40) };
        PieRenderer renderer = new PieRenderer(colors);
        renderer.setColor(plot, (DefaultPieDataset) pieDataSet);

        plot.setURLGenerator(new StandardPieURLGenerator("pie_chart_detail.jsp"));
        plot.setLabelGenerator(new TestSectiontLabelPieGenerator());
        chart = new JFreeChart("Test summary", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    } else {
        chart = ChartFactory.createPieChart("Test summary", // chart title
                pieDataSet, // data
                true, // include legend
                true, false);
    }

    chart.setBackgroundPaint(java.awt.Color.white);

    try {
        final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
        ChartUtilities.saveChartAsPNG(tempTestSummaryFile, chart, 600, 400, info);
    } catch (IOException e) {
        logger.error("Problem saving png chart", e);
    }

    testSummaryFile.delete();
    if (!tempTestSummaryFile.renameTo(testSummaryFile)) {
        logger.error("Couldn't rename test summary file " + tempTestSummaryFile + " into " + testSummaryFile);
    }
}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
* Creates a 3D pie chart using the specified dataset.  The chart object     
* returned by this method uses a {@link PiePlot3D} instance as the    
* plot.    /*  ww w. ja  va2s  .com*/
*    
* @param title  the chart title (<code>null</code> permitted).    
* @param dataset  the dataset for the chart (<code>null</code> permitted).    
* @param legend  a flag specifying whether or not a legend is required.    
* @param tooltips  configure chart to generate tool tips?    
* @param urls  configure chart to generate URLs?    
*    
* @return A pie chart.    
*/
public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips,
        boolean urls) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

}