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

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

Introduction

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

Prototype

public void setRenderer(int index, CategoryItemRenderer renderer) 

Source Link

Document

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

Usage

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

private static JFreeChart createChart() {
    JFreeChart jfreechart = ChartFactory.createBarChart("Dual Axis Chart", "Category", "Value",
            createDataset1(), PlotOrientation.VERTICAL, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(new Color(238, 238, 255));
    categoryplot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    CategoryDataset categorydataset = createDataset2();
    categoryplot.setDataset(1, categorydataset);
    categoryplot.mapDatasetToRangeAxis(1, 1);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
    NumberAxis numberaxis = new NumberAxis("Secondary");
    categoryplot.setRangeAxis(1, numberaxis);
    LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
    lineandshaperenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    categoryplot.setRenderer(1, lineandshaperenderer);
    categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    LegendTitle legendtitle = new LegendTitle(categoryplot.getRenderer(0));
    legendtitle.setMargin(new RectangleInsets(2D, 2D, 2D, 2D));
    legendtitle.setFrame(new BlockBorder());
    LegendTitle legendtitle1 = new LegendTitle(categoryplot.getRenderer(1));
    legendtitle1.setMargin(new RectangleInsets(2D, 2D, 2D, 2D));
    legendtitle1.setFrame(new BlockBorder());
    BlockContainer blockcontainer = new BlockContainer(new BorderArrangement());
    blockcontainer.add(legendtitle, RectangleEdge.LEFT);
    blockcontainer.add(legendtitle1, RectangleEdge.RIGHT);
    blockcontainer.add(new EmptyBlock(2000D, 0.0D));
    CompositeTitle compositetitle = new CompositeTitle(blockcontainer);
    compositetitle.setPosition(RectangleEdge.BOTTOM);
    jfreechart.addSubtitle(compositetitle);
    return jfreechart;
}

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

public static JFreeChart createChart(CategoryDataset acategorydataset[]) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Freshmeat Software Projects", "Language", "Projects",
            acategorydataset[0], PlotOrientation.VERTICAL, true, true, false);
    jfreechart.addSubtitle(new TextTitle("By Programming Language"));
    jfreechart.addSubtitle(new TextTitle("As at 5 March 2003"));
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setLowerMargin(0.02D);//w  w  w  . ja  va2  s . co  m
    categoryaxis.setUpperMargin(0.02D);
    categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
    NumberAxis numberaxis1 = new NumberAxis("Percent");
    numberaxis1.setNumberFormatOverride(NumberFormat.getPercentInstance());
    categoryplot.setRangeAxis(1, numberaxis1);
    categoryplot.setDataset(1, acategorydataset[1]);
    categoryplot.setRenderer(1, lineandshaperenderer);
    categoryplot.mapDatasetToRangeAxis(1, 1);
    categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    return jfreechart;
}

From source file:org.fhaes.jsea.JSEABarChart.java

/**
 * Creates a demo chart.//from w  w w. j  a va  2  s .c o m
 * 
 * @return A chart.
 */
