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:com.pureinfo.srm.reports.impl.MyChartFactory.java

public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }//from ww  w  . j av  a  2 s.  c o m
    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    BarRenderer3D renderer = new BarRenderer3D() {
        /**
         * @see org.jfree.chart.renderer.AbstractRenderer#getItemPaint(int, int)
         */
        public Paint getItemPaint(int _nRow, int _nColumn) {
            return getSeriesPaint(_nColumn);
        }
    };
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the 
        // right way around
        plot.setRowRenderingOrder(SortOrder.DESCENDING);
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75f);

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

    return chart;

}

From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerVsTotalPrediction.java

public static JPanel createPanel() {
    //Axis configuration
    NumberAxis sampleAxis = new NumberAxis("Sample");
    sampleAxis.setAutoRangeIncludesZero(false);
    NumberAxis powerAxis = new NumberAxis("Power (Watts)");
    powerAxis.setAutoRangeIncludesZero(false);

    XYSplineRenderer xysplinerenderer = new XYSplineRenderer();

    XYPlot xyplot = new XYPlot(data, sampleAxis, powerAxis, xysplinerenderer);
    for (int i = 0; i < data.getSeriesCount(); i++) {
        xyplot.getRenderer().setSeriesShape(i, new Rectangle());
    }//from   w  ww .ja  v a2 s .com

    //Panel layout configuration
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));

    JFreeChart jfreechart = new JFreeChart(NAME, JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);

    ChartUtilities.applyCurrentTheme(jfreechart);
    ChartPanel chartpanel = new ChartPanel(jfreechart);

    return chartpanel;
}

From source file:org.quickserver.net.qsadmin.plugin.stats.MeterChart.java

public MeterChart(String title) {
    data = new DefaultValueDataset(0.0);
    meterplot = new MeterPlot(data);
    range = new Range(0, 20000);
    bgColor = new Color(238, 238, 230, 255);

    meterplot.setRange(range);//ww  w .j a  v a 2s. c  om
    meterplot.setNormalRange(new Range(0, 4000));
    meterplot.setWarningRange(new Range(4000, 9000));
    meterplot.setCriticalRange(new Range(9000, 20000));

    meterplot.setUnits("");
    meterplot.setDrawBorder(false);
    meterplot.setInsets(new Insets(2, 2, 2, 2));

    meterchart = new JFreeChart(title + " Meter", JFreeChart.DEFAULT_TITLE_FONT, meterplot, false);
    meterchart.setBackgroundPaint(bgColor);
    panelMeter = new ChartPanel(meterchart);
    setLayout(new BorderLayout());
    add(panelMeter, BorderLayout.CENTER);
}

From source file:de.berlios.statcvs.xml.chart.AbstractCombinedChart.java

/**
 * @param settings//w w w  . ja va2s.co m
 * @param defaultFilename
 * @param defaultSubtitle
 */
public AbstractCombinedChart(ReportSettings settings, String defaultFilename, String defaultSubtitle) {
    super(settings, defaultFilename, defaultSubtitle);

    ValueAxis domainAxis = new DateAxis(I18n.tr("Date"));
    domainAxis.setVerticalTickLabels(true);

    combinedPlot = new CombinedDomainXYPlot(domainAxis);
    combinedPlot.setGap(10);
    combinedPlot.setOrientation(PlotOrientation.VERTICAL);

    JFreeChart chart = new JFreeChart(settings.getProjectName(), JFreeChart.DEFAULT_TITLE_FONT, combinedPlot,
            false);
    setChart(chart);
}

From source file:jgnash.ui.report.compiled.SecurityHighLowChart.java

private static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel,
        AbstractXYDataset data, boolean legend) {

    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false);

    HighLowRenderer renderer = new HighLowRenderer();
    renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());

    XYPlot plot = new XYPlot(data, timeAxis, valueAxis, renderer);

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
}

From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.Thermometer.java

/**
 * Creates a chart of type thermometer.//from   w  w w  .j  av a2s .  c  om
 * 
 * @return A chart thermometer.
 */
