Example usage for org.jfree.chart.plot XYPlot addRangeMarker

List of usage examples for org.jfree.chart.plot XYPlot addRangeMarker

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot addRangeMarker.

Prototype

public void addRangeMarker(Marker marker, Layer layer) 

Source Link

Document

Adds a marker for the range axis in the specified layer and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:de.bfs.radon.omsimulation.gui.data.OMCharts.java

/**
 * Creates a chart displaying the radon concentration of a single room. Uses
 * red for normal rooms, blue for cellar rooms and green for misc rooms.
 * /*w w  w.  j av  a  2 s  . co m*/
 * @param title
 *          The headline of the chart. Will be hidden if set to null.
 * @param room
 *          The room object containing the radon data.
 * @param preview
 *          Will hide annotations, labels and headlines if true.
 * @return A chart displaying the radon concentration of a single room.
 */
public static JFreeChart createRoomChart(String title, OMRoom room, boolean preview) {
    Color lineColor = new Color(0, 0, 0, 128);
    Color rangeColor = new Color(222, 222, 222, 128);
    if (room.getType() == OMRoomType.Room) {
        lineColor = new Color(255, 0, 0, 128);
        rangeColor = new Color(255, 222, 222, 128);
    } else {
        if (room.getType() == OMRoomType.Cellar) {
            lineColor = new Color(0, 0, 255, 128);
            rangeColor = new Color(222, 222, 255, 128);
        } else {
            lineColor = new Color(0, 128, 0, 255);
            rangeColor = new Color(222, 255, 222, 128);
        }
    }
    double[] values = room.getValues();
    XYSeriesCollection dataSet = new XYSeriesCollection();
    XYSeries series = new XYSeries("Radon");
    int count = room.getCount();
    double maxPointerKey = 0;
    for (int i = 0; i < count; i++) {
        series.add(i, values[i]);
        if (values[i] == room.getMaximum()) {
            maxPointerKey = i;
        }
    }
    dataSet.addSeries(series);
    title = title + ": " + room.getType().toString() + " " + room.getId();
    JFreeChart chart = ChartFactory.createXYLineChart(title, "T [h]", "Rn [Bq/m\u00B3]", dataSet,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    double positiveDeviation = room.getAverage() + room.getDeviation();
    double negativeDeviation = room.getAverage() - room.getDeviation();
    IntervalMarker deviation = new IntervalMarker(negativeDeviation, positiveDeviation);
    float[] dash = { 5, 3 };
    deviation.setPaint(rangeColor);
    deviation.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(deviation, Layer.BACKGROUND);
    ValueMarker arithMarker = new ValueMarker(room.getAverage(), lineColor,
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(arithMarker);
    ValueMarker maxiMarker = new ValueMarker(room.getMaximum(), lineColor,
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(maxiMarker);
    XYTextAnnotation amLabel = new XYTextAnnotation("AM=" + (int) room.getAverage(), count,
            room.getAverage() * 1.01);
    plot.addAnnotation(amLabel);
    XYTextAnnotation sdLabel = new XYTextAnnotation("SD=" + (int) room.getDeviation(), count,
            (room.getAverage() + room.getDeviation()) * 1.01);
    plot.addAnnotation(sdLabel);
    XYTextAnnotation maxLabel = new XYTextAnnotation("MAX=" + (int) room.getMaximum(), count,
            room.getMaximum() * 1.01);
    plot.addAnnotation(maxLabel);
    XYPointerAnnotation maxPointer = new XYPointerAnnotation("", maxPointerKey, room.getMaximum(),
            Math.PI * 1.1);
    plot.addAnnotation(maxPointer);
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, lineColor);
    if (preview) {
        chart.setTitle("");
        plot.clearAnnotations();
    }
    return chart;
}

From source file:wef.articulab.view.ui.CombinedBNXYPlot.java

private XYPlot createPlot(ChartContainer chartContainer) {
    createDataset(chartContainer);/*from  w  ww .j  a  va  2  s. c  o  m*/
    chartContainer.target = new IntervalMarker(14, 16);
    chartContainer.target.setLabel("Activation Threshold");
    chartContainer.target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    chartContainer.target.setLabelAnchor(RectangleAnchor.LEFT);
    chartContainer.target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    chartContainer.target.setPaint(new Color(222, 222, 255, 128));
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    BasicStroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    for (int i = 0; i < chartContainer.series.length - 1; i++) {
        renderer.setSeriesStroke(i, stroke);
    }
    renderer.setSeriesStroke(chartContainer.series.length - 1, new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.0f }, 0.0f));

    NumberAxis rangeAxis = new NumberAxis("Activation");
    NumberAxis domainAxis = new NumberAxis("Time");
    XYPlot plot = new XYPlot(chartContainer.dataset, domainAxis, rangeAxis, renderer);
    plot.addRangeMarker(chartContainer.target, Layer.BACKGROUND);
    plot.setRenderer(renderer);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    chartContainer.plot = plot;
    return plot;
}

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

