Example usage for org.jfree.chart JFreeChart clearSubtitles

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

Introduction

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

Prototype

public void clearSubtitles() 

Source Link

Document

Clears all subtitles from the chart and sends a ChartChangeEvent to all registered listeners.

Usage

From source file:org.geoserver.monitor.web.ActivityChartBasePanel.java

JFreeChart createTimeSeriesChart(String title, String timeAxisLabel, String valueAxisLabel, XYDataset dataset) {

    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02); // reduce the default margins 
    timeAxis.setUpperMargin(0.02);/*from w  ww.  ja v  a  2 s  .c o  m*/
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false); // override default

    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

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

    JFreeChart chart = new JFreeChart(plot);

    //TextTitle t = new TextTitle(title);
    //t.setTextAlignment(HorizontalAlignment.LEFT);

    //chart.setTitle(t);
    chart.setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);
    chart.clearSubtitles();

    return chart;
}

From source file:at.ac.tuwien.inso.subcat.ui.widgets.DistributionChart.java

public void setChart(JFreeChart chart) {
    timeChart.setChart(chart);
    // Force the view to update the chart:
    chart.clearSubtitles();
}

From source file:edu.ucla.stat.SOCR.chart.demo.LineChartDemo1.java

/**
 * Creates a sample chart./*from   ww  w .j  a v a  2 s  .  c  o  m*/
 * 
 * @param dataset  a dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {
    if (isDemo) {
        chartTitle = "Java Standard Class Library";
        domainLabel = "Release";
        rangeLabel = "Class Count";
    } else
        chartTitle = "Line Chart";

    // create the chart...
    JFreeChart chart = ChartFactory.createLineChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            !legendPanelOn, // include legend
            true, // tooltips
            false // urls
    );

    if (isDemo) {
        chart.addSubtitle(new TextTitle("Number of Classes By Release"));
        TextTitle source = new TextTitle(
                "Source: Java In A Nutshell (4th Edition) " + "by David Flanagan (O'Reilly)");
        source.setFont(new Font("SansSerif", Font.PLAIN, 10));
        source.setPosition(RectangleEdge.BOTTOM);
        source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        chart.addSubtitle(source);
    } else {
        chart.clearSubtitles();
    }

    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // customise the renderer...
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(Color.white);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    setCategorySummary(dataset);
    return chart;
}