public JFreeChart createChart() {
    logger.debug("IN");

    if (dataset == null) {
        logger.debug("The dataset to be represented is null");
        return null;
    }

    ThermometerPlot plot = new ThermometerPlot((ValueDataset) dataset);
    logger.debug("Created the new Thermometer Plot");
    JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    logger.debug("Created the new Chart");
    chart.setBackgroundPaint(color);
    logger.debug("Setted the background color of the chart");

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    logger.debug("Setted the title of the chart");
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
        logger.debug("Setted the subtitle of the chart");
    }

    plot.setInsets(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setPadding(new RectangleInsets(10.0, 10.0, 10.0, 10.0));
    plot.setThermometerStroke(new BasicStroke(2.0f));
    plot.setThermometerPaint(Color.lightGray);
    plot.setGap(3);
    plot.setValueLocation(3);
    plot.setRange(lower, upper);
    plot.setUnits(ThermometerPlot.UNITS_NONE);
    logger.debug("Setted all the properties of the plot");

    // set subranges   
    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval subrange = (KpiInterval) iterator.next();
        int range = 0;
        //For the thermometer the number of intervals is forced to 3 and they have to have as labels the following ones
        if (subrange.getLabel().equalsIgnoreCase("NORMAL"))
            range = (ThermometerPlot.NORMAL);
        else if (subrange.getLabel().equalsIgnoreCase("WARNING"))
            range = (ThermometerPlot.WARNING);
        else if (subrange.getLabel().equalsIgnoreCase("CRITICAL"))
            range = (ThermometerPlot.CRITICAL);

        plot.setSubrange(range, subrange.getMin(), subrange.getMax());
        if (subrange.getColor() != null) {
            plot.setSubrangePaint(range, subrange.getColor());
        }
        logger.debug("Setted new range of the plot");
    }

    logger.debug("OUT");
    return chart;
}

From source file:control.JGeraGraficos.java

private static JFreeChart createGraficoXY(String title, String categoryAxisLabel, String valueAxisLabel,
        IntervalXYDataset dataset) {// w  w w  .j a  v a 2  s.c o m

    NumberAxis domainAxis = new NumberAxis(categoryAxisLabel);
    domainAxis.setAutoRangeIncludesZero(false);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    XYBarRenderer renderer = new ClusteredXYBarRenderer();

    XYPlot plot = new XYPlot((XYDataset) dataset, domainAxis, valueAxis, renderer);

    plot.setOrientation(PlotOrientation.VERTICAL);

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

    return chart;
}

From source file:net.sourceforge.processdash.ui.web.reports.RadarChart.java

/** Create a radar chart. */
@Override/*  ww w.  j  a va  2 s.  c  o  m*/
public JFreeChart createChart() {
    maybeScaleDataAxes();
    CategoryDataset catData = data.catDataSource();
    PieDataset pieData = null;
    if (catData.getRowCount() == 1)
        pieData = DatasetUtilities.createPieDatasetForRow(catData, 0);
    else
        pieData = DatasetUtilities.createPieDatasetForColumn(catData, 0);

    RadarPlot plot = new RadarPlot(pieData);
    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    if (parameters.get("skipAxisLabels") != null)
        plot.setShowAxisLabels(false);
    String interiorGap = getParameter("interiorGap");
    if (interiorGap != null)
        try {
            plot.setInteriorGap(Integer.parseInt(interiorGap) / 100.0);
        } catch (NumberFormatException e) {
        }
    String interiorSpacing = getParameter("interiorSpacing");
    if (interiorSpacing != null)
        try {
            plot.setInteriorGap(Integer.parseInt(interiorSpacing) / 200.0);
        } catch (NumberFormatException e) {
        }

    return chart;
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.XYAreaChartExpression.java

public static JFreeChart createTimeSeriesChart(final String title, final String timeAxisLabel,
        final String valueAxisLabel, final XYDataset dataset, final boolean legend, final boolean tooltips,
        final boolean urls, final boolean stacked) {
    final ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02); // reduce the default margins
    timeAxis.setUpperMargin(0.02);/*www  .  j  av a2s. com*/
    final NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false); // override default
    final XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
        toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
    }

    XYURLGenerator urlGenerator = null;
    if (urls) {
        urlGenerator = new StandardXYURLGenerator();
    }

    final XYAreaRenderer2 renderer;
    if (stacked) {
        renderer = new StackedXYAreaRenderer2();
    } else {
        renderer = new XYAreaRenderer2();
    }
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    plot.setRenderer(renderer);

    return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
}

From source file:org.mwc.cmap.grideditor.chart.ChartBuilder.java

public JFreeChart buildChart() {
    final ValueAxis xAxis = myManager.createXAxis();
    final ValueAxis yAxis = myManager.createYAxis();
    final XYDataset data = myManager.getXYDataSet();
    final XYLineAndShapeRenderer renderer = new ColorRenderer();
    final XYPlot xyplot = new XYPlot(data, xAxis, yAxis, renderer);
    xyplot.setOrientation(PlotOrientation.HORIZONTAL);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    final JFreeChart result = new JFreeChart(myManager.getChartTitle(), JFreeChart.DEFAULT_TITLE_FONT, xyplot,
            false);/*from  w  w w . j av a  2s  . c  om*/
    ChartUtilities.applyCurrentTheme(result);
    return result;
}