@SuppressWarnings("deprecation")
public static JFreeChart createChart(String title, double[] meanByWindow, int lengthOfWindow,
        int yearsPriorOfEvent, int yearsAfterEvent, double[][] leftEndPointSim, double[][] rightEndPointSim,
        String outputFilePrefix, int alphaLevel, int segmentIndex) {

    JSEABarChart.meanByWindow = meanByWindow;
    JSEABarChart.lengthOfWindow = lengthOfWindow;
    JSEABarChart.yearsPriorOfEvent = yearsPriorOfEvent;
    JSEABarChart.leftEndPointSim = leftEndPointSim;
    JSEABarChart.rightEndPointSim = rightEndPointSim;
    JSEABarChart.alphaLevel = alphaLevel;

    CategoryPlot plot = new CategoryPlot();
    plot.setDataset(0, createDataset());
    plot.setOrientation(PlotOrientation.VERTICAL);

    CustomBarRenderer renderer = new CustomBarRenderer(createPaint(lengthOfWindow, Color.gray));
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setDrawBarOutline(false);
    renderer.setOutlinePaint(Color.yellow);
    renderer.setOutlineStroke(new BasicStroke(1.1f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL));
    renderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    plot.setRenderer(0, renderer);
    Color allcolors[] = { Color.red, Color.green, Color.blue };

    System.out.println("here is the alphlevel " + alphaLevel);
    // for (int k = 0; k <= 5; k++) {
    // if (k <= 2) {
    // / plot.setDataset(k + 1, createEndDataset(k, true));
    // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k], k));
    // } else {
    // plot.setDataset(k + 1, createEndDataset(k - 3, false));
    // plot.setRenderer(k + 1, createCategoryItemRenderer(allcolors[k - 3], k - 3));
    // }
    // }
    // for (int k = 0; k <1; k++) {
    // if (k <= 2) {
    plot.setDataset(1, createEndDataset(alphaLevel, true));
    plot.setRenderer(1, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel));
    // } else {
    plot.setDataset(4, createEndDataset(alphaLevel, false));
    plot.setRenderer(4, createCategoryItemRenderer(allcolors[alphaLevel], alphaLevel));
    // }
    // }
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    // plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainAxis(new CategoryAxis("LAG"));

    plot.addRangeMarker(new ValueMarker(0));

    plot.setRangeAxis(new NumberAxis(outputFilePrefix));
    plot.setRangeGridlinesVisible(true);

    JFreeChart chart = new JFreeChart(plot);
    chart.setTitle(title);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.WHITE);

    return chart;
}

From source file:de.laures.cewolf.taglib.CewolfChartFactory.java

public static JFreeChart getOverlaidChartInstance(String chartType, String title, String xAxisLabel,
        String yAxisLabel, int xAxisType, int yAxisType, List plotDefinitions)
        throws ChartValidationException, DatasetProduceException {
    final int chartTypeConst = getChartTypeConstant(chartType);
    final AxisFactory axisFactory = AxisFactory.getInstance();
    switch (chartTypeConst) {
    case OVERLAY_XY:
        ValueAxis domainAxis = (ValueAxis) axisFactory.createAxis(ORIENTATION_HORIZONTAL, xAxisType,
                xAxisLabel);//  w  w w .  j a  v a 2  s  .c om
        // get main plot
        PlotDefinition mainPlotDef = (PlotDefinition) plotDefinitions.get(0);
        check((Dataset) mainPlotDef.getDataset(), XYDataset.class, chartType);
        XYPlot plot = (XYPlot) mainPlotDef.getPlot(chartTypeConst);
        plot.setDomainAxis(domainAxis);
        plot.setRangeAxis((ValueAxis) axisFactory.createAxis(ORIENTATION_VERTICAL, yAxisType, yAxisLabel));
        //plot.setRenderer(new StandardXYItemRenderer());
        // add second and later datasets to main plot
        for (int plotidx = 1; plotidx < plotDefinitions.size(); plotidx++) {
            PlotDefinition subPlotDef = (PlotDefinition) plotDefinitions.get(plotidx);
            check((Dataset) subPlotDef.getDataset(), XYDataset.class, chartType);
            plot.setDataset(plotidx, (XYDataset) subPlotDef.getDataset());

            int rendererIndex = PlotTypes.getRendererIndex(subPlotDef.getType());
            XYItemRenderer rend = (XYItemRenderer) PlotTypes.getRenderer(rendererIndex);
            plot.setRenderer(plotidx, rend);
        }
        return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    case OVERLAY_CATEGORY://added by lrh 2005-07-11
        CategoryAxis domainAxis2 = (CategoryAxis) axisFactory.createAxis(ORIENTATION_HORIZONTAL, xAxisType,
                xAxisLabel);
        // get main plot
        mainPlotDef = (PlotDefinition) plotDefinitions.get(0);
        check((Dataset) mainPlotDef.getDataset(), CategoryDataset.class, chartType);
        CategoryPlot plot2 = (CategoryPlot) mainPlotDef.getPlot(chartTypeConst);
        plot2.setDomainAxis(domainAxis2);
        plot2.setRangeAxis((ValueAxis) axisFactory.createAxis(ORIENTATION_VERTICAL, yAxisType, yAxisLabel));
        //plot.setRenderer(new StandardXYItemRenderer());
        // add second and later datasets to main plot
        for (int plotidx = 1; plotidx < plotDefinitions.size(); plotidx++) {
            PlotDefinition subPlotDef = (PlotDefinition) plotDefinitions.get(plotidx);
            check((Dataset) subPlotDef.getDataset(), CategoryDataset.class, chartType);
            plot2.setDataset(plotidx, (CategoryDataset) subPlotDef.getDataset());

            int rendererIndex = PlotTypes.getRendererIndex(subPlotDef.getType());
            CategoryItemRenderer rend2 = (CategoryItemRenderer) PlotTypes.getRenderer(rendererIndex);
            plot2.setRenderer(plotidx, rend2);
        }
        return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot2, true);
    default:
        throw new UnsupportedChartTypeException(chartType + " is not supported.");
    }
}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.IslandsView.java

