Summ:  Nested Constr. Methods    Details:  Constr. Methods      Class:  Prev Next
com.artfulbits.aiCharts.Base
Class ChartAxis

java.lang.Object com.artfulbits.aiCharts.Base.ChartAxis

Declaration: public final class ChartAxis extends Object

 

Represents chart axis element. Instantiated either by aiChart engine or manually for customizations purposes. Axis may be rendered differently depending on CoordinateSystem that corresponds to type represented by series.
For Cartesian coordinate system:

For Polar coordinate system:

Generally, axis consists of five visual elements: grid, labels, main axis line, labels ticks and title.
XML Attributes
formatDefines labels format
tickDefines tick mode
ticksizeDefines ticks size
invertedDefines whether axis is inverted
titleDefines title
paddingDefines padding
spacingDefines spacing
minDefines min value
maxDefines max value
intervalDefines axis interval
gridLinesColorDefines color used to draw grid lines

 

Since: 1.0
See also: ChartArea.ChartArea(ChartAxis,ChartAxis)ChartArea.getDefaultXAxis()ChartArea.getDefaultYAxis()ChartSeries.getActualXAxis()ChartSeries.getActualYAxis()

 

 

Nested Members Summary
static class ChartAxis.Label
    
Represents axis label.
static enum ChartAxis.LabelLayoutMode
    
static enum ChartAxis.LabelPosition
    
Determines axis labels position relatively to axis line.
static enum ChartAxis.LabelsMode
    
Represents axis labels mode enumeration.
static enum ChartAxis.Position
    
Represents axis position enumeration.
static enum ChartAxis.TickMarkMode
    
Represents mode that is used to draw tick marks.
static enum ChartAxis.ValueType
    
Identifies type of value that is represented by axis labels.

 

 

Constructors Summary
ChartAxis(ChartAxis.Position position)
    
Initializes the new ChartAxis instance.

 

 

Methods Summary
double coeficientToValue(double coeficient)
    
Converts absolute portion of axis to ranged value.
android.graphics.RectF getBounds()
    
Gets the rectangular area occupied by axis.
ChartCollection<ChartAxis.Label> getCustomLabels()
    
Get the collection of custom labels.
java.text.Format getFormat()
    
Gets the java.text.Format instance to use for the format labels.
android.graphics.Paint getGridLinePaint()
    
Gets the android.graphics.Paint object that is used to draw grid lines.
boolean getGridVisible()
    
Gets the value indicating whether axis grid is visible.
Alignment getLabelAlignment()
    
Gets value the indicating labels alignment.
ChartAxis.LabelLayoutMode getLabelLayoutMode()
    
Gets value determining labels layout mode.
android.text.TextPaint getLabelPaint()
    
Gets the android.text.TextPaint object that is used to draw axis labels.
ChartAxis.LabelPosition getLabelPosition()
    
Gets value indicating how labels should be positioned on axis line.
ChartAxis.LabelsMode getLabelsMode()
    
Gets enumeration representing logic that is used to calculate labels for axis.
android.graphics.Paint getLinePaint()
    
Gets the android.graphics.Paint object that is used to draw axis line and ticks.
double getOrigin()
    
Gets the origin value for axis.
int getPadding()
    
Gets the padding value for axis.
ChartAxis.Position getPosition()
    
Gets the position of axis.
ChartAxisScale getScale()
    
Gets instance of ChartAxisScale object that is in change of axis range calculations.
boolean getShowLabels()
    
Gets value identifying whether labels should be shown for this axis.
int getSpacing()
    
Gets value indicating distance between axis elements.
ChartCollection<ChartAxisStripLine> getStripLines()
    
Get the collection of strip lines.
ChartAxis.TickMarkMode getTickMarkMode()
    
Gets the mode used to draw tick marks.
java.lang.String getTitle()
    
Gets the string representation of axis' title.
Alignment getTitleAlignment()
    
Gets value the indicating title alignment.
android.graphics.Paint getTitlePaint()
    
Gets the android.text.TextPaint object that is used to draw axis title.
ChartAxis.ValueType getValueType()
    
Gets the type of value that is used to represent axis labels.
boolean isInverted()
    
Indicates whether axis is inverted.
boolean isScrollBarEnabled()
    
TODO
boolean isVisible()
    
Gets the visibility state for this element.
void setFormat(java.text.Format format)
    
Sets the java.text.Format instance to use for the format labels.
void setFormat(java.lang.String format)
    
