Example usage for org.jfree.chart.renderer.xy XYStepAreaRenderer AREA_AND_SHAPES

List of usage examples for org.jfree.chart.renderer.xy XYStepAreaRenderer AREA_AND_SHAPES

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYStepAreaRenderer AREA_AND_SHAPES.

Prototype

int AREA_AND_SHAPES

To view the source code for org.jfree.chart.renderer.xy XYStepAreaRenderer AREA_AND_SHAPES.

Click Source Link

Document

Useful constant for specifying the type of rendering (area and shapes).

Usage

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

protected JFreeChart computeXYChart(final XYDataset xyDataset) {
    final JFreeChart rtn;
    if (xyDataset instanceof TimeSeriesCollection) {
        rtn = ChartFactory.createTimeSeriesChart(computeTitle(), getDomainTitle(), getRangeTitle(), xyDataset,
                isShowLegend(), false, false);
    } else {/*www .  j  a v  a2s  . c o  m*/
        final PlotOrientation orientation = computePlotOrientation();
        rtn = ChartFactory.createXYLineChart(computeTitle(), getDomainTitle(), getRangeTitle(), xyDataset,
                orientation, isShowLegend(), false, false);
    }

    final String chartType = getChartType();
    if (STEP_AREA_CHART_STR.equals(chartType)) {
        final XYItemRenderer renderer;
        if (isMarkersVisible()) {
            renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES);
        } else {
            renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA);
        }
        rtn.getXYPlot().setRenderer(renderer);
    } else if (STEP_CHART_STR.equals(chartType)) {
        rtn.getXYPlot().setRenderer(new XYStepRenderer(null, null));
    } else if (DIFFERENCE_CHART_STR.equals(chartType)) {
        rtn.getXYPlot().setRenderer(new XYDifferenceRenderer());
    }
    configureLogarithmicAxis(rtn.getXYPlot());
    return rtn;
}

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

private static JFreeChart createXYStepAreaChart(XYDataset dataset) {

    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);

    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips) {
        toolTipGenerator = new StandardXYToolTipGenerator();
    }/*from  w w  w.j av a 2 s . com*/

    XYURLGenerator urlGenerator = null;
    if (urls) {
        urlGenerator = new StandardXYURLGenerator();
    }
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator,
            urlGenerator);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(orientation);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart("XYStepArea Chart Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    yAxis.setNumberFormatOverride(MyNumberFormat.getMyNumberFormat());

    return chart;
}

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

/**    
 * Creates a filled stepped XY plot with default settings.    
 *    /*from   w  ww . ja v  a  2s  .  c  o m*/
 * @param title  the chart title (<code>null</code> permitted).    
 * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).    
 * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).    
 * @param dataset  the dataset for the chart (<code>null</code> permitted).    
 * @param orientation  the plot orientation (horizontal or vertical)     
 *                     (<code>null</code> NOT 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 chart.    
 */
public static JFreeChart createXYStepAreaChart(String title, String xAxisLabel, String yAxisLabel,
        XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);

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

    XYURLGenerator urlGenerator = null;
    if (urls) {
        urlGenerator = new StandardXYURLGenerator();
    }
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator,
            urlGenerator);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(orientation);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    return chart;
}

From source file:KIDLYFactory.java

/**
 * Creates a filled stepped XY plot with default settings.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
 * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param orientation  the plot orientation (horizontal or vertical)
 *                     (<code>null</code> NOT 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 chart.//  w  w w  . j  a  v  a  2  s. com
 */
public static JFreeChart createXYStepAreaChart(String title, String xAxisLabel, String yAxisLabel,
        XYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {

    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);

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

    XYURLGenerator urlGenerator = null;
    if (urls) {
        urlGenerator = new StandardXYURLGenerator();
    }
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator,
            urlGenerator);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setOrientation(orientation);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}

From source file:org.jfree.chart.ChartFactory.java

/**
 * Creates a filled stepped XY plot with default settings.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param xAxisLabel  a label for the X-axis ({@code null} permitted).
 * @param yAxisLabel  a label for the Y-axis ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 *
 * @return A chart.//from w  w  w  .j  av  a2 s  . co m
 */
public static JFreeChart createXYStepAreaChart(String title, String xAxisLabel, String yAxisLabel,
        XYDataset dataset) {

    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);

    XYToolTipGenerator toolTipGenerator = new StandardXYToolTipGenerator();
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator,
            null);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    plot.setRenderer(renderer);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;
}