コード例 #1
0
    protected void configurePlot(CategoryPlot plot) {
      plot.setBackgroundPaint(Color.WHITE);
      plot.setOutlinePaint(null);
      plot.setRangeGridlinesVisible(true);
      plot.setRangeGridlinePaint(Color.black);

      configureRenderer((LineAndShapeRenderer) plot.getRenderer());
      configureDomainAxis(plot);
    }
コード例 #2
0
  @Override
  protected JFreeChart createGraph() {
    final JFreeChart chart =
        ChartFactory.createLineChart(
            null, // chart title
            null, // unused
            yLabel, // range axis label
            categoryDataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
            );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    final LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.RIGHT);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerBound(0);
    rangeAxis.setAutoRange(true);

    final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(2.0f));
    ColorPalette.apply(renderer);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));

    return chart;
  }
  protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
        new BasicStroke(
            0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] {1}, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
        new BasicStroke(
            0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] {1}, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
    //		JRBarPlot barPlot = (BarPlot)categoryPlot;
    //		categoryPlot.getDomainAxis().setTickLabelsVisible(
    //				categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
    //				true
    //				);
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    List seriesPaints =
        (List) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
    barRenderer.setSeriesPaint(0, (Paint) seriesPaints.get(3));
    barRenderer.setSeriesPaint(1, (Paint) seriesPaints.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
      for (int i = 0; i < categoryDataset.getRowCount(); i++) {
        barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
        barRenderer.setSeriesItemLabelsVisible(i, true);
        //			barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
        //			CategoryMarker categoryMarker = new
        // CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
        //			categoryMarker.setAlpha(0.5f);
        //			categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
      }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
  }
コード例 #4
0
ファイル: LoadStatistics.java プロジェクト: atcarmo/jenkins
  /** Creates a trend chart. */
  public JFreeChart createChart(CategoryDataset ds) {
    final JFreeChart chart =
        ChartFactory.createLineChart(
            null, // chart title
            null, // unused
            null, // range axis label
            ds, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
            );

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(3));
    configureRenderer(renderer);

    final CategoryAxis domainAxis = new NoOverlapCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    return chart;
  }
