Source Code Cross Referenced for BasicXYDatasetBasedCharts.java in  » ESB » open-esb » org » openesb » tools » extchart » jfchart » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ESB » open esb » org.openesb.tools.extchart.jfchart 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)BasicXYDatasetBasedCharts.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package org.openesb.tools.extchart.jfchart;
030:
031:        import org.openesb.tools.extchart.exception.ChartException;
032:        import org.openesb.tools.extchart.jfchart.data.DataAccess;
033:        import org.openesb.tools.extchart.property.ChartConstants;
034:        import org.openesb.tools.extchart.property.ChartDefaults;
035:        import org.openesb.tools.extchart.property.JFChartConstants;
036:        import org.openesb.tools.extchart.property.bar.XYProperties;
037:        import org.openesb.tools.extpropertysheet.IExtProperty;
038:        import org.openesb.tools.extpropertysheet.IExtPropertyGroup;
039:        import org.openesb.tools.extpropertysheet.IExtPropertyGroupsBean;
040:        import org.openesb.tools.extpropertysheet.impl.ExtProperty;
041:        import org.openesb.tools.extpropertysheet.impl.ExtPropertyGroupsBean;
042:
043:        import java.util.HashMap;
044:        import java.util.Map;
045:        import java.util.Properties;
046:        import java.util.logging.Logger;
047:        import org.jfree.chart.ChartFactory;
048:        import org.jfree.chart.JFreeChart;
049:        import org.jfree.chart.plot.PlotOrientation;
050:        import org.jfree.data.xy.XYDataset;
051:
052:        /**
053:         *
054:         * @author rdwivedi
055:         */
056:        public class BasicXYDatasetBasedCharts extends Chart {
057:
058:            private IExtPropertyGroupsBean propGrps = null;
059:            private DataAccess mDA = null;
060:            private static Logger mLogger = Logger
061:                    .getLogger(BasicXYDatasetBasedCharts.class.getName());
062:
063:            private static String SCATTER_CHART = "scatterChart";
064:            private static String POLAR_CHART = "polarChart";
065:            private static String TIME_SERIES_CHART = "timeSeriesChart";
066:            private static String AREA_CHART = "areaChart";
067:            private static String LINE_CHART = "lineChart";
068:            private static String STEPPED_AREA_CHART = "steppedAreaChart";
069:            private static String STEPPED_CHART = "steppedChart";
070:
071:            public static Map getAllAllowedCharts() {
072:                HashMap map = new HashMap();
073:                map.put(SCATTER_CHART, "Scatter Chart");
074:                map.put(POLAR_CHART, "Polar Chart");
075:                map.put(TIME_SERIES_CHART, "Time Series Chart");
076:                map.put(AREA_CHART, "Area Chart");
077:                map.put(LINE_CHART, "Line Chart");
078:                map.put(STEPPED_CHART, "Stepped Chart");
079:                map.put(STEPPED_AREA_CHART, "Stepped Area Chart");
080:
081:                return map;
082:            }
083:
084:            /** Creates a new instance of BasicCategoryDatasetBasedCharts */
085:            public BasicXYDatasetBasedCharts(IExtPropertyGroupsBean pg,
086:                    DataAccess da) {
087:                propGrps = pg;
088:                mDA = da;
089:            }
090:
091:            public ChartDefaults getChartDefaults() {
092:                IExtPropertyGroup p = propGrps
093:                        .getGroupByName(JFChartConstants.CHART_COMMON_PROPERTIES);
094:                return (ChartDefaults) p;
095:            }
096:
097:            private IExtPropertyGroupsBean getChartPropertiesGroup() {
098:                return propGrps;
099:            }
100:
101:            private IExtPropertyGroup getSpecificProperties() {
102:                return getChartPropertiesGroup().getGroupByName(
103:                        JFChartConstants.CHART_SPECIFIC_PROPERTIES);
104:            }
105:
106:            public JFreeChart createChart() throws ChartException {
107:                XYDataset dataset = null;
108:                JFreeChart chart = null;
109:                dataset = (XYDataset) mDA.getDataSet();
110:                chart = generateChart(dataset);
111:
112:                return chart;
113:            }
114:
115:            private JFreeChart generateChart(XYDataset ds) {
116:                JFreeChart chart = null;
117:                IExtPropertyGroup p = getChartDefaults();
118:                String type = (String) p.getProperty(
119:                        JFChartConstants.CHART_TYPE).getValue();
120:                if (type.equals(SCATTER_CHART)) {
121:                    chart = createScatterChart(ds);
122:                } else if (type.equals(POLAR_CHART)) {
123:                    chart = createPolarChart(ds);
124:                } else if (type.equals(TIME_SERIES_CHART)) {
125:                    chart = createTimeSeriesChart(ds);
126:                } else if (type.equals(AREA_CHART)) {
127:                    chart = createAreaChart(ds);
128:                } else if (type.equals(LINE_CHART)) {
129:                    chart = createLineChart(ds);
130:                } else if (type.equals(STEPPED_CHART)) {
131:                    chart = createSteppedChart(ds);
132:                } else if (type.equals(STEPPED_AREA_CHART)) {
133:                    chart = createSteppedAreaChart(ds);
134:                }
135:                mLogger.info("Chart type is " + type);
136:                chart.setBackgroundPaint(this .getChartDefaults()
137:                        .getBackgroundColor());
138:                super .setTitle(chart);
139:                super .setLegend(chart);
140:                super .setBorder(chart);
141:
142:                return chart;
143:            }
144:
145:            private JFreeChart createSteppedAreaChart(XYDataset ds) {
146:
147:                XYProperties props = (XYProperties) this 
148:                        .getSpecificProperties();
149:                ChartDefaults def = this .getChartDefaults();
150:                boolean includeLegend = def.isIncludeLegend();
151:                boolean is3D = def.is3D();
152:                String title = def.getTitle();
153:                boolean bUseTooltips = true;
154:                boolean bDrilldownEnabled = false;
155:                String xLabel = props.getDomainLabel(); // domain axis label
156:                String yLabel = props.getRangeLabel();
157:                JFreeChart chart = null;
158:                PlotOrientation plotOrientation = null;
159:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
160:                    plotOrientation = PlotOrientation.HORIZONTAL;
161:                } else {
162:                    plotOrientation = PlotOrientation.VERTICAL;
163:                }
164:
165:                chart = ChartFactory.createXYStepAreaChart(title, xLabel,
166:                        yLabel, ds, plotOrientation, includeLegend,
167:                        bUseTooltips, bDrilldownEnabled);
168:                return chart;
169:            }
170:
171:            private JFreeChart createSteppedChart(XYDataset ds) {
172:
173:                XYProperties props = (XYProperties) this 
174:                        .getSpecificProperties();
175:                ChartDefaults def = this .getChartDefaults();
176:                boolean includeLegend = def.isIncludeLegend();
177:                boolean is3D = def.is3D();
178:                String title = def.getTitle();
179:                boolean bUseTooltips = true;
180:                boolean bDrilldownEnabled = false;
181:                String xLabel = props.getDomainLabel(); // domain axis label
182:                String yLabel = props.getRangeLabel();
183:                JFreeChart chart = null;
184:                PlotOrientation plotOrientation = null;
185:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
186:                    plotOrientation = PlotOrientation.HORIZONTAL;
187:                } else {
188:                    plotOrientation = PlotOrientation.VERTICAL;
189:                }
190:
191:                chart = ChartFactory.createXYStepChart(title, xLabel, yLabel,
192:                        ds, plotOrientation, includeLegend, bUseTooltips,
193:                        bDrilldownEnabled);
194:                return chart;
195:            }
196:
197:            private JFreeChart createLineChart(XYDataset ds) {
198:
199:                XYProperties props = (XYProperties) this 
200:                        .getSpecificProperties();
201:                ChartDefaults def = this .getChartDefaults();
202:                boolean includeLegend = def.isIncludeLegend();
203:                boolean is3D = def.is3D();
204:                String title = def.getTitle();
205:                boolean bUseTooltips = true;
206:                boolean bDrilldownEnabled = false;
207:                String xLabel = props.getDomainLabel(); // domain axis label
208:                String yLabel = props.getRangeLabel();
209:                JFreeChart chart = null;
210:                PlotOrientation plotOrientation = null;
211:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
212:                    plotOrientation = PlotOrientation.HORIZONTAL;
213:                } else {
214:                    plotOrientation = PlotOrientation.VERTICAL;
215:                }
216:
217:                chart = ChartFactory.createXYLineChart(title, xLabel, yLabel,
218:                        ds, plotOrientation, includeLegend, bUseTooltips,
219:                        bDrilldownEnabled);
220:                return chart;
221:            }
222:
223:            private JFreeChart createAreaChart(XYDataset ds) {
224:
225:                XYProperties props = (XYProperties) this 
226:                        .getSpecificProperties();
227:                ChartDefaults def = this .getChartDefaults();
228:                boolean includeLegend = def.isIncludeLegend();
229:                boolean is3D = def.is3D();
230:                String title = def.getTitle();
231:                boolean bUseTooltips = true;
232:                boolean bDrilldownEnabled = false;
233:                String xLabel = props.getDomainLabel(); // domain axis label
234:                String yLabel = props.getRangeLabel();
235:                JFreeChart chart = null;
236:                PlotOrientation plotOrientation = null;
237:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
238:                    plotOrientation = PlotOrientation.HORIZONTAL;
239:                } else {
240:                    plotOrientation = PlotOrientation.VERTICAL;
241:                }
242:
243:                chart = ChartFactory.createXYAreaChart(title, xLabel, yLabel,
244:                        ds, plotOrientation, includeLegend, bUseTooltips,
245:                        bDrilldownEnabled);
246:                return chart;
247:            }
248:
249:            private JFreeChart createScatterChart(XYDataset ds) {
250:
251:                XYProperties props = (XYProperties) this 
252:                        .getSpecificProperties();
253:                ChartDefaults def = this .getChartDefaults();
254:                boolean includeLegend = def.isIncludeLegend();
255:                boolean is3D = def.is3D();
256:                String title = def.getTitle();
257:                boolean bUseTooltips = true;
258:                boolean bDrilldownEnabled = false;
259:                String xLabel = props.getDomainLabel(); // domain axis label
260:                String yLabel = props.getRangeLabel();
261:                JFreeChart chart = null;
262:                PlotOrientation plotOrientation = null;
263:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
264:                    plotOrientation = PlotOrientation.HORIZONTAL;
265:                } else {
266:                    plotOrientation = PlotOrientation.VERTICAL;
267:                }
268:
269:                chart = ChartFactory.createScatterPlot(title, xLabel, yLabel,
270:                        ds, plotOrientation, includeLegend, bUseTooltips,
271:                        bDrilldownEnabled);
272:                return chart;
273:            }
274:
275:            private JFreeChart createPolarChart(XYDataset ds) {
276:
277:                XYProperties props = (XYProperties) this 
278:                        .getSpecificProperties();
279:                ChartDefaults def = this .getChartDefaults();
280:                boolean includeLegend = def.isIncludeLegend();
281:                boolean is3D = def.is3D();
282:                String title = def.getTitle();
283:                boolean bUseTooltips = true;
284:                boolean bDrilldownEnabled = false;
285:                String xLabel = props.getDomainLabel(); // domain axis label
286:                String yLabel = props.getRangeLabel();
287:                JFreeChart chart = null;
288:                PlotOrientation plotOrientation = null;
289:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
290:                    plotOrientation = PlotOrientation.HORIZONTAL;
291:                } else {
292:                    plotOrientation = PlotOrientation.VERTICAL;
293:                }
294:
295:                chart = ChartFactory.createPolarChart(title, ds, includeLegend,
296:                        bUseTooltips, bDrilldownEnabled);
297:                return chart;
298:            }
299:
300:            private JFreeChart createTimeSeriesChart(XYDataset ds) {
301:
302:                XYProperties props = (XYProperties) this 
303:                        .getSpecificProperties();
304:                ChartDefaults def = this .getChartDefaults();
305:                boolean includeLegend = def.isIncludeLegend();
306:                boolean is3D = def.is3D();
307:                String title = def.getTitle();
308:                boolean bUseTooltips = true;
309:                boolean bDrilldownEnabled = false;
310:                String xLabel = props.getDomainLabel(); // domain axis label
311:                String yLabel = props.getRangeLabel();
312:                JFreeChart chart = null;
313:                PlotOrientation plotOrientation = null;
314:                if (props.getOrientation() == XYProperties.HORIZONTAL) {
315:                    plotOrientation = PlotOrientation.HORIZONTAL;
316:                } else {
317:                    plotOrientation = PlotOrientation.VERTICAL;
318:                }
319:                chart = ChartFactory.createTimeSeriesChart(title, xLabel,
320:                        yLabel, ds, includeLegend, bUseTooltips,
321:                        bDrilldownEnabled);
322:                return chart;
323:            }
324:
325:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.