Deprecated. setFormat(Format) with java.text.MessageFormat parameter.
void setGridLineColor(int color)
    
Sets color used to draw ticks grid lines.
void setGridVisible(boolean value)
    
Sets the value indicating whether area grid is visible.
void setInverted(boolean inverted)
    
Indicates whether axis is inverted.
void setLabelAlignment(Alignment alignment)
    
Sets value the indicating labels alignment.
void setLabelLayoutMode(ChartAxis.LabelLayoutMode mode)
    
Sets value determining labels layout mode.
void setLabelPosition(ChartAxis.LabelPosition position)
    
Sets value indicating how labels should be positioned on axis line.
void setLabelsMode(ChartAxis.LabelsMode mode)
    
Sets enumeration representing logic that should be used to calculate labels for axis.
void setLineType(float width, int color)
    
Sets line parameters that is used to draw main axis line.
void setOrigin(double origin)
    
Sets the origin value for axis.
void setPadding(int padding)
    
Sets the padding value for axis.
void setPosition(ChartAxis.Position position)
    
Sets the position of axis.
void setScrollBarEnabled(boolean enabled)
    
TODO
void setShowLabels(boolean showLabels)
    
Sets value determining whether labels should be drawn for this axis.
void setSpacing(int spacing)
    
Sets value indicating distance between axis elements.
void setTickMarkMode(ChartAxis.TickMarkMode mode)
    
Sets mode for the tick marks.
void setTitle(java.lang.String title)
    
Sets the title for axis.
void setTitleAlignment(Alignment alignment)
    
Sets value the indicating title alignment.
void setValueType(ChartAxis.ValueType type)
    
Sets type of value that should be represented by axis labels.
void setVisible(boolean visible)
    
Sets visibility of this element on parent ChartView.
double valueToCoeficient(double value)
    
Converts ranged axis value to absolute portion of axis.

 

Methods inherited from class: java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

 

 

 

ChartAxis

 

public ChartAxis( ChartAxis.Position position)

 

Initializes the new ChartAxis instance.

 

Parameters:
position-
instance of ChartAxis.Position to identify axis layout.

 

Since: 1.0

 

 

 

 

getScale

 

public ChartAxisScale getScale( )

 

Gets instance of ChartAxisScale object that is in change of axis range calculations.

 

Returns:
instance of current axis scale.

 

Since: 1.0
See also: ChartAxisScale

 

 

 

getCustomLabels

 

public ChartCollection<ChartAxis.Label> getCustomLabels( )

 

Get the collection of custom labels. Neither ValueType , LabelsMode, or Format is taken into consideration for custom labels.

 

Returns:
collection of custom labels.

 

Since: 1.0

 

 

 

getStripLines

 

public ChartCollection<ChartAxisStripLine> getStripLines( )

 

Get the collection of strip lines.

 

Returns:
collection of strip lines

 

Since: 1.0

 

 

 

setPosition

 

public void setPosition( ChartAxis.Position position)

 

Sets the position of axis.

 

Parameters:
position-
of ChartAxis.Position.

 

Since: 1.0

 

 

 

getPosition

 

public ChartAxis.Position getPosition( )

 

Gets the position of axis.

 

Returns:
ChartAxis.Position value.

 

Since: 1.0

 

 

 

getGridVisible

 

public boolean getGridVisible( )

 

Gets the value indicating whether axis grid is visible.
 axis.setGridVisible(false);
 
will provide similar output:

 

Returns:
true if area's grid is visible, otherwise false.

 

Since: 1.0

 

 

 

setGridVisible

 

public void setGridVisible( boolean value)

 

Sets the value indicating whether area grid is visible.

 

Parameters:
value-
true if area's grid should be visible, otherwise false.

 

Since: 1.0

 

 

 

setPadding

 

public void setPadding( int padding)

 

Sets the padding value for axis.

 

Parameters:
padding-
value of padding.

 

Since: 1.5

 

 

 

getPadding

 

public int getPadding( )

 

Gets the padding value for axis.

 

Returns:
value of padding.

 

Since: 1.5

 

 

 

getSpacing

 

public int getSpacing( )

 

Gets value indicating distance between axis elements.

 

Returns:
value of spacing applied to all axis elements.

 

Since: 1.0

 

 

 

setScrollBarEnabled

 

public void setScrollBarEnabled( boolean enabled)

 

TODO

 

Parameters:
enabled-

 

Since: 1.5.4

 

 

 

