axis.java
来自「JfreeChart 常用图表例子」· Java 代码 · 共 1,201 行 · 第 1/3 页
JAVA
1,201 行
} if (!insets.equals(this.labelInsets)) { this.labelInsets = insets; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the angle of the axis label. * * @return The angle (in radians). */ public double getLabelAngle() { return this.labelAngle; } /** * Sets the angle for the label and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param angle the angle (in radians). */ public void setLabelAngle(double angle) { this.labelAngle = angle; notifyListeners(new AxisChangeEvent(this)); } /** * A flag that controls whether or not the axis line is drawn. * * @return A boolean. */ public boolean isAxisLineVisible() { return this.axisLineVisible; } /** * Sets a flag that controls whether or not the axis line is visible and * sends an {@link AxisChangeEvent} to all registered listeners. * * @param visible the flag. */ public void setAxisLineVisible(boolean visible) { this.axisLineVisible = visible; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the paint used to draw the axis line. * * @return The paint (never <code>null</code>). */ public Paint getAxisLinePaint() { return this.axisLinePaint; } /** * Sets the paint used to draw the axis line and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). */ public void setAxisLinePaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.axisLinePaint = paint; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the stroke used to draw the axis line. * * @return The stroke (never <code>null</code>). */ public Stroke getAxisLineStroke() { return this.axisLineStroke; } /** * Sets the stroke used to draw the axis line and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param stroke the stroke (<code>null</code> not permitted). */ public void setAxisLineStroke(Stroke stroke) { if (stroke == null) { throw new IllegalArgumentException("Null 'stroke' argument."); } this.axisLineStroke = stroke; notifyListeners(new AxisChangeEvent(this)); } /** * Returns a flag indicating whether or not the tick labels are visible. * * @return The flag. */ public boolean isTickLabelsVisible() { return this.tickLabelsVisible; } /** * Sets the flag that determines whether or not the tick labels are * visible and sends an {@link AxisChangeEvent} to all registered * listeners. * * @param flag the flag. */ public void setTickLabelsVisible(boolean flag) { if (flag != this.tickLabelsVisible) { this.tickLabelsVisible = flag; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the font used for the tick labels (if showing). * * @return The font (never <code>null</code>). */ public Font getTickLabelFont() { return this.tickLabelFont; } /** * Sets the font for the tick labels and sends an {@link AxisChangeEvent} * to all registered listeners. * * @param font the font (<code>null</code> not allowed). */ public void setTickLabelFont(Font font) { // check arguments... if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } // apply change if necessary... if (!this.tickLabelFont.equals(font)) { this.tickLabelFont = font; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the color/shade used for the tick labels. * * @return The paint used for the tick labels. */ public Paint getTickLabelPaint() { return this.tickLabelPaint; } /** * Sets the paint used to draw tick labels (if they are showing) and * sends an {@link AxisChangeEvent} to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). */ public void setTickLabelPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.tickLabelPaint = paint; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the insets for the tick labels. * * @return The insets (never <code>null</code>). */ public RectangleInsets getTickLabelInsets() { return this.tickLabelInsets; } /** * Sets the insets for the tick labels and sends an {@link AxisChangeEvent} * to all registered listeners. * * @param insets the insets (<code>null</code> not permitted). */ public void setTickLabelInsets(RectangleInsets insets) { if (insets == null) { throw new IllegalArgumentException("Null 'insets' argument."); } if (!this.tickLabelInsets.equals(insets)) { this.tickLabelInsets = insets; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the flag that indicates whether or not the tick marks are * showing. * * @return The flag that indicates whether or not the tick marks are * showing. */ public boolean isTickMarksVisible() { return this.tickMarksVisible; } /** * Sets the flag that indicates whether or not the tick marks are showing * and sends an {@link AxisChangeEvent} to all registered listeners. * * @param flag the flag. */ public void setTickMarksVisible(boolean flag) { if (flag != this.tickMarksVisible) { this.tickMarksVisible = flag; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the inside length of the tick marks. * * @return The length. */ public float getTickMarkInsideLength() { return this.tickMarkInsideLength; } /** * Sets the inside length of the tick marks and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param length the new length. */ public void setTickMarkInsideLength(float length) { this.tickMarkInsideLength = length; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the outside length of the tick marks. * * @return The length. */ public float getTickMarkOutsideLength() { return this.tickMarkOutsideLength; } /** * Sets the outside length of the tick marks and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param length the new length. */ public void setTickMarkOutsideLength(float length) { this.tickMarkOutsideLength = length; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the stroke used to draw tick marks. * * @return The stroke (never <code>null</code>). */ public Stroke getTickMarkStroke() { return this.tickMarkStroke; } /** * Sets the stroke used to draw tick marks and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param stroke the stroke (<code>null</code> not permitted). */ public void setTickMarkStroke(Stroke stroke) { if (stroke == null) { throw new IllegalArgumentException("Null 'stroke' argument."); } if (!this.tickMarkStroke.equals(stroke)) { this.tickMarkStroke = stroke; notifyListeners(new AxisChangeEvent(this)); } } /** * Returns the paint used to draw tick marks (if they are showing). * * @return The paint (never <code>null</code>). */ public Paint getTickMarkPaint() { return this.tickMarkPaint; } /** * Sets the paint used to draw tick marks and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). */ public void setTickMarkPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.tickMarkPaint = paint; notifyListeners(new AxisChangeEvent(this)); } /** * Returns the plot that the axis is assigned to. This method will return * <code>null</code> if the axis is not currently assigned to a plot. * * @return The plot that the axis is assigned to (possibly * <code>null</code>). */ public Plot getPlot() { return this.plot; } /** * Sets a reference to the plot that the axis is assigned to. * <P> * This method is used internally, you shouldn't need to call it yourself. * * @param plot the plot. */ public void setPlot(Plot plot) { this.plot = plot; configure(); } /** * Returns the fixed dimension for the axis. * * @return The fixed dimension. */ public double getFixedDimension() { return this.fixedDimension; } /** * Sets the fixed dimension for the axis. * <P> * This is used when combining more than one plot on a chart. In this case, * there may be several axes that need to have the same height or width so * that they are aligned. This method is used to fix a dimension for the * axis (the context determines whether the dimension is horizontal or * vertical). * * @param dimension the fixed dimension. */ public void setFixedDimension(double dimension) { this.fixedDimension = dimension; } /** * Configures the axis to work with the current plot. Override this method * to perform any special processing (such as auto-rescaling). */ public abstract void configure(); /** * Estimates the space (height or width) required to draw the axis. * * @param g2 the graphics device. * @param plot the plot that the axis belongs to. * @param plotArea the area within which the plot (including axes) should * be drawn. * @param edge the axis location. * @param space space already reserved. * * @return The space required to draw the axis (including pre-reserved * space). */ public abstract AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space); /** * Draws the axis on a Java 2D graphics device (such as the screen or a * printer). * * @param g2 the graphics device (<code>null</code> not permitted). * @param cursor the cursor location (determines where to draw the axis). * @param plotArea the area within which the axes and plot should be drawn. * @param dataArea the area within which the data should be drawn. * @param edge the axis location (<code>null</code> not permitted). * @param plotState collects information about the plot * (<code>null</code> permitted). * * @return The axis state (never <code>null</code>). */ public abstract AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo plotState); /**
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?