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

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

Introduction

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

Prototype

public void setDataset(int index, XYDataset dataset) 

Source Link

Document

Sets a dataset for the plot and sends a change event to all registered listeners.

Usage

From source file:MSUmpire.DIA.MixtureModelKDESemiParametric.java

public void GeneratePlot(String pngfile) throws IOException {
    String modelfile = FilenameUtils.getFullPath(pngfile) + "/" + FilenameUtils.getBaseName(pngfile)
            + "_ModelPoints.txt";
    FileWriter writer = new FileWriter(modelfile);

    double[] IDObs = new double[IDEmpiricalDist.getN()];
    double[] DecoyObs = new double[DecoyEmpiricalDist.getN()];

    for (int i = 0; i < IDEmpiricalDist.getN(); i++) {
        IDObs[i] = IDEmpiricalDist.getObs(i);
    }//from  w ww . jav  a 2s  . c o m
    for (int i = 0; i < DecoyEmpiricalDist.getN(); i++) {
        DecoyObs[i] = DecoyEmpiricalDist.getObs(i);
    }

    XYSeries model1 = new XYSeries("Incorrect matches");
    XYSeries model2 = new XYSeries("Correct matches");
    XYSeries model3 = new XYSeries("All target hits");

    writer.write("UScore\tModel\tCorrect\tDecoy\n");
    for (int i = 0; i < NoBinPoints; i++) {
        model1.add(model_kde_x[i], decoy_kde_y[i]);
        model2.add(model_kde_x[i], correct_kde_y[i]);
        model3.add(model_kde_x[i], model_kde_y[i]);
        writer.write(model_kde_x[i] + "\t" + model_kde_y[i] + "\t" + correct_kde_y[i] + "\t" + decoy_kde_y[i]
                + "\n");
    }
    writer.close();

    MixtureModelProb = new float[NoBinPoints + 1][3];
    float positiveaccu = 0f;
    float negativeaccu = 0f;

    MixtureModelProb[0][0] = (float) model2.getMaxX() + Float.MIN_VALUE;
    MixtureModelProb[0][1] = 1f;
    MixtureModelProb[0][2] = 1f;

    for (int i = 1; i < NoBinPoints + 1; i++) {
        double positiveNumber = correct_kde_y[NoBinPoints - i];
        double negativeNumber = decoy_kde_y[NoBinPoints - i];
        MixtureModelProb[i][0] = (float) model_kde_x[NoBinPoints - i];
        positiveaccu += positiveNumber;
        negativeaccu += negativeNumber;
        MixtureModelProb[i][2] = 0.999999f * (float) (positiveNumber / (negativeNumber + positiveNumber));
        MixtureModelProb[i][1] = 0.999999f * (float) (positiveaccu / (negativeaccu + positiveaccu));
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(model1);
    dataset.addSeries(model2);
    dataset.addSeries(model3);

    HistogramDataset histogramDataset = new HistogramDataset();
    histogramDataset.setType(HistogramType.SCALE_AREA_TO_1);
    histogramDataset.addSeries("ID hits", IDObs, 100);
    histogramDataset.addSeries("Decoy hits", DecoyObs, 100);
    //histogramDataset.addSeries("Model hits", ModelObs, 100);

    JFreeChart chart = ChartFactory.createHistogram(FilenameUtils.getBaseName(pngfile), "Score", "Hits",
            histogramDataset, PlotOrientation.VERTICAL, true, false, false);
    XYPlot plot = chart.getXYPlot();

    NumberAxis domain = (NumberAxis) plot.getDomainAxis();
    domain.setRange(min, max);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setForegroundAlpha(0.8f);
    chart.setBackgroundPaint(Color.white);

    XYLineAndShapeRenderer render = new XYLineAndShapeRenderer();

    plot.setDataset(1, dataset);
    plot.setRenderer(1, render);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    try {
        ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
    } catch (IOException e) {
    }
}

From source file:com.github.dougkelly88.FLIMPlateReaderGUI.FLIMClasses.Classes.FindMaxpoint.java

/**
 * Creates a chart.//from w ww .  j  a v  a 2 s.co  m
 * 
 * @param dataset  the data for the chart.
 * 
 * @return a chart.
 */
public JFreeChart createChart() {

    //http://www.java2s.com/Code/Java/Chart/JFreeChartDualAxisDemo2.htm
    String xlabel = "Delay (ps)";
    String ylabel = "Signal (DN)";

    // create the chart with findmaxpoint results
    final JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            xlabel, // x axis label
            ylabel, // y axis label
            findMaxpointData_, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );

    final XYPlot plot = chart.getXYPlot();
    // deal with axes and add second dataset
    final NumberAxis yaxis1 = (NumberAxis) plot.getRangeAxis();
    yaxis1.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    yaxis1.setLabelFont(new Font("Dialog", Font.PLAIN, 10));
    final NumberAxis yaxis2 = new NumberAxis(null);
    final NumberAxis xaxis = (NumberAxis) plot.getDomainAxis();
    xaxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    xaxis.setLabelFont(new Font("Dialog", Font.PLAIN, 10));
    plot.setRangeAxis(1, yaxis2);
    plot.setDataset(1, gatePositionData_);
    plot.mapDatasetToRangeAxis(1, 1);
    yaxis1.setRange(0, 5000);
    yaxis2.setRange(-1, 1);
    yaxis2.setTickLabelsVisible(false);
    xaxis.setRange(0, 16666);

    // deal with visuals

    final XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer(true, true);
    renderer1.setSeriesPaint(0, Color.RED);
    renderer1.setSeriesStroke(0, new BasicStroke(3));

    //        renderer1.setBaseShapesVisible(true);
    //        renderer1.setSeriesShape(0, ShapeUtilities.createDiagonalCross(4,1));

    plot.setRenderer(0, renderer1);

    //        final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
    final XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(false, true);
    renderer2.setSeriesPaint(0, Color.CYAN);
    renderer2.setSeriesShapesFilled(0, Boolean.TRUE);
    renderer2.setBaseShapesVisible(true);
    renderer2.setShape(new Rectangle(-2, -100, 4, 200));
    renderer2.setOutlineStroke(new BasicStroke(1));
    renderer2.setOutlinePaint(Color.GRAY);
    renderer2.setUseOutlinePaint(true);
    plot.setRenderer(1, renderer2);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    //                
    return chart;

}