/**
 * Creates a sample chart./*from ww w. j a v a  2 s .co m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(IntervalXYDataset dataset) {
    final JFreeChart chart = ChartFactory.createXYBarChart("XY Series Demo", "X", false, "Y", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    final IntervalMarker target = new IntervalMarker(400.0, 700.0);
    target.setLabel("Target Range");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);
    return chart;
}

From source file:org.schreibubi.JCombinations.logic.visitors.ChartNodesVisitor.java

public void visit(Shmoo s) throws Exception {
    if (s.componentSelected(this.treePaths, OurTreeNode.MYSELF | OurTreeNode.PARENTS | OurTreeNode.CHILDS)) {
        NumberAxis xAxis = new NumberAxis(s.getTrim() + " [" + s.getXdataDefault().getUnit() + "]");
        xAxis.setAutoRangeIncludesZero(false);
        NumberAxis yAxis = new NumberAxis(
                s.getMeasure() + " [" + ((Ydata) s.getYdata().get(0)).getUnit() + "]");
        yAxis.setAutoRangeIncludesZero(false);
        XYLineAndShapeRenderer renderer = new XYLineAndShapeRendererExtended(true, true);
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());

        this.dutData = new ArrayList<ArrayList<Double>>();
        this.dutName = new ArrayList<String>();
        for (int i = 0; i < s.getChildCount(); i++)
            (s.getChildAt(i)).accept(this);

        XYSeriesCollection xyseries = new XYSeriesCollection();
        ArrayList<Double> x = s.getXdataDefault().getXPositions();
        for (int j = 0; j < this.dutData.size(); j++) {
            ArrayList<Double> y = this.dutData.get(j);
            XYSeries xy = new XYSeries(this.dutName.get(j));
            for (int i = 0; i < y.size(); i++)
                xy.add(x.get(i), y.get(i));
            xyseries.addSeries(xy);//from   ww w  .j  a v a2  s .c o  m
        }

        XYPlot plot = new XYPlot(xyseries, xAxis, yAxis, renderer);
        plot.setOrientation(PlotOrientation.VERTICAL);
        plot.setDomainCrosshairVisible(true);
        plot.setRangeCrosshairVisible(true);
        Marker marker = s.getMarker();
        if (marker != null)
            plot.addRangeMarker(marker, Layer.BACKGROUND);
        ExtendedJFreeChart chart = new ExtendedJFreeChart(s.getDescription(), JFreeChart.DEFAULT_TITLE_FONT,
                plot, false);
        if (marker == null)
            chart.addSubtitle(new TextTitle(s.getSubtitle()));
        else
            chart.addSubtitle(new TextTitle(
                    s.getSubtitle() + " " + s.getValueAt(3) + "/" + s.getValueAt(4) + "/" + s.getValueAt(5)));

        chart.setTreePath(s.getTreePath());
        this.charts.add(chart);
    }

}

From source file:wef.articulab.view.ui.BNXYPlot.java

/**
 * Creates an overlaid chart.//from  w  ww . j  a  v a2 s  .c o m
 *
 * @return The chart.
 */
private JFreeChart createChart() {
    createDataset();
    final JFreeChart chart = ChartFactory.createXYLineChart("Real Time Network Dynamics", "Time", "Activation",
            dataset, PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    target = new IntervalMarker(14, 16);
    target.setLabel("Activation Threshold");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    BasicStroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    for (int i = 0; i < series.length - 1; i++) {
        renderer.setSeriesStroke(i, stroke);
    }
    renderer.setSeriesStroke(series.length - 1, new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
            BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.0f }, 0.0f));
    plot.setRenderer(renderer);
    return chart;
}

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

/**
 * Creates a new demo instance./*  w ww  . j a  v a 2 s. c  o  m*/
 * 
 * @param title  the frame title.
 */
