public Object createObject(Attributes attrs) {
    JRChart chart = (JRChart) digester.peek();
    JRDesignAreaPlot plot = (JRDesignAreaPlot) chart.getPlot();

    return plot;
  }
示例#2
0
  protected JRBaseChart(JRChart chart, JRBaseObjectFactory factory) {
    super(chart, factory);

    chartType = chart.getChartType();

    switch (chartType) {
      case CHART_TYPE_AREA:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
        break;
      case CHART_TYPE_BAR:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
        break;
      case CHART_TYPE_BAR3D:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getBar3DPlot((JRBar3DPlot) chart.getPlot());
        break;
      case CHART_TYPE_BUBBLE:
        dataset = factory.getXyzDataset((JRXyzDataset) chart.getDataset());
        plot = factory.getBubblePlot((JRBubblePlot) chart.getPlot());
        break;
      case CHART_TYPE_CANDLESTICK:
        dataset = factory.getHighLowDataset((JRHighLowDataset) chart.getDataset());
        plot = factory.getCandlestickPlot((JRCandlestickPlot) chart.getPlot());
        break;
      case CHART_TYPE_HIGHLOW:
        dataset = factory.getHighLowDataset((JRHighLowDataset) chart.getDataset());
        plot = factory.getHighLowPlot((JRHighLowPlot) chart.getPlot());
        break;
      case CHART_TYPE_LINE:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getLinePlot((JRLinePlot) chart.getPlot());
        break;
      case CHART_TYPE_METER:
        dataset = factory.getValueDataset((JRValueDataset) chart.getDataset());
        plot = factory.getMeterPlot((JRMeterPlot) chart.getPlot());
        break;
      case CHART_TYPE_MULTI_AXIS:
        dataset = null;
        plot = factory.getMultiAxisPlot((JRMultiAxisPlot) chart.getPlot());
        break;
      case CHART_TYPE_PIE:
        dataset = factory.getPieDataset((JRPieDataset) chart.getDataset());
        plot = factory.getPiePlot((JRPiePlot) chart.getPlot());
        break;
      case CHART_TYPE_PIE3D:
        dataset = factory.getPieDataset((JRPieDataset) chart.getDataset());
        plot = factory.getPie3DPlot((JRPie3DPlot) chart.getPlot());
        break;
      case CHART_TYPE_SCATTER:
        dataset = factory.getXyDataset((JRXyDataset) chart.getDataset());
        plot = factory.getScatterPlot((JRScatterPlot) chart.getPlot());
        break;
      case CHART_TYPE_STACKEDBAR:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
        break;
      case CHART_TYPE_STACKEDBAR3D:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getBar3DPlot((JRBar3DPlot) chart.getPlot());
        break;
      case CHART_TYPE_THERMOMETER:
        dataset = factory.getValueDataset((JRValueDataset) chart.getDataset());
        plot = factory.getThermometerPlot((JRThermometerPlot) chart.getPlot());
        break;
      case CHART_TYPE_TIMESERIES:
        dataset = factory.getTimeSeriesDataset((JRTimeSeriesDataset) chart.getDataset());
        plot = factory.getTimeSeriesPlot((JRTimeSeriesPlot) chart.getPlot());
        break;
      case CHART_TYPE_XYAREA:
        dataset = factory.getXyDataset((JRXyDataset) chart.getDataset());
        plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
        break;
      case CHART_TYPE_XYBAR:
        switch (chart.getDataset().getDatasetType()) {
          case JRChartDataset.TIMESERIES_DATASET:
            dataset = factory.getTimeSeriesDataset((JRTimeSeriesDataset) chart.getDataset());
            break;
          case JRChartDataset.TIMEPERIOD_DATASET:
            dataset = factory.getTimePeriodDataset((JRTimePeriodDataset) chart.getDataset());
            break;
          case JRChartDataset.XY_DATASET:
            dataset = factory.getXyDataset((JRXyDataset) chart.getDataset());
            break;
        }
        plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
        break;
      case CHART_TYPE_XYLINE:
        dataset = factory.getXyDataset((JRXyDataset) chart.getDataset());
        plot = factory.getLinePlot((JRLinePlot) chart.getPlot());
        break;
      case CHART_TYPE_STACKEDAREA:
        dataset = factory.getCategoryDataset((JRCategoryDataset) chart.getDataset());
        plot = factory.getAreaPlot((JRAreaPlot) chart.getPlot());
        break;
      case CHART_TYPE_GANTT:
        dataset = factory.getGanttDataset((JRGanttDataset) chart.getDataset());
        plot = factory.getBarPlot((JRBarPlot) chart.getPlot());
        break;
      default:
        throw new JRRuntimeException("Chart type not supported.");
    }

    showLegend = chart.getShowLegend();
    evaluationTimeValue = chart.getEvaluationTimeValue();
    linkType = chart.getLinkType();
    linkTarget = chart.getLinkTarget();
    titlePositionValue = chart.getTitlePositionValue();
    titleColor = chart.getOwnTitleColor();
    subtitleColor = chart.getOwnSubtitleColor();
    legendColor = chart.getOwnLegendColor();
    legendBackgroundColor = chart.getOwnLegendBackgroundColor();
    legendPositionValue = chart.getLegendPositionValue();
    renderType = chart.getRenderType();
    theme = chart.getTheme();

    titleFont = new JRBaseFont(this, chart.getTitleFont());
    subtitleFont = new JRBaseFont(this, chart.getSubtitleFont());
    legendFont = new JRBaseFont(this, chart.getLegendFont());

    evaluationGroup = factory.getGroup(chart.getEvaluationGroup());
    titleExpression = factory.getExpression(chart.getTitleExpression());
    subtitleExpression = factory.getExpression(chart.getSubtitleExpression());
    anchorNameExpression = factory.getExpression(chart.getAnchorNameExpression());
    hyperlinkReferenceExpression = factory.getExpression(chart.getHyperlinkReferenceExpression());
    hyperlinkAnchorExpression = factory.getExpression(chart.getHyperlinkAnchorExpression());
    hyperlinkPageExpression = factory.getExpression(chart.getHyperlinkPageExpression());
    hyperlinkTooltipExpression = factory.getExpression(chart.getHyperlinkTooltipExpression());
    bookmarkLevel = chart.getBookmarkLevel();
    hyperlinkParameters = JRBaseHyperlink.copyHyperlinkParameters(chart, factory);

    customizerClass = chart.getCustomizerClass();

    lineBox = chart.getLineBox().clone(this);
  }