Package org.jCharts.axisChart.axis
Class XAxis
- java.lang.Object
-
- org.jCharts.axisChart.axis.Axis
-
- org.jCharts.axisChart.axis.XAxis
-
- All Implemented Interfaces:
java.io.Serializable
,HTMLTestable
public final class XAxis extends Axis implements HTMLTestable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
startTicksAtAxis
private int
xLabelFilter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
computeAxisCoordinate(float origin, double value, double axisMinValue)
Takes a value and determines the screen coordinate it should be drawn at.void
computeLabelFilter()
Method to compute the filter to use on the x-axis label display so labels do not overlapvoid
computeMinimumHeightNeeded(java.lang.String axisTitle)
Computes the minimum pixel height required for the X-Axis.void
computeScalePixelWidth()
Computes the number of pixels between each value on the axis.void
computeShouldTickStartAtYAxis(IAxisDataSeries iAxisDataSeries, AxisTypeProperties axisTypeProperties)
Determines if we should start x-axis ticks at the y-axis or space it out a half a scale item width.void
computeTickStart()
Computes the screen pixel location of the first tick markvoid
render(java.awt.Graphics2D graphics2D, AxisProperties axisProperties, java.lang.String axisTitle)
Renders the YAxis on the passes Graphics2D objectprivate void
renderAxisTitle(java.lang.String axisTitle, java.awt.Graphics2D graphics2D, AxisTypeProperties axisTypeProperties)
Computes the number of pixels between each value on the axis.void
toHTML(HTMLGenerator htmlGenerator)
Enables the testing routines to display the contents of this Object.-
Methods inherited from class org.jCharts.axisChart.axis.Axis
computeAxisTitleDimensions, computeOneUnitPixelSize, computeScalePixelWidthDataAxis, getAxisChart, getAxisLabelsGroup, getMinimumHeightNeeded, getMinimumWidthNeeded, getNumberOfScaleItems, getOneUnitPixelSize, getOrigin, getPixelLength, getScaleCalculator, getScalePixelWidth, getTickStart, getTitleHeight, getTitleWidth, getZeroLineCoordinate, setAxisLabelsGroup, setMinimumHeightNeeded, setMinimumWidthNeeded, setOneUnitPixelSize, setOrigin, setPixelLength, setScaleCalculator, setScalePixelWidth, setTickStart, setZeroLineCoordinate
-
-
-
-
Constructor Detail
-
XAxis
public XAxis(AxisChart axisChart, int numberOfScaleItems)
- Parameters:
axisChart
-numberOfScaleItems
-
-
-
Method Detail
-
computeMinimumHeightNeeded
public void computeMinimumHeightNeeded(java.lang.String axisTitle)
Computes the minimum pixel height required for the X-Axis. Includes space, if needed, for: axis title + padding, axis values + tick padding, and tick marks.- Parameters:
axisTitle
-
-
renderAxisTitle
private void renderAxisTitle(java.lang.String axisTitle, java.awt.Graphics2D graphics2D, AxisTypeProperties axisTypeProperties)
Computes the number of pixels between each value on the axis. public void computeScalePixelWidth( int numberOfValuesOnXAxis ) { super.setScalePixelWidth( super.getPixelLength() / numberOfValuesOnXAxis ); } /****************************************************************************************************- Parameters:
axisTitle
-graphics2D
-axisTypeProperties
-
-
computeShouldTickStartAtYAxis
public void computeShouldTickStartAtYAxis(IAxisDataSeries iAxisDataSeries, AxisTypeProperties axisTypeProperties)
Determines if we should start x-axis ticks at the y-axis or space it out a half a scale item width.- Parameters:
iAxisDataSeries
-axisTypeProperties
-
-
computeTickStart
public void computeTickStart()
Computes the screen pixel location of the first tick mark
-
computeScalePixelWidth
public void computeScalePixelWidth()
Computes the number of pixels between each value on the axis.- Overrides:
computeScalePixelWidth
in classAxis
-
render
public void render(java.awt.Graphics2D graphics2D, AxisProperties axisProperties, java.lang.String axisTitle)
Renders the YAxis on the passes Graphics2D object- Parameters:
graphics2D
-axisProperties
-axisTitle
-
-
computeLabelFilter
public void computeLabelFilter()
Method to compute the filter to use on the x-axis label display so labels do not overlap
-
toHTML
public void toHTML(HTMLGenerator htmlGenerator)
Enables the testing routines to display the contents of this Object.- Specified by:
toHTML
in interfaceHTMLTestable
- Overrides:
toHTML
in classAxis
- Parameters:
htmlGenerator
-
-
computeAxisCoordinate
public float computeAxisCoordinate(float origin, double value, double axisMinValue)
Takes a value and determines the screen coordinate it should be drawn at. THe only difference between this and the y-axis is we add to the origin versus subtract from it.- Parameters:
origin
-value
-axisMinValue
- the minimum value on the axis- Returns:
- float the screen pixel coordinate
-
-