Source Code Cross Referenced for NumberAxis3D.java in  » Chart » jfreechart » org » jfree » chart » axis » 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 » jfreechart » org.jfree.chart.axis 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ===========================================================
002:         * JFreeChart : a free chart library for the Java(tm) platform
003:         * ===========================================================
004:         *
005:         * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors.
006:         *
007:         * Project Info:  http://www.jfree.org/jfreechart/index.html
008:         *
009:         * This library is free software; you can redistribute it and/or modify it 
010:         * under the terms of the GNU Lesser General Public License as published by 
011:         * the Free Software Foundation; either version 2.1 of the License, or 
012:         * (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful, but 
015:         * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
016:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
017:         * License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
022:         * USA.  
023:         *
024:         * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
025:         * in the United States and other countries.]
026:         *
027:         * -----------------
028:         * NumberAxis3D.java
029:         * -----------------
030:         * (C) Copyright 2001-2006, by Serge V. Grachov and Contributors.
031:         *
032:         * Original Author:  Serge V. Grachov;
033:         * Contributor(s):   David Gilbert (for Object Refinery Limited);
034:         *                   Jonathan Nash;
035:         *                   Richard Atkinson;
036:         *                   Tin Luu;
037:         *
038:         * $Id: NumberAxis3D.java,v 1.5.2.3 2006/12/07 15:34:16 mungady Exp $
039:         *
040:         * Changes
041:         * -------
042:         * 31-Oct-2001 : Version 1 contributed by Serge V. Grachov (DG);
043:         * 23-Nov-2001 : Overhauled auto tick unit code for all axes (DG);
044:         * 12-Dec-2001 : Minor change due to grid lines bug fix (DG);
045:         * 08-Jan-2002 : Added flag allowing the axis to be 'inverted'.  That is, run 
046:         *               from positive to negative.  Added default values to 
047:         *               constructors (DG);
048:         * 16-Jan-2002 : Added an optional crosshair, based on the implementation by 
049:         *               Jonathan Nash (DG);
050:         * 25-Feb-2002 : Updated constructors for new autoRangeStickyZero flag (DG);
051:         * 19-Apr-2002 : drawVerticalString() is now drawRotatedString() in 
052:         *               RefineryUtilities (DG);
053:         * 25-Jun-2002 : Removed redundant import (DG);
054:         * 25-Jul-2002 : Changed order of parameters in ValueAxis constructor (DG);
055:         * 06-Aug-2002 : Modified draw method to not draw axis label if label is empty 
056:         *               String (RA);
057:         * 05-Sep-2002 : Updated constructor for changes in the Axis class, and changed
058:         *               draw method to observe tickMarkPaint (DG);
059:         * 22-Sep-2002 : Fixed errors reported by Checkstyle (DG);
060:         * 08-Nov-2002 : Moved to new package com.jrefinery.chart.axis (DG);
061:         * 20-Jan-2003 : Removed unnecessary constructors (DG);
062:         * 26-Mar-2003 : Implemented Serializable (DG);
063:         * 13-May-2003 : Merged HorizontalNumberAxis3D and VerticalNumberAxis3D (DG);
064:         * 21-Aug-2003 : Updated draw() method signature (DG);
065:         * 07-Nov-2003 : Modified refreshTicks method signature (DG);
066:         * ------------- JFREECHART 1.0.x ---------------------------------------------
067:         * 18-Jan-2006 : Fixed bug 1408904 (axis assumes CategoryPlot) (DG):
068:         *
069:         */
070:
071:        package org.jfree.chart.axis;
072:
073:        import java.awt.Graphics2D;
074:        import java.awt.geom.Rectangle2D;
075:        import java.io.Serializable;
076:        import java.util.List;
077:
078:        import org.jfree.chart.Effect3D;
079:        import org.jfree.chart.plot.CategoryPlot;
080:        import org.jfree.chart.plot.Plot;
081:        import org.jfree.chart.plot.PlotRenderingInfo;
082:        import org.jfree.chart.renderer.category.CategoryItemRenderer;
083:        import org.jfree.ui.RectangleEdge;
084:
085:        /**
086:         * A standard linear value axis with a 3D effect corresponding to the
087:         * offset specified by some renderers.
088:         */
089:        public class NumberAxis3D extends NumberAxis implements  Serializable {
090:
091:            /** For serialization. */
092:            private static final long serialVersionUID = -1790205852569123512L;
093:
094:            /**
095:             * Default constructor.
096:             */
097:            public NumberAxis3D() {
098:                this (null);
099:            }
100:
101:            /**
102:             * Constructs a new axis.
103:             *
104:             * @param label  the axis label (<code>null</code> permitted).
105:             */
106:            public NumberAxis3D(String label) {
107:                super (label);
108:                setAxisLineVisible(false);
109:            }
110:
111:            /**
112:             * Draws the axis on a Java 2D graphics device (such as the screen or a 
113:             * printer).
114:             *
115:             * @param g2  the graphics device.
116:             * @param cursor  the cursor.
117:             * @param plotArea  the area for drawing the axes and data.
118:             * @param dataArea  the area for drawing the data (a subset of the 
119:             *                  plotArea).
120:             * @param edge  the axis location.
121:             * @param plotState  collects information about the plot (<code>null</code>
122:             *                   permitted).
123:             * 
124:             * @return The updated cursor value.
125:             */
126:            public AxisState draw(Graphics2D g2, double cursor,
127:                    Rectangle2D plotArea, Rectangle2D dataArea,
128:                    RectangleEdge edge, PlotRenderingInfo plotState) {
129:
130:                // if the axis is not visible, don't draw it...
131:                if (!isVisible()) {
132:                    AxisState state = new AxisState(cursor);
133:                    // even though the axis is not visible, we need ticks for the 
134:                    // gridlines...
135:                    List ticks = refreshTicks(g2, state, dataArea, edge);
136:                    state.setTicks(ticks);
137:                    return state;
138:                }
139:
140:                // calculate the adjusted data area taking into account the 3D effect...
141:                double xOffset = 0.0;
142:                double yOffset = 0.0;
143:                Plot plot = getPlot();
144:                if (plot instanceof  CategoryPlot) {
145:                    CategoryPlot cp = (CategoryPlot) plot;
146:                    CategoryItemRenderer r = cp.getRenderer();
147:                    if (r instanceof  Effect3D) {
148:                        Effect3D e3D = (Effect3D) r;
149:                        xOffset = e3D.getXOffset();
150:                        yOffset = e3D.getYOffset();
151:                    }
152:                }
153:
154:                double adjustedX = dataArea.getMinX();
155:                double adjustedY = dataArea.getMinY();
156:                double adjustedW = dataArea.getWidth() - xOffset;
157:                double adjustedH = dataArea.getHeight() - yOffset;
158:
159:                if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) {
160:                    adjustedY += yOffset;
161:                } else if (edge == RectangleEdge.RIGHT
162:                        || edge == RectangleEdge.TOP) {
163:                    adjustedX += xOffset;
164:                }
165:                Rectangle2D adjustedDataArea = new Rectangle2D.Double(
166:                        adjustedX, adjustedY, adjustedW, adjustedH);
167:
168:                // draw the tick marks and labels...
169:                AxisState info = drawTickMarksAndLabels(g2, cursor, plotArea,
170:                        adjustedDataArea, edge);
171:
172:                // draw the axis label...
173:                info = drawLabel(getLabel(), g2, plotArea, dataArea, edge, info);
174:
175:                return info;
176:
177:            }
178:
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.