コード例 #5
0
  /* (non-Javadoc)
   * @see com.alpine.datamining.api.impl.visual.ImageVisualizationType#generateOutPut(com.alpine.datamining.api.AnalyticOutPut)
   */
  @Override
  public VisualizationOutPut generateOutPut(AnalyticOutPut analyzerOutPut) {
    AnalyzerOutPutBoxWhisker obj = null;
    if (analyzerOutPut instanceof AnalyzerOutPutBoxWhisker) {
      obj = (AnalyzerOutPutBoxWhisker) analyzerOutPut;
    }
    List<BoxAndWhiskerItem> list = obj.getItemList();
    BoxAndWhiskerDataset dataset = new BoxAndWhiskerDataset();
    String variableName = null;
    String seriesName = null;
    String typeName = null;

    double[] maxArray = new double[list.size()];
    double[] minArray = new double[list.size()];
    // find max and min
    for (int i = 0; i < list.size(); i++) {
      maxArray[i] = list.get(i).getMax().doubleValue();
      minArray[i] = list.get(i).getMin().doubleValue();
    }

    Arrays.sort(maxArray);
    Arrays.sort(minArray);

    double max = maxArray[maxArray.length - 1];
    double min = minArray[0];

    long n = AlpineMath.adjustUnits(min, max);

    for (BoxAndWhiskerItem item : list) {
      dataset.add(
          item.getMean().doubleValue() / n,
          item.getMedian().doubleValue() / n,
          item.getQ1().doubleValue() / n,
          item.getQ3().doubleValue() / n,
          item.getMin().doubleValue() / n,
          item.getMax().doubleValue() / n,
          0,
          0,
          null,
          item.getSeries(),
          item.getType());
    }
    if (list != null && list.size() > 0) {
      variableName = list.get(0).getVariableName();
      if (variableName == null) variableName = "";
      seriesName = list.get(0).getSeriesName();
      if (seriesName == null) seriesName = "";
      typeName = list.get(0).getTypeName();
      if (typeName == null) typeName = "";
    }

    String yLabel =
        n == 1
            ? variableName
            : variableName
                + " "
                + VisualLanguagePack.getMessage(VisualLanguagePack.UNITS, locale)
                + " ("
                + com.alpine.datamining.api.utility.AlpineMath.powExpression(n)
                + ")";

    final CategoryAxis xAxis = new CategoryAxis(typeName);
    xAxis.setLabelFont(VisualResource.getChartFont());
    final NumberAxis yAxis = new NumberAxis(yLabel);
    yAxis.setLabelFont(VisualResource.getChartFont());
    yAxis.setAutoRangeIncludesZero(false);

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    if (list != null && list.size() < 5) {
      renderer.setMaximumBarWidth(0.2);
      renderer.setItemMargin(0.7);
    }

    renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    DrawingSupplier supplier =
        new DefaultDrawingSupplier(
            createPaintArray(),
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    plot.setDrawingSupplier(supplier);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    final JFreeChart chart = new JFreeChart(" ", VisualResource.getChartFont(), plot, true);
    chart.removeLegend();
    if (!seriesName.trim().equals("")) {
      final TextTitle subtitle = new TextTitle(seriesName, VisualResource.getChartFont());
      chart.addSubtitle(subtitle);
      chart.addLegend(new LegendTitle(plot));
      chart.getLegend().setItemFont(VisualResource.getChartFont());
    }
    JFreeChartImageVisualizationOutPut output = new JFreeChartImageVisualizationOutPut(chart);
    output.setName(analyzerOutPut.getAnalyticNode().getName());
    return output;
  }
コード例 #6
0
  @Override
  public JFreeChart createChart(int nbr) {
    DefaultCategoryDataset dataset0 = new DefaultCategoryDataset();
    // DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();   bias

    for (Tuple<String, double[]> tuple : this.mreDblFileList) {
      for (int h = 0; h < 24; h++) {
        dataset0.addValue(tuple.getSecond()[h], tuple.getFirst(), Integer.toString(h + 1));
      }
    }

    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);

    final LineAndShapeRenderer renderer = new LineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.BLUE);
    renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator());
    plot.setRenderer(0, renderer);

    Color transparent = new Color(0, 0, 255, 0);
    this.chart_.setBackgroundPaint(
        transparent); // pink : Color.getHSBColor((float) 0.0, (float) 0.0, (float) 0.93)
    plot.setBackgroundPaint(Color.getHSBColor((float) 0.0, (float) 0.0, (float) 0.93));
    plot.setRangeGridlinePaint(Color.gray);
    plot.setRangeGridlinesVisible(true);

    final CategoryAxis axisX = new CategoryAxis("Hour");
    axisX.setTickLabelFont(new Font("SansSerif", Font.BOLD, 15));
    plot.setDomainAxis(axisX);

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

    final ValueAxis axisY = plot.getRangeAxis(0);
    axisY.setRange(0.0, 100.0);
    axisY.setTickLabelFont(new Font("SansSerif", Font.BOLD, 21));

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

    this.chart_.getLegend().setItemFont(new Font("SansSerif", Font.BOLD, 17));
    this.chart_.getLegend().setVisible(false);

    return this.chart_;
  }
