01: /*
02: * Copyright 2006 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
07: * BI Platform. The Initial Developer is Pentaho Corporation.
08: *
09: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11: * the license for the specific language governing your rights and limitations.
12: */
13: package org.pentaho.plugin.jfreereport.reportcharts;
14:
15: import org.jfree.chart.ChartFactory;
16: import org.jfree.chart.JFreeChart;
17: import org.jfree.chart.plot.RingPlot;
18: import org.jfree.data.general.Dataset;
19: import org.jfree.data.general.PieDataset;
20:
21: public class RingChartExpression extends PieChartExpression {
22:
23: private static final long serialVersionUID = 8157232155813173422L;
24:
25: private double sectionDepth = 0.5;
26:
27: public RingChartExpression() {
28: super ();
29: }
30:
31: @Override
32: public JFreeChart getChart(Dataset pieDataset) {
33: pieDS = (PieDataset) pieDataset;
34: JFreeChart rtn = null;
35: rtn = ChartFactory.createRingChart(getTitle(), pieDS,
36: isShowLegend(), false, false);
37:
38: return rtn;
39: }
40:
41: @Override
42: protected void setChartProperties(JFreeChart chart) {
43: super .setChartProperties(chart);
44:
45: RingPlot ringPlot = (RingPlot) chart.getPlot();
46: ringPlot.setSectionDepth(sectionDepth);
47: }
48:
49: public double getSectionDepth() {
50: return sectionDepth;
51: }
52:
53: public void setSectionDepth(double sectionDepth) {
54: this.sectionDepth = sectionDepth;
55: }
56:
57: }
|