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

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

Introduction

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

Prototype

public void setRenderer(int index, XYItemRenderer renderer) 

Source Link

Document

Sets the renderer for the dataset with the specified index and sends a change event to all registered listeners.

Usage

From source file:Graph_with_jframe_and_arduino.java

public static void main(String[] args) {

    // create and configure the window
    JFrame window = new JFrame();
    window.setTitle("Sensor Graph GUI");
    window.setSize(600, 400);/* w ww  .  java 2  s. c o  m*/
    window.setLayout(new BorderLayout());
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // create a drop-down box and connect button, then place them at the top of the window
    JComboBox<String> portList_combobox = new JComboBox<String>();
    Dimension d = new Dimension(300, 100);
    portList_combobox.setSize(d);
    JButton connectButton = new JButton("Connect");
    JPanel topPanel = new JPanel();
    topPanel.add(portList_combobox);
    topPanel.add(connectButton);
    window.add(topPanel, BorderLayout.NORTH);
    //pause button
    JButton Pause_btn = new JButton("Start");

    // populate the drop-down box
    SerialPort[] portNames;
    portNames = SerialPort.getCommPorts();
    //check for new port available
    Thread thread_port = new Thread() {
        @Override
        public void run() {
            while (true) {
                SerialPort[] sp = SerialPort.getCommPorts();
                if (sp.length > 0) {
                    for (SerialPort sp_name : sp) {
                        int l = portList_combobox.getItemCount(), i;
                        for (i = 0; i < l; i++) {
                            //check port name already exist or not
                            if (sp_name.getSystemPortName().equalsIgnoreCase(portList_combobox.getItemAt(i))) {
                                break;
                            }
                        }
                        if (i == l) {
                            portList_combobox.addItem(sp_name.getSystemPortName());
                        }

                    }

                } else {
                    portList_combobox.removeAllItems();

                }
                portList_combobox.repaint();

            }

        }

    };
    thread_port.start();
    for (SerialPort sp_name : portNames)
        portList_combobox.addItem(sp_name.getSystemPortName());

    //for(int i = 0; i < portNames.length; i++)
    //   portList.addItem(portNames[i].getSystemPortName());

    // create the line graph
    XYSeries series = new XYSeries("line 1");
    XYSeries series2 = new XYSeries("line 2");
    XYSeries series3 = new XYSeries("line 3");
    XYSeries series4 = new XYSeries("line 4");
    for (int i = 0; i < 100; i++) {
        series.add(x, 0);
        series2.add(x, 0);
        series3.add(x, 0);
        series4.add(x, 10);
        x++;
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    dataset.addSeries(series2);
    XYSeriesCollection dataset2 = new XYSeriesCollection();
    dataset2.addSeries(series3);
    dataset2.addSeries(series4);

    //create jfree chart
    JFreeChart chart = ChartFactory.createXYLineChart("Sensor Readings", "Time (seconds)", "Arduino Reading",
            dataset);
    JFreeChart chart2 = ChartFactory.createXYLineChart("Sensor Readings", "Time (seconds)", "Arduino Reading 2",
            dataset2);

    //color render for chart 1
    XYLineAndShapeRenderer r1 = new XYLineAndShapeRenderer();
    r1.setSeriesPaint(0, Color.RED);
    r1.setSeriesPaint(1, Color.GREEN);
    r1.setSeriesShapesVisible(0, false);
    r1.setSeriesShapesVisible(1, false);

    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(0, r1);
    plot.setRenderer(1, r1);

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.blue);

    //color render for chart 2
    XYLineAndShapeRenderer r2 = new XYLineAndShapeRenderer();
    r2.setSeriesPaint(0, Color.BLUE);
    r2.setSeriesPaint(1, Color.ORANGE);
    r2.setSeriesShapesVisible(0, false);
    r2.setSeriesShapesVisible(1, false);

    XYPlot plot2 = chart2.getXYPlot();
    plot2.setRenderer(0, r2);
    plot2.setRenderer(1, r2);

    ChartPanel cp = new ChartPanel(chart);
    ChartPanel cp2 = new ChartPanel(chart2);

    //multiple graph container
    JPanel graph_container = new JPanel();
    graph_container.setLayout(new BoxLayout(graph_container, BoxLayout.X_AXIS));
    graph_container.add(cp);
    graph_container.add(cp2);

    //add chart panel in main window
    window.add(graph_container, BorderLayout.CENTER);
    //window.add(cp2, BorderLayout.WEST);

    window.add(Pause_btn, BorderLayout.AFTER_LAST_LINE);
    Pause_btn.setEnabled(false);
    //pause btn action
    Pause_btn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (Pause_btn.getText().equalsIgnoreCase("Pause")) {

                if (chosenPort.isOpen()) {
                    try {
                        Output.write(0);
                    } catch (IOException ex) {
                        Logger.getLogger(Graph_with_jframe_and_arduino.class.getName()).log(Level.SEVERE, null,
                                ex);
                    }
                }

                Pause_btn.setText("Start");
            } else {
                if (chosenPort.isOpen()) {
                    try {
                        Output.write(1);
                    } catch (IOException ex) {
                        Logger.getLogger(Graph_with_jframe_and_arduino.class.getName()).log(Level.SEVERE, null,
                                ex);
                    }
                }

                Pause_btn.setText("Pause");
            }
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });

    // configure the connect button and use another thread to listen for data
    connectButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (connectButton.getText().equals("Connect")) {
                // attempt to connect to the serial port
                chosenPort = SerialPort.getCommPort(portList_combobox.getSelectedItem().toString());
                chosenPort.setComPortTimeouts(SerialPort.TIMEOUT_SCANNER, 0, 0);
                if (chosenPort.openPort()) {
                    Output = chosenPort.getOutputStream();
                    connectButton.setText("Disconnect");
                    Pause_btn.setEnabled(true);
                    portList_combobox.setEnabled(false);
                }

                // create a new thread that listens for incoming text and populates the graph
                Thread thread = new Thread() {
                    @Override
                    public void run() {
                        Scanner scanner = new Scanner(chosenPort.getInputStream());
                        while (scanner.hasNextLine()) {
                            try {
                                String line = scanner.nextLine();
                                int number = Integer.parseInt(line);
                                series.add(x, number);
                                series2.add(x, number / 2);
                                series3.add(x, number / 1.5);
                                series4.add(x, number / 5);

                                if (x > 100) {
                                    series.remove(0);
                                    series2.remove(0);
                                    series3.remove(0);
                                    series4.remove(0);
                                }

                                x++;
                                window.repaint();
                            } catch (Exception e) {
                            }
                        }
                        scanner.close();
                    }
                };
                thread.start();
            } else {
                // disconnect from the serial port
                chosenPort.closePort();
                portList_combobox.setEnabled(true);
                Pause_btn.setEnabled(false);
                connectButton.setText("Connect");

            }
        }
    });

    // show the window
    window.setVisible(true);
}

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