public PlotOrientationDemo2(String title) {

    super(title);
    JPanel panel = new JPanel(new GridLayout(2, 4));
    for (int i = 0; i < CHART_COUNT; i++) {
        this.datasets[i] = createDataset(i);
        this.charts[i] = createChart(i, this.datasets[i]);
        XYPlot plot = this.charts[i].getXYPlot();
        XYShapeAnnotation a1 = new XYShapeAnnotation(new Rectangle2D.Double(1.0, 2.0, 2.0, 3.0),
                new BasicStroke(1.0f), Color.blue);
        XYLineAnnotation a2 = new XYLineAnnotation(0.0, -5.0, 10.0, -5.0);

        plot.addAnnotation(a1);
        plot.addAnnotation(a2);
        plot.addDomainMarker(new IntervalMarker(5.0, 10.0), Layer.BACKGROUND);
        plot.addRangeMarker(new IntervalMarker(-2.0, 0.0), Layer.BACKGROUND);

        this.panels[i] = new ChartPanel(this.charts[i]);
    }
    this.charts[1].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[2].getXYPlot().getRangeAxis().setInverted(true);
    this.charts[3].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[3].getXYPlot().getRangeAxis().setInverted(true);

    this.charts[5].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[6].getXYPlot().getRangeAxis().setInverted(true);
    this.charts[4].getXYPlot().getDomainAxis().setInverted(true);
    this.charts[4].getXYPlot().getRangeAxis().setInverted(true);

    this.charts[4].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);
    this.charts[5].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);
    this.charts[6].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);
    this.charts[7].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL);

    panel.add(this.panels[0]);
    panel.add(this.panels[1]);
    panel.add(this.panels[4]);
    panel.add(this.panels[5]);
    panel.add(this.panels[2]);
    panel.add(this.panels[3]);
    panel.add(this.panels[6]);
    panel.add(this.panels[7]);

    panel.setPreferredSize(new Dimension(800, 600));
    setContentPane(panel);

}

From source file:org.openfaces.component.chart.impl.configuration.charts.GridChartConfigurator.java

protected void initMarkers(Chart chart, XYPlot xyPlot) {
    final GridChartView chartView = (GridChartView) chart.getChartView();
    final List<Marker> domainMarkers = collectMarkers(chartView, DomainMarkers.class);
    final List<Marker> rangeMarkers = collectMarkers(chartView, RangeMarkers.class);

    for (Marker marker : domainMarkers) {
        org.jfree.chart.plot.Marker domainMarker = initMarker(marker);

        if (domainMarker != null) {
            xyPlot.addDomainMarker(domainMarker, getMarkerLayer(marker));
        }//ww w  . j a  va  2s.  c o m
    }

    for (Marker marker : rangeMarkers) {
        org.jfree.chart.plot.Marker rangeMarker = initMarker(marker);

        if (rangeMarker != null) {
            xyPlot.addRangeMarker(rangeMarker, getMarkerLayer(marker));
        }
    }
}

From source file:sernet.gs.ui.rcp.main.bsi.views.chart.RealisierungLineChart.java

private JFreeChart createProgressChart(Object dataset) {
    final double plotGap = 10.0;
    final int axisUpperBoundPadding = 50;
    final int labelFontSize = 10;
    XYDataset data1 = (XYDataset) dataset;
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis(Messages.RealisierungLineChart_1);
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis(Messages.RealisierungLineChart_2));
    plot.setGap(plotGap);/* w ww  .ja  v a  2s. c o m*/

    plot.add(subplot1, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);

    CountMassnahmen command = new CountMassnahmen();
    try {
        command = ServiceFactory.lookupCommandService().executeCommand(command);
    } catch (CommandException e) {
        ExceptionUtil.log(e, Messages.RealisierungLineChart_3);
    }
    int totalNum = command.getTotalCount();

    NumberAxis axis = (NumberAxis) subplot1.getRangeAxis();
    axis.setUpperBound(totalNum + axisUpperBoundPadding);

    ValueMarker bst = new ValueMarker(totalNum);
    bst.setPaint(Color.GREEN);
    bst.setLabel(Messages.RealisierungLineChart_4);
    bst.setLabelAnchor(RectangleAnchor.LEFT);
    bst.setLabelFont(new Font("SansSerif", Font.ITALIC + Font.BOLD, labelFontSize)); //$NON-NLS-1$
    bst.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    subplot1.addRangeMarker(bst, Layer.BACKGROUND);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart(Messages.RealisierungLineChart_6, JFreeChart.DEFAULT_TITLE_FONT, plot,
            true);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Update of animation type StatisticGrafic.ANIMATION_TimeValueDiagram
 * @throws ModelException//  w w w.  j a  va2s . co m
 */
