OverviewSingleDeprecated

jsx3.chart

class Axis

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Painted
      ->jsx3.gui.Block
        ->jsx3.chart.ChartComponent
          ->jsx3.chart.Axis

All Implemented Interfaces:

jsx3.gui.Interactive, jsx3.util.EventDispatcher

Direct Known Subclasses:

jsx3.chart.CategoryAxis, jsx3.chart.LinearAxis, jsx3.chart.LogarithmicAxis

class Axis
extends jsx3.chart.ChartComponent
A base class for all types of axis. Provides all the common properties as well as all rendering logic. Rendering relies on template methods implemented in concrete subclasses.

An axis renders in the following location based on its horizontal and primary properties:
  horizontal x primary   -> bottom
  vertical x primary     -> left
  horizontal x secondary -> top
  vertical x secondary   -> right

Field Summary
static String
LABEL_AXIS
static String
LABEL_HIGH
static String
LABEL_LOW
static String
TICK_CROSS
static String
TICK_INSIDE
static String
TICK_NONE
static String
TICK_OUTSIDE
Constructor Summary
void
init(name : String, horizontal : boolean, primary : boolean)
The instance initializer.
Method Summary
String
Returns the axisStroke field, string representation of the VectorStroke used to draw the line of the axis.
jsx3.chart.ChartLabel
Returns the optional jsx3.chart.ChartLabel child.
int
Returns the display width, the maximum amount of space perpendicular to the axis and outside of the data area that the ticks and labels may occupy (doesn't include area given to axis title).
boolean
Returns the horizontal field, whether this is an x axis, otherwise it is a y axis.
String
Returns the labelClass field, the CSS class used to render major tick labels.
String | Number
Returns the labelColor field, the RGB color value of the label font; note that this is the only way to set the color of the text, using a CSS style attribute will have no effect.
Function
Returns the labelFunction field.
int
Returns the labelGap field, the pixel gap between the tick lines and the labels.
String
Returns the labelStyle field, the CSS style attribute used to render major tick labels.
int
Returns the minorTickDivisions field, number of minor tick divisions between major ticks; the number of minor ticks drawn will be this number minus 1.
int
Returns the minorTickLength field, the length in pixels of the minor tick (if tickPlacement is "cross" the length will actually be twice this.
String
Returns the minorTickPlacement field, where to place the minor ticks.
String
Returns the minorTickStroke field, string representation of VectorStroke used to draw minor ticks.
jsx3.chart.Axis
Returns the opposing axis.
boolean
Returns the showAxis field, whether to show the line along the axis.
boolean
Returns the showLabels field, whether to show major tick labels.
int
Returns the tickLength field, the length in pixels of the major tick (if tickPlacement is "cross" the length will actually be twice this.
String
Returns the tickPlacement field, where to place the major ticks.
String
Returns the tickStroke field, string representation of VectorStroke used to draw major ticks.
static String
Deprecated.
static String
formats labels as a percent, ie "50%"
static String
scientific(v : Number, signif : int)
formats labels in scientific notation, ie "5e2"
void
setAxisStroke(axisStroke : String)
Sets the axisStroke field.
void
setDisplayWidth(displayWidth : int)
Sets the displayWidth field.
void
setHorizontal(horizontal : boolean)
Sets the horizontal field.
void
setLabelClass(labelClass : String)
Sets the labelClass field.
void
setLabelColor(labelColor : String | Number)
Sets the labelColor field.
void
setLabelFunction(labelFunction : String)
Sets the labelFunction field, allows for formatting and transformation of a major tick label; should eval to a function with the signature function(object) : string.
void
setLabelGap(labelGap : int)
Sets the labelGap field.
void
setLabelPlacement(labelPlacement : String)
Sets the labelPlacement field, checks for invalid values.
void
setLabelStyle(labelStyle : String)
Sets the labelStyle field.
void
setMinorTickDivisions(minorTickDivisions : int)
Sets the minorTickDivisions field.
void
setMinorTickLength(minorTickLength : int)
Sets the minorTickLength field.
void
setMinorTickPlacement(minorTickPlacement : String)
Sets the minorTickPlacement field.
void
setMinorTickStroke(minorTickStroke : String)
Sets the minorTickStroke field.
void
setShowAxis(showAxis : boolean)
Sets the showAxis field.
void
setShowLabels(showLabels : boolean)
Sets the showLabels field.
void
setTickLength(tickLength : int)
Sets the tickLength field.
void
setTickPlacement(tickPlacement : String)
Sets the tickPlacement field.
void
setTickStroke(tickStroke : String)
Sets the tickStroke field.
Methods Inherited From jsx3.chart.ChartComponent
getChart
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCDFAttribute, getCDFId, getCSSOverride, getClassName, getColor, getCursor, getDimensions, getDisplay, getFontName, getFontSize, getFontWeight, getHeight, getIndex, getLeft, getMargin, getOverflow, getPadding, getRelativePosition, getTagName, getText, getTextAlign, getTip, getTop, getVisibility, getWidth, getZIndex, hideMask, paint, setBackground, setBackgroundColor, setBorder, setCDFAttribute, setCDFId, setCSSOverride, setClassName, setColor, setCursor, setDimensions, setDisplay, setFontName, setFontSize, setFontWeight, setHeight, setIndex, setLeft, setMargin, setOverflow, setPadding, setRelativePosition, setTagName, setText, setTextAlign, setTip, setTop, setVisibility, setWidth, setZIndex, showMask
Methods Inherited From jsx3.gui.Interactive
doEvent, getCanDrag, getCanDrop, getCanMove, getCanSpy, getEvent, getEvents, getMenu, hasEvent, registerHotKey, removeEvent, removeEvents, setCanDrag, setCanDrop, setCanMove, setCanSpy, setEvent, setMenu, setSpyStyles, showSpy
Methods Inherited From jsx3.gui.Painted
focus, getAbsolutePosition, getAttribute, getAttributes, getDynamicProperty, getRendered, insertHTML, onAfterPaint, onAfterRestoreView, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute, setDynamicProperty
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

LABEL_AXIS

static final String LABEL_AXIS

LABEL_HIGH

static final String LABEL_HIGH

LABEL_LOW

static final String LABEL_LOW

TICK_CROSS

static final String TICK_CROSS

TICK_INSIDE

static final String TICK_INSIDE

TICK_NONE

static final String TICK_NONE

TICK_OUTSIDE

static final String TICK_OUTSIDE
Constructor Detail

init

void init(name : String, horizontal : boolean, primary : boolean)
The instance initializer.

Parameters:

namethe GI name of the instance
horizontalwhether this axis is horizontal (x), otherwise it's vertical (y)
primarywhether this axis is primary, otherwise it's secondary
Method Detail

getAxisStroke

String getAxisStroke()
Returns the axisStroke field, string representation of the VectorStroke used to draw the line of the axis.

Returns:

axisStroke  

getAxisTitle

jsx3.chart.ChartLabel getAxisTitle()
Returns the optional jsx3.chart.ChartLabel child.

Returns:

 

getDisplayWidth

int getDisplayWidth()
Returns the display width, the maximum amount of space perpendicular to the axis and outside of the data area that the ticks and labels may occupy (doesn't include area given to axis title).

Returns:

displayWidth  

getHorizontal

boolean getHorizontal()
Returns the horizontal field, whether this is an x axis, otherwise it is a y axis.

Returns:

horizontal  

getLabelClass

String getLabelClass()
Returns the labelClass field, the CSS class used to render major tick labels.

Returns:

labelClass  

getLabelColor

String | Number getLabelColor()
Returns the labelColor field, the RGB color value of the label font; note that this is the only way to set the color of the text, using a CSS style attribute will have no effect.

Returns:

labelColor  

getLabelFunction

Function getLabelFunction()
Returns the labelFunction field.

Returns:

labelFunction  

getLabelGap

int getLabelGap()
Returns the labelGap field, the pixel gap between the tick lines and the labels.

Returns:

labelGap  

getLabelStyle

String getLabelStyle()
Returns the labelStyle field, the CSS style attribute used to render major tick labels.

Returns:

labelStyle  

getMinorTickDivisions

int getMinorTickDivisions()
Returns the minorTickDivisions field, number of minor tick divisions between major ticks; the number of minor ticks drawn will be this number minus 1.

Returns:

minorTickDivisions  

getMinorTickLength

int getMinorTickLength()
Returns the minorTickLength field, the length in pixels of the minor tick (if tickPlacement is "cross" the length will actually be twice this.

Returns:

minorTickLength  

getMinorTickPlacement

String getMinorTickPlacement()
Returns the minorTickPlacement field, where to place the minor ticks.

Returns:

minorTickPlacement, one of {'none','inside','outside','cross'}  

getMinorTickStroke

String getMinorTickStroke()
Returns the minorTickStroke field, string representation of VectorStroke used to draw minor ticks.

Returns:

minorTickStroke  

getOpposingAxis

jsx3.chart.Axis getOpposingAxis()
Returns the opposing axis.

Returns:

 

getShowAxis

boolean getShowAxis()
Returns the showAxis field, whether to show the line along the axis.

Returns:

showAxis  

getShowLabels

boolean getShowLabels()
Returns the showLabels field, whether to show major tick labels.

Returns:

showLabels  

getTickLength

int getTickLength()
Returns the tickLength field, the length in pixels of the major tick (if tickPlacement is "cross" the length will actually be twice this.

Returns:

tickLength  

getTickPlacement

String getTickPlacement()
Returns the tickPlacement field, where to place the major ticks.

Returns:

tickPlacement, one of {'none','inside','outside','cross'}  

getTickStroke

String getTickStroke()
Returns the tickStroke field, string representation of VectorStroke used to draw major ticks.

Returns:

tickStroke  

getVersion

static String getVersion()
Deprecated.
Returns the release/build for the class (i.e., "2.2.00").

Returns:

 

percent

static String percent(v : Number)
formats labels as a percent, ie "50%"

Parameters:

v

Returns:

 

scientific

static String scientific(v : Number, signif : int)
formats labels in scientific notation, ie "5e2"

Parameters:

v
signif

Returns:

 

setAxisStroke

void setAxisStroke(axisStroke : String)
Sets the axisStroke field.

Parameters:

axisStrokethe new value for axisStroke

setDisplayWidth

void setDisplayWidth(displayWidth : int)
Sets the displayWidth field.

Parameters:

displayWidththe new value for displayWidth

setHorizontal

void setHorizontal(horizontal : boolean)
Sets the horizontal field.

Parameters:

horizontalthe new value for horizontal

setLabelClass

void setLabelClass(labelClass : String)
Sets the labelClass field.

Parameters:

labelClassthe new value for labelClass

setLabelColor

void setLabelColor(labelColor : String | Number)
Sets the labelColor field.

Parameters:

labelColorthe new value for labelColor

setLabelFunction

void setLabelFunction(labelFunction : String)
Sets the labelFunction field, allows for formatting and transformation of a major tick label; should eval to a function with the signature function(object) : string.

Parameters:

labelFunctionthe new value for labelFunction

setLabelGap

void setLabelGap(labelGap : int)
Sets the labelGap field.

Parameters:

labelGapthe new value for labelGap

setLabelPlacement

void setLabelPlacement(labelPlacement : String)
Sets the labelPlacement field, checks for invalid values.

Parameters:

labelPlacementthe new value for labelPlacement, one of {'axis','high','low'}

setLabelStyle

void setLabelStyle(labelStyle : String)
Sets the labelStyle field.

Parameters:

labelStylethe new value for labelStyle

setMinorTickDivisions

void setMinorTickDivisions(minorTickDivisions : int)
Sets the minorTickDivisions field.

Parameters:

minorTickDivisionsthe new value for minorTickDivisions

setMinorTickLength

void setMinorTickLength(minorTickLength : int)
Sets the minorTickLength field.

Parameters:

minorTickLengththe new value for minorTickLength

setMinorTickPlacement

void setMinorTickPlacement(minorTickPlacement : String)
Sets the minorTickPlacement field.

Parameters:

minorTickPlacementthe new value for minorTickPlacement, one of {'none','inside','outside','cross'}

setMinorTickStroke

void setMinorTickStroke(minorTickStroke : String)
Sets the minorTickStroke field.

Parameters:

minorTickStrokethe new value for minorTickStroke

setShowAxis

void setShowAxis(showAxis : boolean)
Sets the showAxis field.

Parameters:

showAxisthe new value for showAxis

setShowLabels

void setShowLabels(showLabels : boolean)
Sets the showLabels field.

Parameters:

showLabelsthe new value for showLabels

setTickLength

void setTickLength(tickLength : int)
Sets the tickLength field.

Parameters:

tickLengththe new value for tickLength

setTickPlacement

void setTickPlacement(tickPlacement : String)
Sets the tickPlacement field.

Parameters:

tickPlacementthe new value for tickPlacement, one of {'none','inside','outside','cross'}

setTickStroke

void setTickStroke(tickStroke : String)
Sets the tickStroke field.

Parameters:

tickStrokethe new value for tickStroke