Source Code Cross Referenced for RadarChartDataSet.java in  » Chart » jCharts » org » krysalis » jcharts » chartData » 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 » Chart » jCharts » org.krysalis.jcharts.chartData 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.krysalis.jcharts.chartData;
002:
003:        import java.awt.Paint;
004:
005:        import org.krysalis.jcharts.chartData.interfaces.IRadarChartDataSet;
006:        import org.krysalis.jcharts.properties.RadarChartProperties;
007:        import org.krysalis.jcharts.test.HTMLGenerator;
008:
009:        /**
010:         * The chart dataset of a radar chart
011:         *
012:         * @author Rami Hansenne
013:         */
014:        final public class RadarChartDataSet extends DataSet implements 
015:                IRadarChartDataSet {
016:            private String chartTitle;
017:            private String[] axisLabels;
018:
019:            /******************************************************************************************
020:             * Constructor
021:             *
022:             * @param chartTitle if the title is NULL, no title will be drawn
023:             * @param data the data sets to be displayed in the chart.
024:             * @param legendLabels if this is: NULL there will be no Legend. Otherwise, there must be an
025:             *           one to one mapping of labels to data sets.
026:             * @param paints paints to use for the data sets. There must be an one to one mapping of
027:             *           labels to data sets.
028:             * @param axisLabels
029:             * @param chartTypeProperties properties Object specific to the type of chart you are rendering.
030:             * @throws ChartDataException if data is not in correct form.
031:             *******************************************************************************************/
032:            public RadarChartDataSet(String chartTitle, double[][] data,
033:                    String[] legendLabels, Paint[] paints, String[] axisLabels,
034:                    RadarChartProperties chartTypeProperties)
035:                    throws ChartDataException {
036:                super (data, legendLabels, paints, chartTypeProperties);
037:                validateData(data, legendLabels, axisLabels, paints);
038:                this .chartTitle = chartTitle;
039:                this .axisLabels = axisLabels;
040:            }
041:
042:            /*******************************************************************************************
043:             * Perform some limited validation of the structure of the passed data.  This is useful for
044:             *  development.
045:             *
046:             * @param data
047:             * @param legendLabels
048:             * @param axisLabels
049:             * @param paints
050:             * @throws ChartDataException
051:             *******************************************************************************************/
052:            private void validateData(double[][] data, String[] legendLabels,
053:                    String[] axisLabels, Paint[] paints)
054:                    throws ChartDataException {
055:                if (legendLabels != null
056:                        && (data.length != legendLabels.length)) {
057:                    throw new ChartDataException(
058:                            "There is not an one to one mapping of 'legend labels' to 'data items'.");
059:                }
060:
061:                if (data.length != paints.length) {
062:                    throw new ChartDataException(
063:                            "There is not an one to one mapping of 'Paint' Implementations to 'data items'.");
064:                }
065:
066:                for (int i = 1; i < data.length; i++)
067:                    if (data[i].length != data[0].length)
068:                        throw new ChartDataException(
069:                                "All data items should contain an equal number of values.");
070:
071:                if (data.length > 0 && axisLabels.length != data[0].length)
072:                    throw new ChartDataException(
073:                            "There is not a one to one mapping of axis labels to values per 'data item'.");
074:
075:            }
076:
077:            /******************************************************************************************
078:             * Returns the chart title.
079:             *
080:             * @return String the chart title. If this returns NULL, no title will be displayed.
081:             ******************************************************************************************/
082:            public String getChartTitle() {
083:                return this .chartTitle;
084:            }
085:
086:            /******************************************************************************************
087:             * Returns the value in the data set at the specified position.
088:             *
089:             * @param dataset
090:             * @param index
091:             * @return double
092:             * @throws ArrayIndexOutOfBoundsException
093:             *******************************************************************************************/
094:            public final double getValue(int dataset, int index)
095:                    throws ArrayIndexOutOfBoundsException {
096:                return super .data[dataset][index];
097:            }
098:
099:            /******************************************************************************************
100:             * Returns the number of data sets
101:             *
102:             * @return int
103:             ******************************************************************************************/
104:            public final int getNumberOfDataSets() {
105:                return this .data.length;
106:            }
107:
108:            /******************************************************************************************
109:             * Returns the number of values per data set
110:             *
111:             * @return int
112:             ******************************************************************************************/
113:            public final int getDataSetSize() {
114:                if (data.length == 0)
115:                    return 0;
116:                else
117:                    return data[0].length;
118:            }
119:
120:            /******************************************************************************************
121:             * Returns the x-axis label corresponding to the passed index
122:             *
123:             * @param index
124:             * @return String
125:             *******************************************************************************************/
126:            public String getAxisLabel(int index) {
127:                return this .axisLabels[index];
128:            }
129:
130:            /******************************************************************************************
131:             * Returns the number of labels on the x-axis
132:             *
133:             * @return int
134:             ******************************************************************************************/
135:            public int getNumberOfAxisLabels() {
136:                if (this .axisLabels != null) {
137:                    return this .axisLabels.length;
138:                } else {
139:                    return 0;
140:                }
141:            }
142:
143:            /*********************************************************************************************
144:             * Enables the testing routines to display the contents of this Object.
145:             *
146:             * @param htmlGenerator
147:             **********************************************************************************************/
148:            public void toHTML(HTMLGenerator htmlGenerator) {
149:                super.toHTML(htmlGenerator);
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.