Beispiel #1
0
  /**
   * Create the scatter chart using the ChartFactory built into JFreeChart
   *
   * @return m_chart A chart of type JFreeChart
   */
  @Override
  public JFreeChart createChart() {
    JFreeChart CHART =
        ChartFactory.createPolarChart(
            super.GetTitle(), // chart title
            convertDataSet(), // orientation
            false, // Legend
                   // // include legend
            true, // tooltips?
            false // URLs?
            );

    Plot p = CHART.getPlot();
    org.jfree.chart.plot.PolarPlot pl = (org.jfree.chart.plot.PolarPlot) p;
    PolarItemRenderer renderer = new PolarPlot.CustomRenderer();
    pl.setRenderer(renderer);
    return CHART;
  }
Beispiel #2
0
  /**
   * Creates a chart.
   *
   * @param dataset the dataset.
   * @return A chart.
   */
  private JFreeChart createChart(XYDataset dataset) {
    String chartType = getChartType();

    JFreeChart chart = null;
    if (chartType == CHART_TYPE_XY && param.isFilled)
      chart =
          ChartFactory.createXYAreaChart(
              param.title, // chart title
              param.axisXTitle,
              param.axisYTitle,
              dataset, // data
              param.plotOrientation,
              param.showLegend, // include legend
              false, // no tooltips
              false // no URLs
              );
    else if (chartType == CHART_TYPE_XY)
      chart =
          ChartFactory.createXYLineChart(
              param.title, // chart title
              param.axisXTitle,
              param.axisYTitle,
              dataset, // data
              param.plotOrientation,
              param.showLegend, // include legend
              false, // no tooltips
              false // no URLs
              );
    else if (chartType == CHART_TYPE_XY_STEP && param.isFilled)
      chart =
          ChartFactory.createXYStepAreaChart(
              param.title, // chart title
              param.axisXTitle,
              param.axisYTitle,
              dataset, // data
              param.plotOrientation,
              param.showLegend, // include legend
              false, // no tooltips
              false // no URLs
              );
    else if (chartType == CHART_TYPE_XY_STEP)
      chart =
          ChartFactory.createXYStepChart(
              param.title, // chart title
              param.axisXTitle,
              param.axisYTitle,
              dataset, // data
              param.plotOrientation,
              param.showLegend, // include legend
              false, // no tooltips
              false // no URLs
              );
    else if (chartType == CHART_TYPE_POLAR)
      chart =
          ChartFactory.createPolarChart(
              param.title, // chart title
              dataset, // data
              param.showLegend, // include legend
              false, // no tooltips
              false // no URLs
              );

    // show item labels for XY charts
    if (chartType != CHART_TYPE_POLAR) {
      XYItemRenderer rend = (XYItemRenderer) chart.getXYPlot().getRenderer();
      rend.setBaseItemLabelGenerator(new XYLabelItemGenerator(xyItems));
      // rend.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
      rend.setBaseItemLabelsVisible(true);
      // rr.setPlotShapes(true);
    }

    return chart;
  }