コード例 #7
0
  /**
   * Returns a sequence plot as a ChartPanel.
   *
   * @param aProteinSequencePanelParent the protein sequence panel parent
   * @param sparklineDataset the dataset
   * @param proteinAnnotations the protein annotations
   * @param addReferenceLine if true, a reference line is added
   * @param allowZooming if true, the user can zoom in the created plot/chart
   * @return a sequence plot
   */
  public ChartPanel getSequencePlot(
      ProteinSequencePanelParent aProteinSequencePanelParent,
      JSparklinesDataset sparklineDataset,
      HashMap<Integer, ArrayList<ResidueAnnotation>> proteinAnnotations,
      boolean addReferenceLine,
      boolean allowZooming) {

    this.proteinSequencePanelParent = aProteinSequencePanelParent;
    DefaultCategoryDataset barChartDataset = new DefaultCategoryDataset();
    StackedBarRenderer renderer = new StackedBarRenderer();
    renderer.setShadowVisible(false);
    CategoryToolTipGenerator myTooltips = new ProteinAnnotations(proteinAnnotations);

    // add the data
    for (int i = 0; i < sparklineDataset.getData().size(); i++) {

      JSparklinesDataSeries sparklineDataSeries = sparklineDataset.getData().get(i);

      for (int j = 0; j < sparklineDataSeries.getData().size(); j++) {
        barChartDataset.addValue(sparklineDataSeries.getData().get(j), "" + i, "" + j);
        renderer.setSeriesPaint(i, sparklineDataSeries.getSeriesColor());
        renderer.setSeriesToolTipGenerator(i, myTooltips);
      }
    }

    // create the chart
    JFreeChart chart =
        ChartFactory.createStackedBarChart(
            null, null, null, barChartDataset, PlotOrientation.HORIZONTAL, false, false, false);

    // fine tune the chart properites
    CategoryPlot plot = chart.getCategoryPlot();

    // remove space before/after the domain axis
    plot.getDomainAxis().setUpperMargin(0);
    plot.getDomainAxis().setLowerMargin(0);

    // remove space before/after the range axis
    plot.getRangeAxis().setUpperMargin(0);
    plot.getRangeAxis().setLowerMargin(0);

    renderer.setRenderAsPercentages(true);
    renderer.setBaseToolTipGenerator(new IntervalCategoryToolTipGenerator());

    // add the dataset to the plot
    plot.setDataset(barChartDataset);

    // hide unwanted chart details
    plot.getRangeAxis().setVisible(false);
    plot.getDomainAxis().setVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);

    // add a reference line in the middle of the dataset
    if (addReferenceLine) {
      DefaultCategoryDataset referenceLineDataset = new DefaultCategoryDataset();
      referenceLineDataset.addValue(1.0, "A", "B");
      plot.setDataset(1, referenceLineDataset);
      LayeredBarRenderer referenceLineRenderer = new LayeredBarRenderer();
      referenceLineRenderer.setSeriesBarWidth(0, referenceLineWidth);
      referenceLineRenderer.setSeriesFillPaint(0, referenceLineColor);
      referenceLineRenderer.setSeriesPaint(0, referenceLineColor);
      plot.setRenderer(1, referenceLineRenderer);
    }

    // set up the chart renderer
    plot.setRenderer(0, renderer);

    // hide the outline
    chart.getPlot().setOutlineVisible(false);

    // make sure the background is the same as the panel
    chart.getPlot().setBackgroundPaint(backgroundColor);
    chart.setBackgroundPaint(backgroundColor);

    final HashMap<Integer, ArrayList<ResidueAnnotation>> blockTooltips = proteinAnnotations;

    // create the chart panel
    ChartPanel chartPanel = new ChartPanel(chart);

    chartPanel.addChartMouseListener(
        new ChartMouseListener() {

          @Override
          public void chartMouseClicked(ChartMouseEvent cme) {
            if (cme.getEntity() != null && cme.getTrigger().getButton() == MouseEvent.BUTTON1) {

              ((CategoryItemEntity) cme.getEntity()).getDataset();
              Integer blockNumber =
                  new Integer((String) ((CategoryItemEntity) cme.getEntity()).getRowKey());

              ArrayList<ResidueAnnotation> annotation = blockTooltips.get(blockNumber);
              if (annotation != null) {
                proteinSequencePanelParent.annotationClicked(annotation, cme);
              }
            }
          }

          @Override
          public void chartMouseMoved(ChartMouseEvent cme) {

            cme.getTrigger()
                .getComponent()
                .setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

            if (cme.getEntity() != null && cme.getEntity() instanceof CategoryItemEntity) {
              ((CategoryItemEntity) cme.getEntity()).getDataset();
              Integer blockNumber =
                  new Integer((String) ((CategoryItemEntity) cme.getEntity()).getRowKey());

              ArrayList<ResidueAnnotation> annotation = blockTooltips.get(blockNumber);
              if (annotation != null && !annotation.isEmpty()) {
                if (blockTooltips.get(blockNumber).get(0).isClickable()) {
                  cme.getTrigger()
                      .getComponent()
                      .setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
                }
              }
            }
          }
        });

    if (!allowZooming) {
      chartPanel.setPopupMenu(null);
      chartPanel.setRangeZoomable(false);
    }

    chartPanel.setBackground(Color.WHITE);

    return chartPanel;
  }