isScrollBarEnabled

 

public boolean isScrollBarEnabled( )

 

TODO

 

Since: 1.5.4

 

 

 

setSpacing

 

public void setSpacing( int spacing)

 

Sets value indicating distance between axis elements.

 

Parameters:
spacing-
value of spacing applied to all axis elements.

 

Since: 1.0

 

 

 

getLabelPaint

 

public android.text.TextPaint getLabelPaint( )

 

Gets the android.text.TextPaint object that is used to draw axis labels.

 

Returns:
paint object instance.

 

Since: 1.0

 

 

 

getTitlePaint

 

public android.graphics.Paint getTitlePaint( )

 

Gets the android.text.TextPaint object that is used to draw axis title.

 

Returns:
paint object instance.

 

Since: 1.5.4

 

 

 

getLabelPosition

 

public ChartAxis.LabelPosition getLabelPosition( )

 

Gets value indicating how labels should be positioned on axis line.

 

Returns:
value of current labels position.

 

Since: 1.0

 

 

 

setLabelPosition

 

public void setLabelPosition( ChartAxis.LabelPosition position)

 

Sets value indicating how labels should be positioned on axis line.

 

Parameters:
position-
value of desired labels position.

 

Since: 1.0

 

 

 

setLabelAlignment

 

public void setLabelAlignment( Alignment alignment)

 

Sets value the indicating labels alignment.

 

Parameters:
alignment-
Alignment value

 

Since: 1.5.4

 

 

 

getLabelAlignment

 

public Alignment getLabelAlignment( )

 

Gets value the indicating labels alignment.

 

Returns:
Alignment value.

 

Since: 1.5.4

 

 

 

setTitleAlignment

 

public void setTitleAlignment( Alignment alignment)

 

Sets value the indicating title alignment.

 

Parameters:
alignment-
Alignment value

 

Since: 1.5.4

 

 

 

getTitleAlignment

 

public Alignment getTitleAlignment( )

 

Gets value the indicating title alignment.

 

Returns:
Alignment value.

 

Since: 1.5.4

 

 

 

getLinePaint

 

public android.graphics.Paint getLinePaint( )

 

Gets the android.graphics.Paint object that is used to draw axis line and ticks.

 

Returns:
paint object instance.

 

Since: 1.0

 

 

 

getGridLinePaint

 

public android.graphics.Paint getGridLinePaint( )

 

Gets the android.graphics.Paint object that is used to draw grid lines.

 

Returns:
paint object instance.

 

Since: 1.0

 

 

 

getOrigin

 

public double getOrigin( )

 

Gets the origin value for axis.

 

Returns:
value of origin.

 

Since: 1.0

 

 

 

setOrigin

 

public void setOrigin( double origin)

 

Sets the origin value for axis. Use Double.POSITIVE_INFINITY value to set maximal value of scale and Double.NEGATIVE_INFINITY to set minimal value of scale.

 

Parameters:
origin-
value of origin.

 

Since: 1.0

 

 

 

getTitle

 

public java.lang.String getTitle( )

 

Gets the string representation of axis' title.

 

Returns:
java.lang.String title.

 

Since: 1.0

 

 

 

setTitle

 

public void setTitle( java.lang.String title)

 

Sets the title for axis.

 

Parameters:
title-
string representation of axis' title.

 

Since: 1.0

 

 

 

setGridLineColor

 

public void setGridLineColor( int color)

 

Sets color used to draw ticks grid lines. Passed value is applied on wrapped android.graphics.Paint that participates in axis grid lines drawing. This object is exposed via getGridLinePaint() method.

 

Parameters:
color-
value of color that will be used to draw area grid lines.

 

Since: 1.0

 

 

 

setFormat

 

public void setFormat( java.lang.String format)

 

Deprecated. setFormat(Format) with java.text.MessageFormat parameter.

Sets the formatting pattern for axis labels. This method is deprecated. Use setFormat(Format)

 

Parameters:
format-
java.lang.String format.

 

Since: 1.0
See also: setValueType(ChartAxis.ValueType)getFormat()

 

 

 

setFormat

 

public void setFormat( java.text.Format format)

 

Sets the java.text.Format instance to use for the format labels.

 

Parameters:
format-
java.text.Format instance

 

Since: 1.5

 

 

 

getFormat

 

public java.text.Format getFormat( )

 

Gets the java.text.Format instance to use for the format labels.

 

Returns:
java.text.Format format.

 