private void updateTimeValueDiagram() throws ModelException {
    Marker meanMarker, minMarker, maxMarker;
    double mean, min0, max0;
    XYPlot plot = this.chart.getXYPlot();
    String rangeAxisLabel = "";
    switch (this.statistic.getTypeIndex()) {
    case Statistic.INDEX_None:
        break;
    case Statistic.INDEX_Min_Max:
        plot.clearRangeMarkers();
        min0 = statistic.getMin();
        max0 = statistic.getMax();
        if (!Double.isNaN(min0)) {
            minMarker = new ValueMarker(min0);
            minMarker.setPaint(StatisticGrafic.DIAGRAM_MARKER_MIN_MAX);
            minMarker.setStroke(new BasicStroke(2.0f));
            plot.addRangeMarker(minMarker, Layer.BACKGROUND);
        }
        if (!Double.isNaN(max0)) {
            maxMarker = new ValueMarker(max0);
            maxMarker.setPaint(StatisticGrafic.DIAGRAM_MARKER_MIN_MAX);
            maxMarker.setStroke(new BasicStroke(2.0f));
            plot.addRangeMarker(maxMarker, Layer.BACKGROUND);
        }
        rangeAxisLabel = "min - max";
        break;
    case Statistic.INDEX_Mean_StdDev:
        plot.clearRangeMarkers();
        if (statistic.hasValue()) {
            min0 = statistic.getMean() - statistic.getStdDev();
            max0 = statistic.getMean() + statistic.getStdDev();
            mean = statistic.getMean();
            if (!Double.isNaN(mean)) {
                meanMarker = new ValueMarker(mean);
                meanMarker.setPaint(StatisticGrafic.DIAGRAM_MARKER_MEAN);
                meanMarker.setStroke(new BasicStroke(2.0f));
                plot.addRangeMarker(meanMarker, Layer.BACKGROUND);
            }
            if (!Double.isNaN(min0)) {
                minMarker = new ValueMarker(min0);
                minMarker.setPaint(StatisticGrafic.DIAGRAM_MARKER_STD_DEV);
                minMarker.setStroke(new BasicStroke(2.0f));
                plot.addRangeMarker(minMarker, Layer.BACKGROUND);
            }
            if (!Double.isNaN(max0)) {
                maxMarker = new ValueMarker(max0);
                maxMarker.setPaint(StatisticGrafic.DIAGRAM_MARKER_STD_DEV);
                maxMarker.setStroke(new BasicStroke(2.0f));
                plot.addRangeMarker(maxMarker, Layer.BACKGROUND);
            }
        }
        rangeAxisLabel = "\u03BC-\u03C3 - mean - \u03BC+\u03C3";
        break;
    }
    //this.buildTimeValueDiagramAxisFormat(plot, rangeAxisLabel);
}

From source file:de.bfs.radon.omsimulation.gui.data.OMCharts.java

/**
 * Creates a chart displaying the radon concentration of a virtual campaign.
 * Uses red for normal rooms and blue for cellar rooms.
 * //  w w  w  .  ja v a 2s .c  o m
 * @param campaign
 *          The campaign object containing all rooms and radon data.
 * @param preview
 *          Will hide annotations, labels and headlines if true.
 * @return A chart displaying the radon concentration of a virtual campaign.
 */