private static JFreeChart createChart(TableXYDataset tablexydataset) {
    JFreeChart jfreechart = ChartFactory.createStackedXYAreaChart("StackedXYAreaRendererDemo1", "X Value",
            "Y Value", tablexydataset, PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    StackedXYAreaRenderer stackedxyarearenderer = new StackedXYAreaRenderer(5);
    stackedxyarearenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    xyplot.setRenderer(0, stackedxyarearenderer);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    stackedxyarearenderer.setShapePaint(Color.yellow);
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

From source file:de.bund.bfr.knime.chart.ChartUtils.java

public static void addDataSetToPlot(XYPlot plot, XYDataset dataSet, XYItemRenderer renderer) {
    int i = plot.getDataset(0) == null ? 0 : plot.getDatasetCount();

    plot.setDataset(i, dataSet);/*  ww  w . j  av  a 2 s .  c  o m*/
    plot.setRenderer(i, renderer);
}

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

private static JFreeChart createChart(TableXYDataset tablexydataset) {
    JFreeChart jfreechart = ChartFactory.createStackedXYAreaChart("Stacked XY Area Chart Demo 1", "X Value",
            "Y Value", tablexydataset, PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    StackedXYAreaRenderer stackedxyarearenderer = new StackedXYAreaRenderer();
    stackedxyarearenderer.setSeriesPaint(0, Color.lightGray);
    stackedxyarearenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    xyplot.setRenderer(0, stackedxyarearenderer);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    return jfreechart;
}

From source file:com.spotify.heroic.http.render.RenderUtils.java

private static JFreeChart buildChart(final String title, final XYDataset lineAndShape, final XYDataset interval,
        final XYItemRenderer lineAndShapeRenderer, final XYItemRenderer intervalRenderer) {
    final ValueAxis timeAxis = new DateAxis();
    timeAxis.setLowerMargin(0.02);//from w  w  w . j a v a  2 s  . c  o m
    timeAxis.setUpperMargin(0.02);

    final NumberAxis valueAxis = new NumberAxis();
    valueAxis.setAutoRangeIncludesZero(false);

    final XYPlot plot = new XYPlot();

    plot.setDomainAxis(0, timeAxis);
    plot.setRangeAxis(0, valueAxis);

    plot.setDataset(0, lineAndShape);
    plot.setRenderer(0, lineAndShapeRenderer);

    plot.setDomainAxis(1, timeAxis);
    plot.setRangeAxis(1, valueAxis);

    plot.setDataset(1, interval);
    plot.setRenderer(1, intervalRenderer);

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

From source file:audio.cords.old.RegressionDemo.java

private static JFreeChart createChart(XYSeriesCollection data) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, "X", "Y", data, PlotOrientation.VERTICAL, true,
            false, false);/*from   w w  w  . j  a v  a2  s  .  c  o  m*/
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer scatterRenderer = plot.getRenderer();
    StandardXYItemRenderer regressionRenderer = new StandardXYItemRenderer();
    regressionRenderer.setBaseSeriesVisibleInLegend(false);
    plot.setDataset(1, regress(data));
    plot.setRenderer(1, regressionRenderer);
    DrawingSupplier ds = plot.getDrawingSupplier();
    for (int i = 0; i < data.getSeriesCount(); i++) {
        Paint paint = ds.getNextPaint();
        scatterRenderer.setSeriesPaint(i, paint);
        regressionRenderer.setSeriesPaint(i, paint);
    }
    return chart;
}

From source file:net.sf.jsfcomp.chartcreator.utils.ChartAxisUtils.java

public static void createXYSeriesAxis(JFreeChart chart, ChartAxisData chartAxisData, int axisIndex) {
    ValueAxis axis = null;/*from   ww w . java  2 s. c  om*/
    if (chartAxisData.getType() != null) {
        if (chartAxisData.getType().equals("number"))
            axis = createNumberAxis(chart, chartAxisData);
        else if (chartAxisData.getType().equals("date"))
            axis = createDateAxis(chart, chartAxisData);

        if (chartAxisData.getTickLabelFontSize() > 0) {
            Font tickFont = CategoryAxis.DEFAULT_TICK_LABEL_FONT
                    .deriveFont(chartAxisData.getTickLabelFontSize());
            axis.setTickLabelFont(tickFont);
        }

        axis.setTickLabelsVisible(chartAxisData.isTickLabels());
        axis.setTickMarksVisible(chartAxisData.isTickMarks());
        axis.setVerticalTickLabels(chartAxisData.isVerticalTickLabels());
    }

    XYPlot plot = chart.getXYPlot();
    if (chartAxisData.isDomain()) {
        plot.setDomainAxis(plot.getDomainAxisCount() - 1, axis);
    } else {
        plot.setRangeAxis(axisIndex, axis);
        XYDataset dataset = (XYDataset) chartAxisData.getDatasource();
        plot.setRenderer(axisIndex, new StandardXYItemRenderer());
        plot.setDataset(axisIndex, dataset);
        plot.mapDatasetToRangeAxis(axisIndex, axisIndex);
    }

    setXYSeriesAxisColors(chartAxisData, plot.getRenderer(axisIndex));
}

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

public static JPanel createDemoPanel() {
    TimeSeries timeseries = new TimeSeries("Annual");
    timeseries.add(new Year(1998), 80D);
    timeseries.add(new Year(1999), 85D);
    timeseries.add(new Year(2000), 87.599999999999994D);
    TimeSeriesCollection dataset1 = new TimeSeriesCollection(timeseries);
    TimeSeries timeseries1 = new TimeSeries("Monthly A");
    timeseries1.add(new Month(7, 2000), 85.799999999999997D);
    timeseries1.add(new Month(8, 2000), 85.799999999999997D);
    timeseries1.add(new Month(9, 2000), 85.799999999999997D);
    timeseries1.add(new Month(10, 2000), 86.5D);
    timeseries1.add(new Month(11, 2000), 86.5D);
    timeseries1.add(new Month(12, 2000), 86.5D);
    timeseries1.add(new Month(1, 2001), 87.700000000000003D);
    timeseries1.add(new Month(2, 2001), 87.700000000000003D);
    timeseries1.add(new Month(3, 2001), 87.700000000000003D);
    timeseries1.add(new Month(4, 2001), 88.5D);
    timeseries1.add(new Month(5, 2001), 88.5D);
    timeseries1.add(new Month(6, 2001), 88.5D);
    timeseries1.add(new Month(7, 2001), 90D);
    timeseries1.add(new Month(8, 2001), 90D);
    timeseries1.add(new Month(9, 2001), 90D);
    timeseries1.add(new Month(10, 2001), 90D);
    timeseries1.add(new Month(11, 2001), 90D);
    timeseries1.add(new Month(12, 2001), 90D);
    timeseries1.add(new Month(1, 2002), 90D);
    timeseries1.add(new Month(2, 2002), 90D);
    timeseries1.add(new Month(3, 2002), 90D);
    timeseries1.add(new Month(4, 2002), 90D);
    timeseries1.add(new Month(5, 2002), 90D);
    timeseries1.add(new Month(6, 2002), 90D);
    TimeSeries timeseries2 = new TimeSeries("Monthly B");
    timeseries2.add(new Month(7, 2000), 83.799999999999997D);
    timeseries2.add(new Month(8, 2000), 83.799999999999997D);
    timeseries2.add(new Month(9, 2000), 83.799999999999997D);
    timeseries2.add(new Month(10, 2000), 84.5D);
    timeseries2.add(new Month(11, 2000), 84.5D);
    timeseries2.add(new Month(12, 2000), 84.5D);
    timeseries2.add(new Month(1, 2001), 85.700000000000003D);
    timeseries2.add(new Month(2, 2001), 85.700000000000003D);
    timeseries2.add(new Month(3, 2001), 85.700000000000003D);
    timeseries2.add(new Month(4, 2001), 86.5D);
    timeseries2.add(new Month(5, 2001), 86.5D);
    timeseries2.add(new Month(6, 2001), 86.5D);
    timeseries2.add(new Month(7, 2001), 88D);
    timeseries2.add(new Month(8, 2001), 88D);
    timeseries2.add(new Month(9, 2001), 88D);
    timeseries2.add(new Month(10, 2001), 88D);
    timeseries2.add(new Month(11, 2001), 88D);
    timeseries2.add(new Month(12, 2001), 88D);
    timeseries2.add(new Month(1, 2002), 88D);
    timeseries2.add(new Month(2, 2002), 88D);
    timeseries2.add(new Month(3, 2002), 88D);
    timeseries2.add(new Month(4, 2002), 88D);
    timeseries2.add(new Month(5, 2002), 88D);
    timeseries2.add(new Month(6, 2002), 88D);
    TimeSeriesCollection dataset21 = new TimeSeriesCollection();
    dataset21.addSeries(timeseries1);//from ww  w  .  j a  v  a  2  s . co  m
    dataset21.addSeries(timeseries2);
    TimeSeries timeseries3 = new TimeSeries("XXX");
    timeseries3.add(new Month(7, 2000), 81.5D);
    timeseries3.add(new Month(8, 2000), 86D);
    timeseries3.add(new Month(9, 2000), 82D);
    timeseries3.add(new Month(10, 2000), 89.5D);
    timeseries3.add(new Month(11, 2000), 88D);
    timeseries3.add(new Month(12, 2000), 88D);
    timeseries3.add(new Month(1, 2001), 90D);
    timeseries3.add(new Month(2, 2001), 89.5D);
    timeseries3.add(new Month(3, 2001), 90.200000000000003D);
    timeseries3.add(new Month(4, 2001), 90.599999999999994D);
    timeseries3.add(new Month(5, 2001), 87.5D);
    timeseries3.add(new Month(6, 2001), 91D);
    timeseries3.add(new Month(7, 2001), 89.700000000000003D);
    timeseries3.add(new Month(8, 2001), 87D);
    timeseries3.add(new Month(9, 2001), 91.200000000000003D);
    timeseries3.add(new Month(10, 2001), 84D);
    timeseries3.add(new Month(11, 2001), 90D);
    timeseries3.add(new Month(12, 2001), 92D);
    TimeSeriesCollection dataset22 = new TimeSeriesCollection(timeseries3);
    //
    XYBarRenderer renderer1 = new XYBarRenderer(0.20000000000000001D);
    renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} ({1}, {2})",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0.00")));
    XYPlot plot1 = new XYPlot(dataset1, new DateAxis("Date"), null, renderer1);
    //
    XYAreaRenderer renderer21 = new XYAreaRenderer();
    XYPlot plot2 = new XYPlot(dataset21, new DateAxis("Date"), null, renderer21);
    StandardXYItemRenderer renderer22 = new StandardXYItemRenderer(3);
    renderer22.setBaseShapesFilled(true);
    plot2.setDataset(1, dataset22);
    plot2.setRenderer(1, renderer22);
    plot2.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    //
    NumberAxis valueAxis = new NumberAxis("Value");
    valueAxis.setAutoRangeIncludesZero(false);
    CombinedRangeXYPlot combinedPlot = new CombinedRangeXYPlot(valueAxis);
    combinedPlot.add(plot1, 1);
    combinedPlot.add(plot2, 4);
    //chart
    JFreeChart jfreechart = new JFreeChart("Sample Combined Plot", JFreeChart.DEFAULT_TITLE_FONT, combinedPlot,
            true);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(500, 270));
    chartpanel.addChartMouseListener(new ChartMouseListener() {

        public void chartMouseClicked(ChartMouseEvent chartmouseevent) {
            System.out.println(chartmouseevent.getEntity());
        }

        public void chartMouseMoved(ChartMouseEvent chartmouseevent) {
            System.out.println(chartmouseevent.getEntity());
        }

    });
    return chartpanel;
}

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

