Source Code Cross Referenced for BubbleChartExpression.java in  » Report » pentaho-report » org » pentaho » plugin » jfreereport » reportcharts » 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 » Report » pentaho report » org.pentaho.plugin.jfreereport.reportcharts 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.pentaho.plugin.jfreereport.reportcharts;
002:
003:        import org.jfree.chart.ChartFactory;
004:        import org.jfree.chart.JFreeChart;
005:        import org.jfree.chart.plot.PlotOrientation;
006:        import org.jfree.chart.plot.XYPlot;
007:        import org.jfree.data.xy.XYDataset;
008:        import org.jfree.data.xy.XYZDataset;
009:        import org.jfree.util.Log;
010:        import org.pentaho.messages.Messages;
011:        import org.pentaho.plugin.jfreechart.BubbleRenderer;
012:
013:        public class BubbleChartExpression extends XYChartExpression {
014:            private static final long serialVersionUID = 7934486966108227105L;
015:
016:            private double maxBubbleSize = 0;
017:
018:            private double maxZValue = 1;
019:
020:            private String bubbleLabelContent = "{0}: ({1}, {2}, {3})"; //$NON-NLS-1$
021:
022:            private String xFormat = ""; //$NON-NLS-1$
023:
024:            private String yFormat = ""; //$NON-NLS-1$
025:
026:            private String zFormat = ""; //$NON-NLS-1$
027:
028:            public BubbleChartExpression() {
029:            }
030:
031:            public JFreeChart getChart(XYDataset xyDataset) {
032:                JFreeChart rtn = null;
033:
034:                // Make sure we have a proper dataset
035:                ExtendedXYZDataset dataset;
036:                if (xyDataset instanceof  XYZDataset) {
037:                    dataset = (ExtendedXYZDataset) xyDataset;
038:                    maxZValue = dataset.getMaxZValue();
039:                } else {
040:                    return rtn;
041:                }
042:
043:                rtn = ChartFactory.createBubbleChart(getTitle(),
044:                        getDomainTitle(), getRangeTitle(), dataset,
045:                        isHorizontal() ? PlotOrientation.HORIZONTAL
046:                                : PlotOrientation.VERTICAL, isShowLegend(),
047:                        false, false);
048:
049:                BubbleRenderer renderer = new BubbleRenderer();
050:                renderer.setMaxSize(getMaxBubbleSize());
051:                renderer.setMaxZ(getMaxZValue());
052:                rtn.getXYPlot().setRenderer(renderer);
053:
054:                return rtn;
055:            }
056:
057:            protected void setChartProperties(JFreeChart chart) {
058:                super .setChartProperties(chart);
059:
060:                XYPlot xypl = chart.getXYPlot();
061:                BubbleRenderer renderer = (BubbleRenderer) xypl.getRenderer();
062:
063:                /* 
064:                 * We don't handle these in reports yet ...
065:                 renderer.setToolTipGenerator(new StandardXYZToolTipGenerator(getBubbleLabelContent(),
066:                 new DecimalFormat(getXFormat()), 
067:                 new DecimalFormat(getYFormat()), 
068:                 new DecimalFormat(getZFormat())));
069:                 
070:                 renderer.setURLGenerator(new StandardBubbleURLGenerator());
071:                 */
072:                renderer.setMaxSize(getMaxBubbleSize());
073:                renderer.setMaxZ(getMaxZValue());
074:            }
075:
076:            public Object getValue() {
077:
078:                // Because everytime a new data row is processed we end up here, we need to 
079:                // update the maxZValue, or the value only gets processed the first time through 
080:                // due to chart caching... Definitely haven't calculated the max value at that point.
081:
082:                final Object maybeXYZDatasetCollector = getDataRow().get(
083:                        getDataSource());
084:                if (!(maybeXYZDatasetCollector instanceof  XYZSeriesCollectorFunction)) {
085:                    Log.debug(Messages
086:                            .getString("XYCHARTEXPRESSION.USER_NOT_A_DATASET")); //$NON-NLS-1$
087:                    return null;
088:                }
089:
090:                final XYZSeriesCollectorFunction xyzscf = (XYZSeriesCollectorFunction) maybeXYZDatasetCollector;
091:                ExtendedXYZDataset dataset = (ExtendedXYZDataset) xyzscf
092:                        .getDatasourceValue();
093:
094:                if (dataset != null) {
095:                    maxZValue = dataset.getMaxZValue();
096:                }
097:
098:                return super .getValue();
099:            }
100:
101:            public double getMaxZValue() {
102:                return maxZValue;
103:            }
104:
105:            public double getMaxBubbleSize() {
106:                return maxBubbleSize;
107:            }
108:
109:            public void setMaxBubbleSize(double maxBubbleSize) {
110:                this .maxBubbleSize = maxBubbleSize;
111:            }
112:
113:            public String getBubbleLabelContent() {
114:                return bubbleLabelContent;
115:            }
116:
117:            /**
118:             * @param bubbleLabelContent
119:             *            Definition of the bubble labels' content. e.g. "{0}: ({1}, {2}, {3})"
120:             *            {0} = series name
121:             *            {1} = x value
122:             *            {2} = y value
123:             *            {3} = z value
124:             */
125:            public void setBubbleLableContent(String bubbleLabelContent) {
126:                this .bubbleLabelContent = bubbleLabelContent;
127:            }
128:
129:            public String getXFormat() {
130:                return xFormat;
131:            }
132:
133:            /**
134:             * @param format
135:             *            Definition of the bubble labels' x value number format.
136:             *            e.g. "#,##0.0#" or "#,##0.00 EUR" or "##0.00 %"
137:             */
138:            public void setXFormat(String format) {
139:                xFormat = format;
140:            }
141:
142:            public String getYFormat() {
143:                return yFormat;
144:            }
145:
146:            /**
147:             * @param format
148:             *            Definition of the bubble labels' y value number format.
149:             *            e.g. "#,##0.0#" or "#,##0.00 EUR" or "##0.00 %"
150:             */
151:            public void setYFormat(String format) {
152:                yFormat = format;
153:            }
154:
155:            public String getZFormat() {
156:                return zFormat;
157:            }
158:
159:            /**
160:             * @param format
161:             *            Definition of the bubble labels' z value number format.
162:             *            e.g. "#,##0.0#" or "#,##0.00 EUR" or "##0.00 %"
163:             */
164:            public void setZFormat(String format) {
165:                zFormat = format;
166:            }
167:
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.