Example usage for org.jfree.chart.renderer.xy XYErrorRenderer setBaseShapesVisible

List of usage examples for org.jfree.chart.renderer.xy XYErrorRenderer setBaseShapesVisible

Introduction

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

Prototype

public void setBaseShapesVisible(boolean flag) 

Source Link

Document

Sets the base 'shapes visible' flag and sends a RendererChangeEvent to all registered listeners.

Usage

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

private static JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    NumberAxis numberaxis1 = new NumberAxis("Y");
    XYErrorRenderer xyerrorrenderer = new XYErrorRenderer();
    xyerrorrenderer.setBaseLinesVisible(true);
    xyerrorrenderer.setBaseShapesVisible(false);
    XYPlot xyplot = new XYPlot(intervalxydataset, numberaxis, numberaxis1, xyerrorrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    JFreeChart jfreechart = new JFreeChart("XYErrorRenderer Demo 2", xyplot);
    jfreechart.setBackgroundPaint(Color.white);
    return jfreechart;
}

From source file:org.gumtree.vis.plot1d.Plot1D.java

/**
 * Creates a line chart (based on an {@link XYDataset}) with default
 * settings.//from  ww w .j a  v  a  2  s  .  co 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 The chart.
 */
public static JFreeChart createXYLineChart(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);
    LogarithmizableAxis xAxis = new LogarithmizableAxis(xAxisLabel);

    xAxis.setLogarithmic(false);
    xAxis.setAutoRangeIncludesZero(false);
    xAxis.setAllowNegativesFlag(true);
    xAxis.setLowerMargin(0.02);
    xAxis.setUpperMargin(0.02);
    //        NumberAxis yAxis = new NumberAxis(yAxisLabel);
    LogarithmizableAxis yAxis = new LogarithmizableAxis(yAxisLabel);
    yAxis.setAllowNegativesFlag(true);
    yAxis.setAutoRangeNextLogFlag(false);
    yAxis.setLowerMargin(0.02);
    yAxis.setUpperMargin(0.02);
    yAxis.setLogarithmic(false);
    XYErrorRenderer renderer = new XYErrorRenderer();
    renderer.setBaseLinesVisible(true);
    renderer.setBaseShapesVisible(false);
    renderer.setDrawYError(true);
    //        XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

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

}

From source file:org.gumtree.vis.awt.PlotFactory.java

/**
 * Creates a line chart (based on an {@link XYDataset}) with default
 * settings.// w w w .  j a va2s .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 The chart.
 */
protected static JFreeChart createXYLineChart(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);
    LogarithmizableAxis xAxis = new LogarithmizableAxis(xAxisLabel);
    boolean isLogX = false;
    try {
        isLogX = Boolean.valueOf(System.getProperty(LOGX_PROPERTY));
    } catch (Exception e) {
    }
    xAxis.setLogarithmic(isLogX);
    //        xAxis.setAutoRangeIncludesZero(false);
    xAxis.setAllowNegativesFlag(true);
    xAxis.setLowerMargin(0.02);
    xAxis.setUpperMargin(0.02);
    //        NumberAxis yAxis = new NumberAxis(yAxisLabel);
    LogarithmizableAxis yAxis = new LogarithmizableAxis(yAxisLabel);
    boolean isLogY = false;
    try {
        isLogY = Boolean.valueOf(System.getProperty(LOGY_PROPERTY));
    } catch (Exception e) {
    }
    yAxis.setLogarithmic(isLogY);
    yAxis.setAllowNegativesFlag(true);
    yAxis.setAutoRangeNextLogFlag(false);
    yAxis.setLowerMargin(0.02);
    yAxis.setUpperMargin(0.02);
    XYErrorRenderer renderer = new XYErrorRenderer();
    renderer.setBaseLinesVisible(true);
    renderer.setBaseShapesVisible(false);
    renderer.setDrawYError(true);
    //        XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

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

}

From source file:playground.thibautd.utils.charts.BoxAndWhiskersChart.java

private void createChart() {
    boolean legend = false;

    this.createDataSet();

    this.chart = ChartFactory.createBoxAndWhiskerChart(this.chartTitle, this.xAxisLabel, this.yAxisLabel,
            this.boxes, legend);

    XYPlot plot = this.chart.getXYPlot();
    plot.setDomainAxis(new NumberAxis(this.xAxisLabel));
    plot.getDomainAxis().configure();/*from  w  w w .  j a va2s  .  c  o m*/

    if (plotStdDev) {
        XYErrorRenderer renderer = new XYErrorRenderer();
        // in black
        renderer.setErrorPaint(Color.BLACK);
        // only plot Y error
        renderer.setDrawXError(false);
        // do not render average (already done by the B&W)
        renderer.setBaseShapesVisible(false);
        plot.setRenderer(1, renderer);
        plot.setDataset(1, deviationBars);
        plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    }

    //this.addMatsimLogo();

    //try {
    //   this.addDefaultFormatting();
    //} catch (NullPointerException e) {
    //   // occurs if no legend
    //}

    //this.chart.setBackgroundPaint(Color.white);
    plot.setBackgroundPaint(Color.white);
    XYBoxAndWhiskerRenderer renderer = (XYBoxAndWhiskerRenderer) plot.getRenderer();
    //renderer.setFillBox(false);
    //renderer.setSeriesOutlinePaint(0, Color.black);
    //renderer.setSeriesPaint(0, Color.black);
    renderer.setBoxPaint(renderer.getSeriesPaint(0));
    //auto-adjust
    renderer.setBoxWidth(-1);
}