From source file:grafix.graficos.indices.Indice.java

public void plotar(final XYPlot plot, final JanelaGraficos janela, final int contador) {
    XYLineAndShapeRenderer indicesRenderer = new XYLineAndShapeRenderer();
    indicesRenderer.setSeriesLinesVisible(0, isTracoContinuo());
    indicesRenderer.setSeriesShapesVisible(0, !isTracoContinuo());
    indicesRenderer.setSeriesShape(0, ShapeUtilities.createDiamond(1.5f));
    indicesRenderer.setStroke(new BasicStroke(getEspessura() * 0.5f));
    indicesRenderer.setToolTipGenerator(new IndiceToolTipGenerator(this));
    indicesRenderer.setPaint(getCor());/*  w  w w .j  av  a  2s. c  o m*/
    plot.setRenderer(contador, indicesRenderer);
    plot.setDataset(contador, getDataSet(janela));
}

From source file:ec.ui.view.StabilityView.java

private void showDetail(Graphs g) {
    XYPlot plot = detailChart.getXYPlot();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelPaint(Color.GRAY);
    plot.setRangeAxis(yAxis);//from w  w  w  .j  av  a2 s .com

    NumberAxis xAxis = new NumberAxis();
    xAxis.setTickLabelPaint(Color.GRAY);
    xAxis.setTickUnit(new NumberTickUnit(1));
    xAxis.setRange(-0.5, ((double) g.getMaxElements()) - 0.5);
    plot.setDomainAxis(xAxis);

    plot.setDataset(MEAN_INDEX, new BasicXYDataset(Collections.singletonList(g.S1_)));
    plot.setDataset(POINTS_INDEX, new BasicXYDataset(Collections.singletonList(g.S2_)));
    plot.setDataset(SMOOTH_INDEX, new BasicXYDataset(Collections.singletonList(g.S3_)));

    rescaleAxis((NumberAxis) plot.getRangeAxis());

    detailChart.setTitle(g.label_);
    panel.setChart(detailChart);
    panel.setToolTipText("Right click to show complete data");
    onColorSchemeChange();
}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputHeatmap.java