/**
 * Creates the GUI controls for toggling graph display options.
 * @return A component that can be added to the main panel.
 *//* ww  w  .ja va 2 s.  co m*/
private JComponent createControls() {
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox meanCheckBox = new JCheckBox("Show Mean and Standard Deviation", false);
    meanCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent itemEvent) {
            chart.setNotify(false);
            CategoryPlot plot = (CategoryPlot) chart.getPlot();
            if (itemEvent.getStateChange() == ItemEvent.SELECTED) {
                plot.setDataset(1, meanDataSet);
                plot.setRenderer(1, meanRenderer);
            } else {
                plot.setDataset(1, null);
                plot.setRenderer(1, null);
            }
            chart.setNotify(true);
        }
    });
    controls.add(meanCheckBox);

    return controls;
}

From source file:org.amanzi.awe.charts.builder.CategoryChartBuilder.java

@Override
protected void setSecondAxisForPlot(CategoryPlot plot, Dataset dataset, LineAndShapeRenderer subRenderer,
        NumberAxis secondAxis) {//from  w ww. j  ava2s.  c o m
    plot.setDataset(1, (CategoryDataset) dataset);
    plot.mapDatasetToRangeAxis(1, 1);
    plot.setRangeAxis(1, secondAxis);
    plot.setRangeAxisLocation(1, AxisLocation.TOP_OR_LEFT);
    plot.setRenderer(1, subRenderer);
}

From source file:ui.results.ResultChartPanel.java

/**
 * Construct new Result panel/* ww w  . j  a  va  2s.c  om*/
 */
public ResultChartPanel() {
    // The charting objects
    dataset = new DefaultStatisticalCategoryDataset();
    upper = new DefaultCategoryDataset();
    lower = new DefaultCategoryDataset();

    // The Renderers
    lineRenderer0 = new LineAndShapeRenderer();
    lineRenderer1 = new LineAndShapeRenderer();
    lineRenderer2 = new LineAndShapeRenderer();
    lineRenderer0.setSeriesPaint(0, lowerColor);
    lineRenderer1.setSeriesPaint(0, mspColor);
    lineRenderer2.setSeriesPaint(0, upperColor);
    lineRenderer0.setSeriesShapesVisible(0, false);
    lineRenderer1.setSeriesShapesVisible(0, false);
    lineRenderer2.setSeriesShapesVisible(0, false);

    barRenderer = new StatisticalBarRenderer();
    barRenderer.setSeriesPaint(0, mspColor);

    // The Plot: begin as a line plot
    CategoryPlot plot = new CategoryPlot();
    plot.setDomainAxis(new CategoryAxis("Datasets"));
    plot.setRangeAxis(new NumberAxis("MSP"));
    plot.setRenderer(0, lineRenderer0);
    plot.setRenderer(1, lineRenderer1);
    plot.setRenderer(2, lineRenderer2);
    plot.setDataset(0, lower);
    plot.setDataset(1, dataset);
    plot.setDataset(2, upper);

    // Adding the new plot
    chart = new JFreeChart(plot);
    panel = new ChartPanel(chart);

    // Listening to changes
    //dataset.addChangeListener(chart.getPlot());
    chart.getPlot().addChangeListener(chart);
    chart.addChangeListener(panel);

    ((CategoryPlot) chart.getPlot()).getRangeAxis().setAutoRange(true);

    // Choice panel: choicing between line and bar chart
    JPanel choicePanel = createChoicePanel();

    // Doing the interface
    setLayout(new BorderLayout());
    add(choicePanel, BorderLayout.NORTH);
    add(panel, BorderLayout.CENTER);
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Chart"));

    // size stuff
    //setPreferredSize(new Dimension(500, 400));
}