private static JFreeChart createChart() {
    IntervalXYDataset dataset1 = createDataset1();
    XYBarRenderer renderer1 = new XYBarRenderer(0.20000000000000001D);
    renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: ({1}, {2})",
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    DateAxis domainAxis = new DateAxis("Date");
    domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    NumberAxis valueAxis = new NumberAxis("Value");
    XYPlot plot = new XYPlot(dataset1, domainAxis, valueAxis, renderer1);
    XYDataset dataset2 = createDataset2();
    StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: ({1}, {2})",
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    plot.setDataset(1, dataset2);/* w w  w .  ja v  a 2 s .  c  o  m*/
    plot.setRenderer(1, renderer2);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    return new JFreeChart("Overlaid XYPlot Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}

From source file:org.fhcrc.cpl.viewer.gui.SpectrumChartFactory.java

protected static XYPlot createXYPlot(XYDataset dataset, Color[] colors) {
    // break up into two datasets, one for bars one for lines
    //LinkedList lines =new LinkedList();
    //LinkedList bars = new LinkedList();
    XYDataset seriesLines = new XYSeriesCollection();
    XYDataset seriesBars = new XYSeriesCollection();
    ((XYSeriesCollection) seriesBars).setIntervalWidth(0.0);

    if (dataset instanceof XYSeriesCollection) {
        while (0 < dataset.getSeriesCount()) {
            XYSeries s = ((XYSeriesCollection) dataset).getSeries(0);
            ((XYSeriesCollection) dataset).removeSeries(0);
            Comparable key = s.getKey();
            boolean lines = false;
            if (key instanceof String)
                lines = ((String) key).startsWith("-");
            if (lines)
                ((XYSeriesCollection) seriesLines).addSeries(s);
            else/*  www.ja  v a 2 s  .  c o  m*/
                ((XYSeriesCollection) seriesBars).addSeries(s);
        }
    } else {
        seriesBars = dataset;
    }

    NumberAxis axisDomain = new NumberAxis();
    axisDomain.setAutoRange(true);
    axisDomain.setAutoRangeIncludesZero(false);
    //      axisDomain.setRange(400.0, 1600.0);
    // NOTE: zooming in too far kills the chart, prevent this
    axisDomain.addChangeListener(new AxisChangeListener() {
        public void axisChanged(AxisChangeEvent event) {
            NumberAxis axis = (NumberAxis) event.getSource();
            Range range = axis.getRange();
            if (range.getLength() < 2.0) {
                //_log.info("AxisChangeListener " + range.getLength() + " " + range.toString());
                double middle = range.getLowerBound() + range.getLength() / 2.0;
                axis.setRange(new Range(middle - 1.1, middle + 1.1));
            }
        }
    });

    NumberAxis axisRange = new NumberAxis();
    axisRange.setAutoRange(true);
    axisRange.setAutoRangeIncludesZero(true);

    XYToolTipGenerator toolTipGenerator = new XYToolTipGenerator() {
        public String generateToolTip(XYDataset xyDataset, int s, int i) {
            double X = Math.round(xyDataset.getXValue(s, i) * 1000.0) / 1000.0;
            double Y = Math.round(xyDataset.getYValue(s, i) * 1000.0) / 1000.0;
            return "(" + X + ", " + Y + ")";
        }
    };

    XYBarRenderer barRenderer = new XYBarRenderer();
    //dhmay adding 2009/09/14.  As of jfree 1.0.13, shadows on by default        
    barRenderer.setShadowVisible(false);

    //dhmay adding for jfreechart 1.0.6 upgrade.  If this isn't here, we get a
    //nullPointerException in XYBarRenderer.drawItemLabel
    barRenderer.setBaseItemLabelGenerator(new NullLabelGenerator());

    barRenderer.setSeriesItemLabelsVisible(0, true);
    barRenderer.setBaseToolTipGenerator(toolTipGenerator);

    XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer();
    lineRenderer.setBaseToolTipGenerator(toolTipGenerator);

    XYPlot xy = new XYPlot(null, axisDomain, axisRange, null);

    int ds = 0;
    if (seriesLines.getSeriesCount() > 0) {
        xy.setDataset(ds, seriesLines);
        xy.setRenderer(ds, lineRenderer);
        xy.mapDatasetToRangeAxis(ds, 0);
        ds++;
        for (int i = 0; i < seriesLines.getSeriesCount(); i++) {
            Comparable key = ((XYSeriesCollection) seriesLines).getSeriesKey(i);
            boolean lines = false;
            if (key instanceof String)
                lines = ((String) key).startsWith("-");
            lineRenderer.setSeriesLinesVisible(i, lines);
            lineRenderer.setSeriesShapesVisible(i, !lines);
        }
    }
    if (seriesBars.getSeriesCount() > 0) {
        xy.setDataset(ds, seriesBars);
        xy.setRenderer(ds, barRenderer);
        xy.mapDatasetToRangeAxis(ds, 0);
        ds++;
    }

    setColors(xy, colors);

    return xy;
}