@Override
protected void createNewSerie(final IScope scope, final String serieid) {

    final ChartDataSeries dataserie = chartdataset.getDataSeries(scope, serieid);
    final MatrixSeries serie = new MatrixSeries((String) dataserie.getSerieLegend(scope),
            Math.max(1, this.getChartdataset().getYSeriesValues().size()),
            Math.max(1, this.getChartdataset().getXSeriesValues().size()));
    final XYPlot plot = (XYPlot) this.chart.getPlot();

    final MatrixSeriesCollection firstdataset = (MatrixSeriesCollection) plot.getDataset();

    if (!IdPosition.containsKey(serieid)) {

        if (firstdataset.getSeriesCount() == 0) {
            firstdataset.addSeries(serie);
            plot.setDataset(0, firstdataset);

        } else {//  w w  w.j  av a  2s . c  o  m

            final MatrixSeriesCollection newdataset = new MatrixSeriesCollection();
            newdataset.addSeries(serie);
            jfreedataset.add(newdataset);
            plot.setDataset(jfreedataset.size() - 1, newdataset);

        }
        plot.setRenderer(jfreedataset.size() - 1, (XYItemRenderer) getOrCreateRenderer(scope, serieid));
        IdPosition.put(serieid, jfreedataset.size() - 1);
        // DEBUG.LOG("new serie"+serieid+" at
        // "+IdPosition.get(serieid)+" fdsize "+plot.getSeriesCount()+" jfds
        // "+jfreedataset.size()+" datasc "+plot.getDatasetCount());
        // TODO Auto-generated method stub

    }
}

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

/**
 * Creates an overlaid chart./*from  ww  w  . j  a  v a 2s  . com*/
 *
 * @return The chart.
 */