コード例 #8
0
  public Drawable createChart(ADCDataset dataset, Dimension dimension) {
    JFreeChart chart =
        ChartFactory.createBarChart(
            "", // chart title
            "", // domain axis label
            "", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            false, // legend
            false, // tooltips
            false // urls
            );
    TextTitle textTitle = new TextTitle(dataset.get(Attribute.TITLE), TITLE_FONT);
    textTitle.setPadding(new RectangleInsets(10, 0, 0, 0));
    chart.setTitle(textTitle);

    chart.addLegend(createLegend(dataset.getRowKey(0).toString(), dataset.getRowKey(1).toString()));
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setOutlineVisible(false);
    plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setRangeGridlineStroke(new BasicStroke(2));

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoTickUnitSelection(true);
    rangeAxis.setTickUnit(new NumberTickUnit(0.2, percentFormatter()));
    rangeAxis.setAxisLineVisible(true);
    rangeAxis.setLabel(dataset.get(Attribute.Y_AXIS_LABEL));
    rangeAxis.setAxisLineStroke(new BasicStroke(2));
    rangeAxis.setAxisLinePaint(Color.black);
    rangeAxis.setTickMarksVisible(false);
    rangeAxis.setLabelPaint(AXIS_LABEL_COLOR);
    rangeAxis.setLabelFont(AXIS_LABEL_FONT);
    rangeAxis.setLabelInsets(new RectangleInsets(0, 0, 0, 0));
    rangeAxis.setUpperMargin(0);
    rangeAxis.setAutoRange(false);
    rangeAxis.setRange(0, 1);

    CategoryAxis cAxis = plot.getDomainAxis();
    cAxis.setTickMarksVisible(false);
    cAxis.setAxisLinePaint(Color.black);
    cAxis.setAxisLineStroke(new BasicStroke(2));
    cAxis.setLabel(dataset.get(Attribute.X_AXIS_LABEL));
    cAxis.setTickLabelsVisible(true);
    cAxis.setUpperMargin(0.05);
    cAxis.setLowerMargin(0.05);
    cAxis.setTickLabelFont(CAXIS_LABEL_FONT);
    cAxis.setTickLabelPaint(Color.black);
    CustomBarRenderer renderer = new CustomBarRenderer();
    plot.setRenderer(renderer);
    renderer.setDrawBarOutline(false);
    renderer.setBaseItemLabelsVisible(false);
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardBarPainter());
    renderer.setMaximumBarWidth(0.08);
    renderer.setItemMargin(0.01);
    return new JFreeChartDrawable(chart, dimension);
  }
