Package org.jfree.chart.axis
Class LogarithmicAxis
java.lang.Object
org.jfree.chart.axis.Axis
org.jfree.chart.axis.ValueAxis
org.jfree.chart.axis.NumberAxis
org.jfree.chart.axis.LogarithmicAxis
- All Implemented Interfaces:
- Serializable,- Cloneable,- org.jfree.util.PublicCloneable
public class LogarithmicAxis extends NumberAxis
A numerical axis that uses a logarithmic scale.
- Author:
- Michael Duffy
- See Also:
- Serialized Form
- 
Field SummaryFields Modifier and Type Field Description static doubleLOG10_VALUEUseful constant for log(10).static doubleSMALL_LOG_VALUESmallest arbitrarily-close-to-zero value allowed.Fields inherited from class org.jfree.chart.axis.NumberAxisDEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_TICK_UNIT, DEFAULT_VERTICAL_TICK_LABELSFields inherited from class org.jfree.chart.axis.ValueAxisDEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_AUTO_TICK_UNIT_SELECTION, DEFAULT_INVERTED, DEFAULT_LOWER_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNTFields inherited from class org.jfree.chart.axis.AxisDEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE
- 
Constructor SummaryConstructors Constructor Description LogarithmicAxis(String label)Creates a new axis.
- 
Method SummaryModifier and Type Method Description doubleadjustedLog10(double val)Returns an adjusted log10 value for graphing purposes.voidautoAdjustRange()Rescales the axis to ensure that all data is visible.booleangetAllowNegativesFlag()Returns the 'allowNegativesFlag' flag; true to allow negative values in data, false to be able to plot positive values arbitrarily close to zero.booleangetExpTickLabelsFlag()Returns the 'expTickLabelsFlag' flag.booleangetLog10TickLabelsFlag()Returns the 'log10TickLabelsFlag' flag.booleangetStrictValuesFlag()Returns the 'strictValuesFlag' flag; if true and 'allowNegativesFlag' is false then this axis will throw a runtime exception if any of its values are less than or equal to zero; if false then the axis will adjust for values less than or equal to zero as needed.doublejava2DToValue(double java2DValue, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified plotArea.ListrefreshTicks(Graphics2D g2, AxisState state, Rectangle2D drawArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).ListrefreshTicksHorizontal(Graphics2D g2, double cursor, Rectangle2D drawArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).ListrefreshTicksVertical(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).voidsetAllowNegativesFlag(boolean flgVal)Sets the 'allowNegativesFlag' flag; true to allow negative values in data, false to be able to plot positive values arbitrarily close to zero.voidsetExpTickLabelsFlag(boolean flgVal)Sets the 'expTickLabelsFlag' flag.voidsetLog10TickLabelsFlag(boolean flag)Sets the 'log10TickLabelsFlag' flag.voidsetRange(Range range)Overridden version that calls original and then sets up flag for log axis processing.voidsetStrictValuesFlag(boolean flgVal)Sets the 'strictValuesFlag' flag; if true and 'allowNegativesFlag' is false then this axis will throw a runtime exception if any of its values are less than or equal to zero; if false then the axis will adjust for values less than or equal to zero as needed.doubletranslateJava2DToValue(double java2DValue, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Deprecated.Use java2DToValue().doubletranslateValueToJava2D(double value, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Deprecated.Use valueToJava2D().doublevalueToJava2D(double value, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified plotArea.Methods inherited from class org.jfree.chart.axis.NumberAxisautoRangeIncludesZero, autoRangeStickyZero, calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, clone, configure, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, draw, equals, getDecimalFormat, getMarkerBand, getNumberFormatOverride, getTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setMarkerBand, setNumberFormatOverride, setTickUnit, setTickUnit, stringReplaceMethods inherited from class org.jfree.chart.axis.ValueAxiscenterRange, getAutoRangeMinimumSize, getDownArrow, getFixedAutoRange, getLeftArrow, getLowerBound, getLowerMargin, getMaximumAxisValue, getMinimumAxisValue, getRange, getRightArrow, getStandardTickUnits, getUpArrow, getUpperBound, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, isNegativeArrowVisible, isPositiveArrowVisible, isVerticalTickLabels, reserveSpace, resizeRange, resizeRange, setAutoRange, setAutoRangeMinimumSize, setAutoRangeMinimumSize, setAutoTickUnitSelection, setAutoTickUnitSelection, setDownArrow, setFixedAutoRange, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setMaximumAxisValue, setMinimumAxisValue, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabels, translateJava2DtoValue, zoomRangeMethods inherited from class org.jfree.chart.axis.AxisaddChangeListener, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelFont, getLabelInsets, getLabelPaint, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, isAxisLineVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, removeChangeListener, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
- 
Field Details- 
LOG10_VALUEpublic static final double LOG10_VALUEUseful constant for log(10).
- 
SMALL_LOG_VALUEpublic static final double SMALL_LOG_VALUESmallest arbitrarily-close-to-zero value allowed.- See Also:
- Constant Field Values
 
 
- 
- 
Constructor Details- 
LogarithmicAxisCreates a new axis.- Parameters:
- label- the axis label.
 
 
- 
- 
Method Details- 
setAllowNegativesFlagpublic void setAllowNegativesFlag(boolean flgVal)Sets the 'allowNegativesFlag' flag; true to allow negative values in data, false to be able to plot positive values arbitrarily close to zero.- Parameters:
- flgVal- the new value of the flag.
 
- 
getAllowNegativesFlagpublic boolean getAllowNegativesFlag()Returns the 'allowNegativesFlag' flag; true to allow negative values in data, false to be able to plot positive values arbitrarily close to zero.- Returns:
- the flag.
 
- 
setStrictValuesFlagpublic void setStrictValuesFlag(boolean flgVal)Sets the 'strictValuesFlag' flag; if true and 'allowNegativesFlag' is false then this axis will throw a runtime exception if any of its values are less than or equal to zero; if false then the axis will adjust for values less than or equal to zero as needed.- Parameters:
- flgVal- true for strict enforcement.
 
- 
getStrictValuesFlagpublic boolean getStrictValuesFlag()Returns the 'strictValuesFlag' flag; if true and 'allowNegativesFlag' is false then this axis will throw a runtime exception if any of its values are less than or equal to zero; if false then the axis will adjust for values less than or equal to zero as needed.- Returns:
- true if strict enforcement is enabled.
 
- 
setExpTickLabelsFlagpublic void setExpTickLabelsFlag(boolean flgVal)Sets the 'expTickLabelsFlag' flag. If the 'log10TickLabelsFlag' is false then this will set whether or not "1e#"-style tick labels are used. The default is to use "1e#"-style tick labels.- Parameters:
- flgVal- true for "1e#"-style tick labels, false for log10 or regular numeric tick labels.
 
- 
getExpTickLabelsFlagpublic boolean getExpTickLabelsFlag()Returns the 'expTickLabelsFlag' flag.- Returns:
- true for "1e#"-style tick labels, false for log10 or regular numeric tick labels.
 
- 
setLog10TickLabelsFlagpublic void setLog10TickLabelsFlag(boolean flag)Sets the 'log10TickLabelsFlag' flag. The default value is false.- Parameters:
- flag- true for "10^n"-style tick labels, false for "1e#"-style or regular numeric tick labels.
 
- 
getLog10TickLabelsFlagpublic boolean getLog10TickLabelsFlag()Returns the 'log10TickLabelsFlag' flag.- Returns:
- true for "10^n"-style tick labels, false for "1e#"-style or regular numeric tick labels.
 
- 
setRangeOverridden version that calls original and then sets up flag for log axis processing.
- 
adjustedLog10public double adjustedLog10(double val)Returns an adjusted log10 value for graphing purposes. The first adjustment is that negative values are changed to positive during the calculations, and then the answer is negated at the end. The second is that, for values less than 10, an increasingly large (0 to 1) scaling factor is added such that at 0 the value is adjusted to 1, resulting in a returned result of 0.- Parameters:
- val- value for which log10 should be calculated.
- Returns:
- an adjusted log10(val).
 
- 
autoAdjustRangepublic void autoAdjustRange()Rescales the axis to ensure that all data is visible.
- 
valueToJava2DConverts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified plotArea. Note that it is possible for the coordinate to fall outside the plotArea.- Overrides:
- valueToJava2Din class- NumberAxis
- Parameters:
- value- the data value.
- plotArea- the area for plotting the data.
- edge- the axis location.
- Returns:
- the Java2D coordinate.
 
- 
java2DToValuepublic double java2DToValue(double java2DValue, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified plotArea.- Overrides:
- java2DToValuein class- NumberAxis
- Parameters:
- java2DValue- the coordinate in Java2D space.
- plotArea- the area in which the data is plotted.
- edge- the axis location.
- Returns:
- the data value.
 
- 
refreshTickspublic List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D drawArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).- Overrides:
- refreshTicksin class- NumberAxis
- Parameters:
- g2- the graphics device.
- state- the axis state.
- drawArea- the area in which the plot and the axes should be drawn.
- dataArea- the area in which the plot should be drawn.
- edge- the location of the axis.
- Returns:
- a list of ticks.
 
- 
refreshTicksHorizontalpublic List refreshTicksHorizontal(Graphics2D g2, double cursor, Rectangle2D drawArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).- Parameters:
- g2- the graphics device.
- cursor- the cursor position.
- drawArea- the area in which the plot and the axes should be drawn.
- dataArea- the area in which the plot should be drawn.
- edge- the location of the axis.
- Returns:
- A list of ticks.
 
- 
refreshTicksVerticalpublic List refreshTicksVertical(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).- Parameters:
- g2- the graphics device.
- cursor- the cursor position.
- plotArea- the area in which the plot and the axes should be drawn.
- dataArea- the area in which the plot should be drawn.
- edge- the axis location.
- Returns:
- A list of ticks.
 
- 
translateValueToJava2Dpublic double translateValueToJava2D(double value, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Deprecated.Use valueToJava2D().Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified plotArea. Note that it is possible for the coordinate to fall outside the plotArea.- Overrides:
- translateValueToJava2Din class- NumberAxis
- Parameters:
- value- the data value.
- plotArea- the area for plotting the data.
- edge- the axis location.
- Returns:
- the Java2D coordinate.
 
- 
translateJava2DToValuepublic double translateJava2DToValue(double java2DValue, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge)Deprecated.Use java2DToValue().Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified plotArea.- Overrides:
- translateJava2DToValuein class- NumberAxis
- Parameters:
- java2DValue- the coordinate in Java2D space.
- plotArea- the area in which the data is plotted.
- edge- the axis location.
- Returns:
- the data value.
 
 
-