1 67 68 package org.jfree.chart.axis; 69 70 import java.awt.Graphics2D ; 71 import java.awt.geom.Rectangle2D ; 72 import java.io.Serializable ; 73 import java.util.List ; 74 75 import org.jfree.chart.Effect3D; 76 import org.jfree.chart.plot.CategoryPlot; 77 import org.jfree.chart.plot.PlotRenderingInfo; 78 import org.jfree.ui.RectangleEdge; 79 80 85 public class NumberAxis3D extends NumberAxis implements Serializable { 86 87 88 private static final long serialVersionUID = -1790205852569123512L; 89 90 93 public NumberAxis3D() { 94 this(null); 95 } 96 97 102 public NumberAxis3D(String label) { 103 super(label); 104 setAxisLineVisible(false); 105 } 106 107 122 public AxisState draw(Graphics2D g2, 123 double cursor, 124 Rectangle2D plotArea, 125 Rectangle2D dataArea, 126 RectangleEdge edge, 127 PlotRenderingInfo plotState) { 128 129 if (!isVisible()) { 131 AxisState state = new AxisState(cursor); 132 List ticks = refreshTicks(g2, state, dataArea, edge); 135 state.setTicks(ticks); 136 return state; 137 } 138 139 CategoryPlot plot = (CategoryPlot) getPlot(); 141 142 Effect3D e3D = (Effect3D) plot.getRenderer(); 143 double adjustedX = dataArea.getMinX(); 144 double adjustedY = dataArea.getMinY(); 145 double adjustedW = dataArea.getWidth() - e3D.getXOffset(); 146 double adjustedH = dataArea.getHeight() - e3D.getYOffset(); 147 148 if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) { 149 adjustedY += e3D.getYOffset(); 150 } 151 else if (edge == RectangleEdge.RIGHT || edge == RectangleEdge.TOP) { 152 adjustedX += e3D.getXOffset(); 153 } 154 Rectangle2D adjustedDataArea = new Rectangle2D.Double ( 155 adjustedX, adjustedY, adjustedW, adjustedH 156 ); 157 158 AxisState info = drawTickMarksAndLabels( 160 g2, cursor, plotArea, adjustedDataArea, edge 161 ); 162 163 info = drawLabel(getLabel(), g2, plotArea, dataArea, edge, info); 165 166 return info; 167 168 } 169 170 } 171 | Popular Tags |