コード例 #9
0
 public static JFreeChart createChart() {
   DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
   defaultcategorydataset.addValue(1.0D, "S1", "Category 1");
   defaultcategorydataset.addValue(4D, "S1", "Category 2");
   defaultcategorydataset.addValue(3D, "S1", "Category 3");
   defaultcategorydataset.addValue(5D, "S1", "Category 4");
   defaultcategorydataset.addValue(5D, "S1", "Category 5");
   defaultcategorydataset.addValue(7D, "S1", "Category 6");
   defaultcategorydataset.addValue(7D, "S1", "Category 7");
   defaultcategorydataset.addValue(8D, "S1", "Category 8");
   defaultcategorydataset.addValue(5D, "S2", "Category 1");
   defaultcategorydataset.addValue(7D, "S2", "Category 2");
   defaultcategorydataset.addValue(6D, "S2", "Category 3");
   defaultcategorydataset.addValue(8D, "S2", "Category 4");
   defaultcategorydataset.addValue(4D, "S2", "Category 5");
   defaultcategorydataset.addValue(4D, "S2", "Category 6");
   defaultcategorydataset.addValue(2D, "S2", "Category 7");
   defaultcategorydataset.addValue(1.0D, "S2", "Category 8");
   StandardCategoryItemLabelGenerator standardcategoryitemlabelgenerator =
       new StandardCategoryItemLabelGenerator();
   BarRenderer barrenderer = new BarRenderer();
   barrenderer.setBaseItemLabelGenerator(standardcategoryitemlabelgenerator);
   barrenderer.setBaseItemLabelsVisible(true);
   CategoryPlot categoryplot = new CategoryPlot();
   categoryplot.setDataset(defaultcategorydataset);
   categoryplot.setRenderer(barrenderer);
   categoryplot.setDomainAxis(new CategoryAxis("Category"));
   categoryplot.setRangeAxis(new NumberAxis("Value"));
   categoryplot.setOrientation(PlotOrientation.VERTICAL);
   categoryplot.setRangeGridlinesVisible(true);
   categoryplot.setDomainGridlinesVisible(true);
   DefaultCategoryDataset defaultcategorydataset1 = new DefaultCategoryDataset();
   defaultcategorydataset1.addValue(9D, "T1", "Category 1");
   defaultcategorydataset1.addValue(7D, "T1", "Category 2");
   defaultcategorydataset1.addValue(2D, "T1", "Category 3");
   defaultcategorydataset1.addValue(6D, "T1", "Category 4");
   defaultcategorydataset1.addValue(6D, "T1", "Category 5");
   defaultcategorydataset1.addValue(9D, "T1", "Category 6");
   defaultcategorydataset1.addValue(5D, "T1", "Category 7");
   defaultcategorydataset1.addValue(4D, "T1", "Category 8");
   LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
   categoryplot.setDataset(1, defaultcategorydataset1);
   categoryplot.setRenderer(1, lineandshaperenderer);
   NumberAxis numberaxis = new NumberAxis("Axis 2");
   categoryplot.setRangeAxis(1, numberaxis);
   DefaultCategoryDataset defaultcategorydataset2 = new DefaultCategoryDataset();
   defaultcategorydataset2.addValue(94D, "R1", "Category 1");
   defaultcategorydataset2.addValue(75D, "R1", "Category 2");
   defaultcategorydataset2.addValue(22D, "R1", "Category 3");
   defaultcategorydataset2.addValue(74D, "R1", "Category 4");
   defaultcategorydataset2.addValue(83D, "R1", "Category 5");
   defaultcategorydataset2.addValue(9D, "R1", "Category 6");
   defaultcategorydataset2.addValue(23D, "R1", "Category 7");
   defaultcategorydataset2.addValue(98D, "R1", "Category 8");
   categoryplot.setDataset(2, defaultcategorydataset2);
   LineAndShapeRenderer lineandshaperenderer1 = new LineAndShapeRenderer();
   categoryplot.setRenderer(2, lineandshaperenderer1);
   categoryplot.mapDatasetToRangeAxis(2, 1);
   categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
   categoryplot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
   JFreeChart jfreechart = new JFreeChart(categoryplot);
   jfreechart.setTitle("Overlaid Bar Chart");
   return jfreechart;
 }