Since: 1.5
See also: setFormat(Format)

 

 

 

setInverted

 

public void setInverted( boolean inverted)

 

Indicates whether axis is inverted.

 

Parameters:
inverted-
the inverted to set

 

Since: 1.0

 

 

 

isInverted

 

public boolean isInverted( )

 

Indicates whether axis is inverted.

 

Returns:
inverted is inverted.

 

Since: 1.0

 

 

 

setTickMarkMode

 

public void setTickMarkMode( ChartAxis.TickMarkMode mode)

 

Sets mode for the tick marks.

 

Parameters:
mode-
instance of ChartAxis.TickMarkMode

 

Since: 1.0

 

 

 

getTickMarkMode

 

public ChartAxis.TickMarkMode getTickMarkMode( )

 

Gets the mode used to draw tick marks.

 

Returns:
mode instance of current ChartAxis.TickMarkMode.

 

Since: 1.0

 

 

 

setLineType

 

public void setLineType( float width,
int color)

 

Sets line parameters that is used to draw main axis line.

 

Parameters:
width-
width of line.
color-
color of line represented by HEX value.

 

Since: 1.0

 

 

 

getBounds

 

public android.graphics.RectF getBounds( )

 

Gets the rectangular area occupied by axis.

 

Returns:
android.graphics.RectF rectangle containing bounds.

 

Since: 1.0

 

 

 

setVisible

 

public void setVisible( boolean visible)

 

Sets visibility of this element on parent ChartView.

 

Parameters:
visible-
true if element should be visible, otherwise false.

 

Since: 1.0

 

 

 

isVisible

 

public boolean isVisible( )

 

Gets the visibility state for this element.

 

Returns:
true if element is visible, otherwise false.

 

Since: 1.0

 

 

 

getValueType

 

public ChartAxis.ValueType getValueType( )

 

Gets the type of value that is used to represent axis labels.

 

Returns:
ChartAxis.ValueType enumeration instance.

 

Since: 1.0

 

 

 

setValueType

 

public void setValueType( ChartAxis.ValueType type)

 

Sets type of value that should be represented by axis labels.

 

Parameters:
type-
ChartAxis.ValueType enumeration instance.

 

Since: 1.0

 

 

 

getLabelsMode

 

public ChartAxis.LabelsMode getLabelsMode( )

 

Gets enumeration representing logic that is used to calculate labels for axis.

 

Returns:
instance of ChartAxis.LabelsMode

 

Since: 1.0

 

 

 

setLabelsMode

 

public void setLabelsMode( ChartAxis.LabelsMode mode)

 

Sets enumeration representing logic that should be used to calculate labels for axis.

 

Parameters:
mode-
instance of ChartAxis.LabelsMode

 

Since: 1.0

 

 

 

setShowLabels

 

public void setShowLabels( boolean showLabels)

 

Sets value determining whether labels should be drawn for this axis.

 

Parameters:
showLabels-
true, if labels should be present on this axis, otherwise false.

 

Since: 1.5
See also: getShowLabels()

 

 

 

getShowLabels

 

public boolean getShowLabels( )

 

Gets value identifying whether labels should be shown for this axis.

 

Returns:
true, if labels should be present on this axis, otherwise false.

 

Since: 1.5
See also: setShowLabels(boolean)

 

 

 

setLabelLayoutMode

 

public void setLabelLayoutMode( ChartAxis.LabelLayoutMode mode)

 

Sets value determining labels layout mode. (Horizontal axes only)

 

Parameters:
mode-
instance of ChartAxis.LabelLayoutMode

 

Since: 1.5.4

 

 

 

getLabelLayoutMode

 

public ChartAxis.LabelLayoutMode getLabelLayoutMode( )

 

Gets value determining labels layout mode.

 

Returns:
mode instance of ChartAxis.LabelLayoutMode

 

Since: 1.5.4

 

 

 

valueToCoeficient

 

public double valueToCoeficient( double value)

 

Converts ranged axis value to absolute portion of axis.

 

Parameters:
value-
value related to axis range.
Returns:
absolute portion value on axis.

 

Since: 1.0
See also: coeficientToValue(double)

 

 

 

coeficientToValue

 

public double coeficientToValue( double coeficient)

 

Converts absolute portion of axis to ranged value.

 

Parameters:
coeficient-
absolute portion of axis.
Returns:
ranged value.

 

Since: 1.0
See also: valueToCoeficient(double)

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.