From source file:org.pentaho.reporting.engine.classic.extensions.legacy.charts.LegacyChartType.java

private JFreeChart createChart(final Expression aExpression) {
    if (aExpression instanceof BarLineChartExpression) {
        final CategoryAxis catAxis = new CategoryAxis("Category");// NON-NLS
        final NumberAxis barsAxis = new NumberAxis("Value");// NON-NLS
        final NumberAxis linesAxis = new NumberAxis("Value2");// NON-NLS

        final CategoryPlot plot = new CategoryPlot(createDataset(), catAxis, barsAxis, new BarRenderer());
        plot.setRenderer(1, new LineAndShapeRenderer());

        // add lines dataset and axis to plot
        plot.setDataset(1, createDataset());
        plot.setRangeAxis(1, linesAxis);

        // map lines to second axis
        plot.mapDatasetToRangeAxis(1, 1);

        // set rendering order
        plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

        // set location of second axis
        plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

        return new JFreeChart("Bar Line Chart", plot);
    }//w w w  .  ja  v  a 2 s  .  c o m

    if (aExpression instanceof RingChartExpression) {
        return ChartFactory.createRingChart("Ring Chart", createPieDataset(), true, false, false);// NON-NLS
    }
    if (aExpression instanceof AreaChartExpression) {
        return ChartFactory.createAreaChart("Area Chart", "Category", "Value", createDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof BarChartExpression) {
        return ChartFactory.createBarChart("Bar Chart", "Category", "Value", createDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS

    }
    if (aExpression instanceof LineChartExpression) {
        return ChartFactory.createLineChart("Line Chart", "Category", "Value", createDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof MultiPieChartExpression) {
        return ChartFactory.createMultiplePieChart("Multi Pie Chart", createDataset(), TableOrder.BY_COLUMN,
                true, false, false);// NON-NLS
    }
    if (aExpression instanceof PieChartExpression) {
        return ChartFactory.createPieChart("Pie Chart", createPieDataset(), true, false, false);// NON-NLS
    }
    if (aExpression instanceof WaterfallChartExpressions) {
        return ChartFactory.createWaterfallChart("Bar Chart", "Category", "Value", createDataset(),
                PlotOrientation.HORIZONTAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof BubbleChartExpression) {
        return ChartFactory.createBubbleChart("Bubble Chart", "X", "Y", createXYZDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof ExtendedXYLineChartExpression) {
        return ChartFactory.createXYLineChart("XY Line Chart", "X", "Y", createXYZDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof ScatterPlotChartExpression) {
        return ChartFactory.createScatterPlot("Scatter Chart", "X", "Y", createXYZDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof XYAreaLineChartExpression) {
        final NumberAxis catAxis = new NumberAxis("Range");// NON-NLS
        final NumberAxis barsAxis = new NumberAxis("Value");// NON-NLS
        final NumberAxis linesAxis = new NumberAxis("Value2");// NON-NLS

        final XYPlot plot = new XYPlot(createXYZDataset(), catAxis, barsAxis, new XYAreaRenderer());
        plot.setRenderer(1, new XYLineAndShapeRenderer());

        // add lines dataset and axis to plot
        plot.setDataset(1, createXYZDataset());
        plot.setRangeAxis(1, linesAxis);

        // map lines to second axis
        plot.mapDatasetToRangeAxis(1, 1);

        // set rendering order
        plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

        // set location of second axis
        plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

        return new JFreeChart("XY Area Line Chart", plot);// NON-NLS
    }
    if (aExpression instanceof XYAreaChartExpression) {
        return ChartFactory.createXYAreaChart("XY Area Chart", "X", "Y", createXYZDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof XYBarChartExpression) {
        return XYBarChartExpression.createXYBarChart("XY Bar Chart", "X", false, "Y", createIntervalXYDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof XYLineChartExpression) {
        return ChartFactory.createXYLineChart("XY Line Chart", "X", "Y", createXYZDataset(),
                PlotOrientation.VERTICAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof RadarChartExpression) {
        final SpiderWebPlot plot = new SpiderWebPlot(createDataset());
        return new JFreeChart("Radar Chart", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
    if (aExpression instanceof ThermometerChartExpression) {
        final DefaultValueDataset dataset = new DefaultValueDataset(new Double(65.0));
        final ThermometerPlot plot = new ThermometerPlot(dataset);

        return new JFreeChart("Thermometer Chart", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
    return null;
}

From source file:playground.dgrether.analysis.charts.DgModalSplitQuantilesChart.java

public JFreeChart createChart() {
    CategoryAxis categoryAxis = this.axisBuilder.createCategoryAxis(xLabel);
    categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
    ValueAxis valueAxis = this.axisBuilder.createValueAxis(yLabel);
    valueAxis.setRange(0.0, 102.0);/*from  ww w.  ja v  a 2  s  . c o m*/

    DgColorScheme colorScheme = new DgColorScheme();

    CategoryPlot plot = new CategoryPlot();
    plot.setDomainAxis(categoryAxis);
    plot.setRangeAxis(valueAxis);
    plot.setDataset(0, this.dataset);
    BarRenderer carRenderer = new BarRenderer();
    carRenderer.setSeriesPaint(0, colorScheme.COLOR1A);
    carRenderer.setSeriesPaint(1, colorScheme.COLOR3A);

    carRenderer.setItemMargin(0.10);
    plot.setRenderer(0, carRenderer);

    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    chart.removeLegend();
    return chart;
}

From source file:org.matsim.counts.algorithms.graphs.BiasErrorGraph.java

@Override
public JFreeChart createChart(final int nbr) {
    DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
    DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();

    this.errorStats = new ComparisonErrorStatsCalculator(this.ccl_);

    double[] meanRelError = errorStats.getMeanRelError();
    //      double[] meanAbsError = errorStats.getMeanAbsError();
    double[] meanAbsBias = errorStats.getMeanAbsBias();

    for (int h = 0; h < 24; h++) {
        dataset0.addValue(meanRelError[h], "Mean rel error", Integer.toString(h + 1));
        //         dataset1.addValue(meanAbsError[h], "Mean abs error", Integer.toString(h + 1));
        dataset1.addValue(meanAbsBias[h], "Mean abs bias", Integer.toString(h + 1));
    }//from w  ww  . j a  v  a 2 s. c o  m

    this.chart_ = ChartFactory.createLineChart("", "Hour", "Mean rel error [%]", dataset0,
            PlotOrientation.VERTICAL, true, // legend?
            true, // tooltips?
            false // URLs?
    );
    CategoryPlot plot = this.chart_.getCategoryPlot();
    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    plot.setDataset(1, dataset1);
    plot.mapDatasetToRangeAxis(1, 1);

    final LineAndShapeRenderer renderer = new LineAndShapeRenderer();
    renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    plot.setRenderer(0, renderer);

    final CategoryAxis axis1 = new CategoryAxis("Hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    plot.setDomainAxis(axis1);

    //      final ValueAxis axis2 = new NumberAxis("Mean abs {bias, error} [veh/h]");
    final ValueAxis axis2 = new NumberAxis("Mean abs bias [veh/h]");
    plot.setRangeAxis(1, axis2);

    final ValueAxis axis3 = plot.getRangeAxis(0);
    axis3.setRange(0.0, 100.0);

    final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();
    renderer2.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    renderer2.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator());
    //      renderer2.setSeriesPaint(0, Color.black);
    plot.setRenderer(1, renderer2);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);

    return this.chart_;
}