private JFreeChart createOverlaidChart() {

    // create plot ...
    final IntervalXYDataset data1 = createDataset1();
    final XYItemRenderer renderer1 = new XYBarRenderer(0.20);
    renderer1.setToolTipGenerator(
            new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    final DateAxis domainAxis = new DateAxis("Date");
    domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    final ValueAxis rangeAxis = new NumberAxis("Value");
    final XYPlot plot = new XYPlot(data1, domainAxis, rangeAxis, renderer1);
    final double x = new Day(9, SerialDate.MARCH, 2002).getMiddleMillisecond();
    final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", x, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    plot.addAnnotation(annotation);

    // add a second dataset and renderer...
    final XYDataset data2 = createDataset2();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setToolTipGenerator(
            new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    plot.setDataset(1, data2);
    plot.setRenderer(1, renderer2);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    // return a new chart containing the overlaid plot...
    return new JFreeChart("Overlaid Plot Example", JFreeChart.DEFAULT_TITLE_FONT, plot, true);

}

From source file:cn.InstFS.wkr.NetworkMining.UIs.TimeSeriesChart1.java

public static JFreeChart createChart2(ArrayList<DataItems> _nor_model, ArrayList<DataItems> _abnor_model,
        DataItems nor, DataItems abnor, Map<String, ArrayList<LinePos>> mapAB, String chartname,
        String protocol1, String protocol2) {
    XYDataset xydataset = createNormalDataset(nor, protocol1);
    JFreeChart jfreechart = ChartFactory.createXYLineChart(chartname, "", "", xydataset);
    jfreechart.getLegend().setVisible(false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);
    java.awt.geom.Ellipse2D.Double double1 = new java.awt.geom.Ellipse2D.Double(-4D, -4D, 6D, 6D);

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    // ??//from www .j  av  a2  s  .co m
    xylineandshaperenderer.setSeriesLinesVisible(0, true);
    xylineandshaperenderer.setBaseShapesVisible(false);
    xylineandshaperenderer.setSeriesShape(0, double1);
    xylineandshaperenderer.setSeriesPaint(0, Color.blue);
    xylineandshaperenderer.setSeriesFillPaint(0, Color.blue);
    xylineandshaperenderer.setSeriesOutlinePaint(0, Color.blue);
    xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(0.5F));
    // ?
    // xylineandshaperenderer.setBaseItemLabelGenerator(new
    // StandardXYItemLabelGenerator());
    // xylineandshaperenderer.setBaseItemLabelsVisible(true);
    int datasetcount0 = xyplot.getDatasetCount();

    XYDataset xydataset1 = createNormalDataset(abnor, protocol2);
    // xydataset1.
    XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer();
    int datasetcount = xyplot.getDatasetCount();
    xyplot.setDataset(datasetcount, xydataset1);
    xyplot.setRenderer(datasetcount, xylineandshaperenderer1);
    // ???
    xylineandshaperenderer1.setBaseShapesVisible(false);
    // ??
    xylineandshaperenderer1.setSeriesLinesVisible(0, true);
    xylineandshaperenderer1.setSeriesShape(0, double1);
    // 
    xylineandshaperenderer1.setSeriesPaint(0, Color.green);
    xylineandshaperenderer1.setSeriesFillPaint(0, Color.green);
    xylineandshaperenderer1.setSeriesOutlinePaint(0, Color.green);
    xylineandshaperenderer1.setUseFillPaint(true);

    xylineandshaperenderer1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    xylineandshaperenderer1.setSeriesStroke(0, new BasicStroke(0.5F));

    // //?
    /*
     * for (int i = 0; i < _nor_model.size(); i++) { XYDataset xydataset2 =
     * createmodeDataset(_nor_model.get(i), "_nor_model" + i);
     * XYLineAndShapeRenderer xylineandshaperenderer2 = new
     * XYLineAndShapeRenderer(); xyplot.setDataset(i + 2, xydataset2);
     * xyplot.setRenderer(2 + i, xylineandshaperenderer2); // ???
     * xylineandshaperenderer2.setBaseShapesVisible(false); // ??
     * xylineandshaperenderer2.setSeriesLinesVisible(0, true);
     * xylineandshaperenderer2.setSeriesShape(0, double1); // 
     * xylineandshaperenderer2.setSeriesPaint(0, Color.red);
     * xylineandshaperenderer2.setSeriesFillPaint(0, Color.red);
     * xylineandshaperenderer2.setSeriesOutlinePaint(0, Color.red);
     * xylineandshaperenderer2.setUseFillPaint(true);
     * xylineandshaperenderer2 .setBaseItemLabelGenerator(new
     * StandardXYItemLabelGenerator());
     * xylineandshaperenderer2.setSeriesStroke(0, new BasicStroke(2.5F));
     * 
     * } for (int i = 0; i < _abnor_model.size(); i++) { XYDataset
     * xydataset3 = createmodeDataset(_abnor_model.get(i), "_abnor_model" +
     * i); XYLineAndShapeRenderer xylineandshaperenderer3 = new
     * XYLineAndShapeRenderer(); xyplot.setDataset(i + 2 +
     * _nor_model.size(), xydataset3); xyplot.setRenderer(i + 2 +
     * _nor_model.size(), xylineandshaperenderer3); // ???
     * xylineandshaperenderer3.setBaseShapesVisible(false); // ??
     * xylineandshaperenderer3.setSeriesLinesVisible(0, true);
     * xylineandshaperenderer3.setSeriesShape(0, double1); // 
     * xylineandshaperenderer3.setSeriesPaint(0, Color.red);
     * xylineandshaperenderer3.setSeriesFillPaint(0, Color.red);
     * xylineandshaperenderer3.setSeriesOutlinePaint(0, Color.red);
     * xylineandshaperenderer3.setUseFillPaint(true);
     * xylineandshaperenderer3 .setBaseItemLabelGenerator(new
     * StandardXYItemLabelGenerator());
     * xylineandshaperenderer3.setSeriesStroke(0, new BasicStroke(2.5F));
     * 
     * }
     */
    // ??
    // 
    // /////////////////////////////////
    // ?

    XYDataset xydataset4 = createLineDataset(nor, abnor, mapAB, xyplot);

    // ??y=1
    ValueMarker valuemarker = new ValueMarker(1); // 
    valuemarker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    valuemarker.setPaint(Color.black); // ?
    valuemarker.setStroke(new BasicStroke(1.0F)); // 
    // valuemarker.setLabel(""); //?
    valuemarker.setLabelFont(new Font("SansSerif", 0, 11)); // ?
    valuemarker.setLabelPaint(Color.red);
    valuemarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
    xyplot.addRangeMarker(valuemarker);
    // //

    //jfreechart.getLegend().setVisible(true);
    return jfreechart;
}

From source file:org.griphyn.vdl.karajan.monitor.monitors.swing.GraphPanel.java

private void addSeries(Series<?> series) {
    Unit unit = series.getUnit();/*from   www .  j a v  a2 s.  c o m*/
    XYPlot plot = chart.getXYPlot();
    Integer datasetIndex = datasetMapping.get(unit);
    TimeSeriesCollection col;
    if (datasetIndex == null) {
        col = new TimeSeriesCollection();
        int nextIndex = getNextDatasetIndex(plot);
        datasetMapping.put(unit, nextIndex);
        plot.setDataset(nextIndex, col);
        plot.setRenderer(nextIndex, new XYLineAndShapeRenderer(true, false));

        NumberAxis axis = new AutoNumberAxis(unit);
        plot.setRangeAxis(nextIndex, axis);
        plot.mapDatasetToRangeAxis(nextIndex, nextIndex);

        seriesMapping.put(unit, new ArrayList<String>());
    } else {
        col = (TimeSeriesCollection) plot.getDataset(datasetIndex);
    }
    TimeSeries ts = new SeriesWrapper(series, sampler);
    seriesMapping.get(unit).add(series.getKey());
    col.addSeries(ts);
    setColor(series.getKey(), palette.allocate());
}

From source file:com.graphhopper.jsprit.analysis.toolbox.Plotter.java

private XYPlot createPlot(final XYSeriesCollection problem, XYSeriesCollection shipments,
        XYSeriesCollection solution) {/*  w  w w . j  a  va 2s.  c o m*/
    XYPlot plot = new XYPlot();
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);

    XYLineAndShapeRenderer problemRenderer = getProblemRenderer(problem);
    plot.setDataset(0, problem);
    plot.setRenderer(0, problemRenderer);

    XYItemRenderer shipmentsRenderer = getShipmentRenderer(shipments);
    plot.setDataset(1, shipments);
    plot.setRenderer(1, shipmentsRenderer);

    if (solution != null) {
        XYItemRenderer solutionRenderer = getRouteRenderer(solution);
        plot.setDataset(2, solution);
        plot.setRenderer(2, solutionRenderer);
    }

    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();

    if (boundingBox == null) {
        xAxis.setRangeWithMargins(getDomainRange(problem));
        yAxis.setRangeWithMargins(getRange(problem));
    } else {
        xAxis.setRangeWithMargins(new Range(boundingBox.minX, boundingBox.maxX));
        yAxis.setRangeWithMargins(new Range(boundingBox.minY, boundingBox.maxY));
    }

    plot.setDomainAxis(xAxis);
    plot.setRangeAxis(yAxis);

    return plot;
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PortCounterPlotWorker.java

@Override
protected Void doInBackground() throws Exception {
    // 1.  counter value (already done, just add following to this)
    // 2.  delta/period
    ////from w ww.  j a va  2 s . c  o m
    //    -- if error counter --
    // 3.  include xmit and rcv traffic deltas? (own scale)
    //
    //
    //    -- if traffic counter --
    // 3.  include rate and utilization values?
    //

    // this is a SwingWorker thread from its pool, give it a recognizable name
    Thread.currentThread().setName("PortCounterPlotWorker");

    logger.info("Worker Building Plot");
    SMT_UpdateService updateService = SMT_UpdateService.getInstance();
    OMS_Collection history = updateService.getCollection();
    OSM_FabricDeltaCollection deltaHistory = history.getOSM_FabricDeltaCollection();

    XYPlot plot = (XYPlot) Chart.getPlot();

    // AXIS 2 - the change, or delta value of the desired counter
    NumberAxis axis2 = new NumberAxis(PortCounterAxisLabel.DELTA.getName());
    axis2.setFixedDimension(10.0);
    axis2.setAutoRangeIncludesZero(false);
    plot.setRangeAxis(1, axis2);

    XYDataset dataset2 = createDeltaDataset(deltaHistory, PortCounter, PortCounterAxisLabel.DELTA.getName());
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    plot.setRenderer(1, renderer2);

    // the other two axis are optional, and vary depending on the
    // type of counter
    NumberAxis axis3 = null;
    XYDataset dataset3 = null;
    XYItemRenderer renderer3 = null;
    NumberAxis axis4 = null;
    XYDataset dataset4 = null;
    XYItemRenderer renderer4 = null;

    if (AddExtra) {
        if (isError) {

            // add rcv deltas
            PortCounterName pcr = PortCounterName.rcv_data;
            axis3 = new NumberAxis(PortCounterAxisLabel.RCV_DELTA.getName());
            axis3.setFixedDimension(10.0);
            axis3.setAutoRangeIncludesZero(false);
            plot.setRangeAxis(2, axis3);

            dataset3 = createDeltaDataset(deltaHistory, pcr, pcr.getName());
            plot.setDataset(2, dataset3);
            plot.mapDatasetToRangeAxis(2, 2);
            renderer3 = new StandardXYItemRenderer();
            plot.setRenderer(2, renderer3);

            // add xmit deltas
            pcr = PortCounterName.xmit_data;
            axis4 = new NumberAxis(PortCounterAxisLabel.XMT_DELTA.getName());
            axis4.setFixedDimension(10.0);
            axis4.setAutoRangeIncludesZero(false);
            plot.setRangeAxis(3, axis4);

            dataset4 = createDeltaDataset(deltaHistory, pcr, pcr.getName());
            plot.setDataset(3, dataset4);
            plot.mapDatasetToRangeAxis(3, 3);
            renderer4 = new StandardXYItemRenderer();
            plot.setRenderer(3, renderer4);

            // use a common scale for both xmit and rcv counters
            double minRange = axis3.getLowerBound() < axis4.getLowerBound() ? axis3.getLowerBound()
                    : axis4.getLowerBound();
            double maxRange = axis3.getUpperBound() < axis4.getUpperBound() ? axis4.getUpperBound()
                    : axis3.getUpperBound();
            axis3.setAutoRange(false);
            axis4.setAutoRange(false);
            axis3.setRange(minRange, maxRange);
            axis4.setRange(minRange, maxRange);
        } else {
            // add rate
            PortCounterName pcr = PortCounter;
            axis3 = new NumberAxis(pcr.getName() + " " + PortCounterAxisLabel.RATE.getUnits());
            axis3.setFixedDimension(10.0);
            axis3.setAutoRangeIncludesZero(true);
            plot.setRangeAxis(2, axis3);

            dataset3 = createRateDataset(deltaHistory, pcr, PortCounterAxisLabel.RATE.getName());
            plot.setDataset(2, dataset3);
            plot.mapDatasetToRangeAxis(2, 2);
            renderer3 = new StandardXYItemRenderer();
            plot.setRenderer(2, renderer3);

            // add utilization
            axis4 = new NumberAxis(pcr.getName() + " " + PortCounterAxisLabel.UTILIZATION.getUnits());
            axis4.setFixedDimension(10.0);
            //         axis4.setAutoRangeIncludesZero(true);
            axis4.setRange(0.0, 100.0);
            plot.setRangeAxis(3, axis4);

            dataset4 = createUtilizationDataset(deltaHistory, pcr, PortCounterAxisLabel.UTILIZATION.getName());
            plot.setDataset(3, dataset4);
            plot.mapDatasetToRangeAxis(3, 3);
            renderer4 = new StandardXYItemRenderer();
            plot.setRenderer(3, renderer4);
        }
    }
    ChartUtilities.applyCurrentTheme(Chart);

    Color c1 = Color.black;
    Color c2 = Color.blue;

    Color c3 = Color.green;
    Color c4 = Color.magenta;

    Color ce = Color.red;

    if (isError)
        c2 = ce;

    // change the series and axis colours after the theme has
    // been applied...
    plot.getRenderer().setSeriesPaint(0, c1);

    renderer2.setSeriesPaint(0, c2);
    axis2.setLabelPaint(c2);
    axis2.setTickLabelPaint(c2);

    if (AddExtra) {
        renderer3.setSeriesPaint(0, c3);
        axis3.setLabelPaint(c3);
        axis3.setTickLabelPaint(c3);

        renderer4.setSeriesPaint(0, c4);
        axis4.setLabelPaint(c4);
        axis4.setTickLabelPaint(c4);
    }

    return null;
}