public static JFreeChart createCampaignChart(OMCampaign campaign, boolean preview) {
    OMRoom[] rooms = new OMRoom[7];
    OMRoom[] tmpRooms = campaign.getRooms();
    OMRoom tmpCellar = campaign.getCellar();
    String variation = campaign.getVariation();
    char[] variationChar = variation.toCharArray();
    int cellarPosition = 0;
    for (int i = 0; i < variationChar.length; i++) {
        if (variationChar[i] == 'C' || variationChar[i] == 'c') {
            cellarPosition = i / 2;
        }
    }
    int c = 0;
    for (int i = 0; i < rooms.length; i++) {
        if (i == cellarPosition) {
            rooms[i] = tmpCellar;
            c++;
        } else {
            rooms[i] = tmpRooms[i - c];
        }
    }
    int start = campaign.getStart();
    final int finalStart = start;
    String title = "Campaign: " + rooms[0].getId() + rooms[1].getId() + rooms[2].getId() + rooms[3].getId()
            + rooms[4].getId() + rooms[5].getId() + rooms[6].getId() + ", Start: " + finalStart;
    int count = 168;
    double[] values = campaign.getValueChain();
    XYSeriesCollection dataSet = new XYSeriesCollection();
    XYSeries roomSeries1 = new XYSeries(" Radon Rooms");
    XYSeries cellarSeries = new XYSeries("Radon Cellar");
    XYSeries roomSeries2 = new XYSeries("Radon Rooms");
    int cellarSeriesStart = cellarPosition * 24;
    int cellarSeriesEnd = cellarSeriesStart + 24;
    double cellarMaximum = campaign.getCellarMaximum();
    double cellarMaximumKey = 0;
    double roomMaximum = campaign.getRoomMaximum();
    double roomMaximumKey = 0;
    if (cellarSeriesStart > 0) {
        for (int i = 0; i < cellarSeriesStart; i++) {
            roomSeries1.add(finalStart + i, values[i]);
            if (values[i] == roomMaximum) {
                roomMaximumKey = i;
            }
        }
    }
    for (int i = cellarSeriesStart - 1; i < cellarSeriesEnd; i++) {
        if (i >= 0) {
            cellarSeries.add(finalStart + i, values[i]);
            if (values[i] == cellarMaximum) {
                cellarMaximumKey = i;
            }
        }
    }
    if (cellarSeriesEnd < count) {
        for (int i = cellarSeriesEnd - 1; i < count; i++) {
            roomSeries2.add(finalStart + i, values[i]);
            if (values[i] == roomMaximum) {
                roomMaximumKey = i;
            }
        }
    }
    dataSet.addSeries(roomSeries1);
    dataSet.addSeries(cellarSeries);
    dataSet.addSeries(roomSeries2);
    JFreeChart chart = ChartFactory.createXYLineChart(title, "T [h]", "Rn [Bq/m\u00B3]", dataSet,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    ValueMarker sepMarker;
    Color sepColor = Color.BLACK;
    float[] sepDash = { 1, 2 };
    Stroke sepStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, sepDash, 0);
    RectangleInsets sepLabelInsets = new RectangleInsets(20, -20, 0, 0);
    Font sepLabelFont = new Font(Font.SANS_SERIF, Font.BOLD, 16);
    sepMarker = new ValueMarker(finalStart + 0, sepColor, sepStroke);
    sepMarker.setLabel(rooms[0].getId());
    sepMarker.setLabelOffset(sepLabelInsets);
    sepMarker.setLabelFont(sepLabelFont);
    plot.addDomainMarker(sepMarker);
    if (rooms[0].getId() != rooms[1].getId()) {
        sepMarker = new ValueMarker(finalStart + 23, sepColor, sepStroke);
        sepMarker.setLabel(rooms[1].getId());
        sepMarker.setLabelOffset(sepLabelInsets);
        sepMarker.setLabelFont(sepLabelFont);
        plot.addDomainMarker(sepMarker);
    }
    if (rooms[1].getId() != rooms[2].getId()) {
        sepMarker = new ValueMarker(finalStart + 47, sepColor, sepStroke);
        sepMarker.setLabel(rooms[2].getId());
        sepMarker.setLabelOffset(sepLabelInsets);
        sepMarker.setLabelFont(sepLabelFont);
        plot.addDomainMarker(sepMarker);
    }
    if (rooms[2].getId() != rooms[3].getId()) {
        sepMarker = new ValueMarker(finalStart + 71, sepColor, sepStroke);
        sepMarker.setLabel(rooms[3].getId());
        sepMarker.setLabelOffset(sepLabelInsets);
        sepMarker.setLabelFont(sepLabelFont);
        plot.addDomainMarker(sepMarker);
    }
    if (rooms[3].getId() != rooms[4].getId()) {
        sepMarker = new ValueMarker(finalStart + 95, sepColor, sepStroke);
        sepMarker.setLabel(rooms[4].getId());
        sepMarker.setLabelOffset(sepLabelInsets);
        sepMarker.setLabelFont(sepLabelFont);
        plot.addDomainMarker(sepMarker);
    }
    if (rooms[4].getId() != rooms[5].getId()) {
        sepMarker = new ValueMarker(finalStart + 119, sepColor, sepStroke);
        sepMarker.setLabel(rooms[5].getId());
        sepMarker.setLabelOffset(sepLabelInsets);
        sepMarker.setLabelFont(sepLabelFont);
        plot.addDomainMarker(sepMarker);
    }
    if (rooms[5].getId() != rooms[6].getId()) {
        sepMarker = new ValueMarker(finalStart + 143, sepColor, sepStroke);
        sepMarker.setLabel(rooms[6].getId());
        sepMarker.setLabelOffset(sepLabelInsets);
        sepMarker.setLabelFont(sepLabelFont);
        plot.addDomainMarker(sepMarker);
    }
    double positiveCellarDeviation = campaign.getCellarAverage() + campaign.getCellarDeviation();
    double negativeCellarDeviation = campaign.getCellarAverage() - campaign.getCellarDeviation();
    IntervalMarker cellarDeviation = new IntervalMarker(negativeCellarDeviation, positiveCellarDeviation);
    float[] dash = { 5, 3 };
    cellarDeviation.setPaint(new Color(222, 222, 255, 128));
    cellarDeviation.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(cellarDeviation, Layer.BACKGROUND);
    ValueMarker arithCellarMarker = new ValueMarker(campaign.getCellarAverage(), new Color(0, 0, 255, 128),
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(arithCellarMarker);
    XYTextAnnotation amCellarLabel = new XYTextAnnotation("C_AM=" + (int) campaign.getCellarAverage(),
            finalStart + count, campaign.getCellarAverage() * 1.01);
    plot.addAnnotation(amCellarLabel);
    XYTextAnnotation sdCellarLabel = new XYTextAnnotation("C_SD=" + (int) campaign.getCellarDeviation(),
            finalStart + count, (campaign.getCellarAverage() + campaign.getCellarDeviation()) * 1.01);
    plot.addAnnotation(sdCellarLabel);
    ValueMarker maxiCellarMarker = new ValueMarker(cellarMaximum, new Color(0, 0, 255, 128),
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(maxiCellarMarker);
    XYTextAnnotation maxCellarLabel = new XYTextAnnotation("C_MAX=" + (int) cellarMaximum, finalStart + count,
            cellarMaximum * 1.01);
    plot.addAnnotation(maxCellarLabel);
    XYPointerAnnotation maxCellarPointer = new XYPointerAnnotation("", finalStart + cellarMaximumKey,
            cellarMaximum, Math.PI * 1.1);
    plot.addAnnotation(maxCellarPointer);
    double positiveRoomDeviation = campaign.getRoomAverage() + campaign.getRoomDeviation();
    double negativeRoomDeviation = campaign.getRoomAverage() - campaign.getRoomDeviation();
    IntervalMarker roomDeviation = new IntervalMarker(negativeRoomDeviation, positiveRoomDeviation);
    roomDeviation.setPaint(new Color(255, 222, 222, 128));
    roomDeviation.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(roomDeviation, Layer.BACKGROUND);
    ValueMarker arithRoomMarker = new ValueMarker(campaign.getRoomAverage(), new Color(255, 0, 0, 128),
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(arithRoomMarker);
    XYTextAnnotation amRoomLabel = new XYTextAnnotation("R_AM=" + (int) campaign.getRoomAverage(),
            finalStart + count, campaign.getRoomAverage() * 1.01);
    plot.addAnnotation(amRoomLabel);
    XYTextAnnotation sdRoomLabel = new XYTextAnnotation("R_SD=" + (int) campaign.getRoomDeviation(),
            finalStart + count, (campaign.getRoomAverage() + campaign.getRoomDeviation()) * 1.01);
    plot.addAnnotation(sdRoomLabel);
    ValueMarker maxiRoomMarker = new ValueMarker(roomMaximum, new Color(255, 0, 0, 128),
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(maxiRoomMarker);
    XYTextAnnotation maxRoomLabel = new XYTextAnnotation("R_MAX=" + (int) roomMaximum, finalStart + count,
            roomMaximum * 1.01);
    plot.addAnnotation(maxRoomLabel);
    XYPointerAnnotation maxRoomPointer = new XYPointerAnnotation("", finalStart + roomMaximumKey, roomMaximum,
            Math.PI * 1.1);
    plot.addAnnotation(maxRoomPointer);
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, new Color(255, 0, 0, 128));
    renderer.setSeriesPaint(1, new Color(0, 0, 255, 128));
    renderer.setSeriesPaint(2, new Color(255, 0, 0, 128));
    if (preview) {
        chart.setTitle("");
        plot.clearAnnotations();
    }
    return chart;
}