M
- the data type of the axisV
- the variable type of axispublic abstract class Axis<M,V> extends Object implements AxisHandler.HasAxisHandlers, AxisItemOutEvent.HasAxisItemOutHandlers, AxisItemOverEvent.HasAxisItemOverHandlers, AxisSelectionEvent.HasAxisSelectionHandlers, AxisItemUpEvent.HasAxisItemUpHandlers
Modifier and Type | Field and Description |
---|---|
protected PathSprite |
axisConfig |
protected PreciseRectangle |
bbox |
protected Chart<M> |
chart |
protected boolean |
displayGrid |
protected double |
from |
protected boolean |
hidden |
protected TextSprite |
labelConfig |
protected List<V> |
labelNames |
protected LabelProvider<? super V> |
labelProvider |
protected SpriteList<TextSprite> |
labels |
protected int |
lastIndex |
protected SpriteList<PathSprite> |
lines |
protected int |
steps |
protected TextSprite |
titleConfig |
protected TextSprite |
titleSprite |
protected double |
to |
protected ToolTip |
toolTip |
protected AxisToolTipConfig<M> |
toolTipConfig |
protected double |
x |
protected double |
y |
Constructor and Description |
---|
Axis()
Create an axis.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addAxisHandler(AxisHandler handler)
Adds a
AxisHandler handler for AxisSelectionEvent ,
AxisItemOutEvent , AxisItemOverEvent and
AxisItemUpEvent events. |
HandlerRegistration |
addAxisItemOutHandler(AxisItemOutEvent.AxisItemOutHandler handler)
Adds a
AxisItemOutEvent.AxisItemOutHandler handler for AxisItemOutEvent
events. |
HandlerRegistration |
addAxisItemOverHandler(AxisItemOverEvent.AxisItemOverHandler handler)
Adds a
AxisItemOverEvent.AxisItemOverHandler handler for AxisItemOverEvent
events. |
HandlerRegistration |
addAxisItemUpHandler(AxisItemUpEvent.AxisItemUpHandler handler)
Adds a
AxisItemUpEvent.AxisItemUpHandler handler for AxisItemUpEvent
events. |
HandlerRegistration |
addAxisSelectionHandler(AxisSelectionEvent.AxisSelectionHandler handler)
Adds a
AxisSelectionEvent.AxisSelectionHandler handler for
AxisSelectionEvent events. |
void |
clear()
Removes all the sprites of the axis from the surface.
|
abstract void |
drawAxis(boolean init)
Renders the axis into the screen and updates it's position.
|
abstract void |
drawLabels()
Renders the labels in the axes.
|
protected HandlerManager |
ensureHandlers() |
PathSprite |
getAxisConfig()
Returns the configuration for the axis lines.
|
PreciseRectangle |
getBBox()
Returns the bounding box of the axis.
|
Chart<M> |
getChart()
Returns the chart that the axis is currently attached.
|
double |
getFrom()
Returns the starting value of the axis.
|
TextSprite |
getLabelConfig()
Returns the configuration for labels on the axis.
|
LabelProvider<? super V> |
getLabelProvider()
Returns the
LabelProvider used to provide labels displayed on the
axis. |
abstract Chart.Position |
getPosition()
Returns the
Chart.Position of the axis. |
TextSprite |
getTitleConfig()
Returns the configuration of the title.
|
double |
getTo()
Returns the ending value of the axis.
|
double |
getX()
Returns the x-coordinate of the axis.
|
double |
getY()
Returns the y-coordinate of the axis.
|
boolean |
isDisplayGrid()
Returns whether or not the axis has a grid.
|
boolean |
isHidden()
Returns whether or not the axis is hidden.
|
void |
onMouseDown(PrecisePoint point,
Event event)
Method used when the axis is clicked.
|
int |
onMouseMove(PrecisePoint point,
Event event)
Method used when the axis is moused over.
|
void |
onMouseOut(PrecisePoint point,
Event event)
Method used when the mouse leaves the axis.
|
void |
onMouseUp(PrecisePoint point,
Event event)
Method used when the mouse is released over the axis.
|
void |
removeToolTip()
Removes the components tooltip (if one exists).
|
void |
setAxisConfig(PathSprite axisConfig)
Sets the configuration for the axis lines.
|
void |
setChart(Chart<M> chart)
Sets the chart that the axis is attached.
|
void |
setDisplayGrid(boolean displayGrid)
Sets whether or not the axis has a grid.
|
void |
setHidden(boolean hidden)
Sets whether or not the axis is hidden.
|
void |
setLabelConfig(TextSprite labelConfig)
Sets the configuration for labels on the axis.
|
void |
setLabelProvider(LabelProvider<? super V> labelProvider)
Sets the
LabelProvider used to provide labels displayed on the
axis. |
void |
setTitleConfig(TextSprite titleConfig)
Sets the configuration of the title.
|
void |
setToolTipConfig(AxisToolTipConfig<M> config)
Sets the tooltip configuration.
|
void |
setX(double x)
Sets the x-coordinate of the axis.
|
void |
setY(double y)
Sets the y-coordinate of the axis.
|
protected int steps
protected boolean displayGrid
protected boolean hidden
protected double x
protected double y
protected double from
protected double to
protected PreciseRectangle bbox
protected PathSprite axisConfig
protected SpriteList<PathSprite> lines
protected TextSprite titleSprite
protected TextSprite titleConfig
protected ToolTip toolTip
protected AxisToolTipConfig<M> toolTipConfig
protected int lastIndex
protected TextSprite labelConfig
protected SpriteList<TextSprite> labels
protected LabelProvider<? super V> labelProvider
public HandlerRegistration addAxisHandler(AxisHandler handler)
AxisHandler.HasAxisHandlers
AxisHandler
handler for AxisSelectionEvent
,
AxisItemOutEvent
, AxisItemOverEvent
and
AxisItemUpEvent
events.addAxisHandler
in interface AxisHandler.HasAxisHandlers
handler
- the handlerpublic HandlerRegistration addAxisItemOutHandler(AxisItemOutEvent.AxisItemOutHandler handler)
AxisItemOutEvent.HasAxisItemOutHandlers
AxisItemOutEvent.AxisItemOutHandler
handler for AxisItemOutEvent
events.addAxisItemOutHandler
in interface AxisItemOutEvent.HasAxisItemOutHandlers
handler
- the handlerpublic HandlerRegistration addAxisItemOverHandler(AxisItemOverEvent.AxisItemOverHandler handler)
AxisItemOverEvent.HasAxisItemOverHandlers
AxisItemOverEvent.AxisItemOverHandler
handler for AxisItemOverEvent
events.addAxisItemOverHandler
in interface AxisItemOverEvent.HasAxisItemOverHandlers
handler
- the handlerpublic HandlerRegistration addAxisSelectionHandler(AxisSelectionEvent.AxisSelectionHandler handler)
AxisSelectionEvent.HasAxisSelectionHandlers
AxisSelectionEvent.AxisSelectionHandler
handler for
AxisSelectionEvent
events.addAxisSelectionHandler
in interface AxisSelectionEvent.HasAxisSelectionHandlers
handler
- the handlerpublic HandlerRegistration addAxisItemUpHandler(AxisItemUpEvent.AxisItemUpHandler handler)
AxisItemUpEvent.HasAxisItemUpHandlers
AxisItemUpEvent.AxisItemUpHandler
handler for AxisItemUpEvent
events.addAxisItemUpHandler
in interface AxisItemUpEvent.HasAxisItemUpHandlers
handler
- the handlerpublic void clear()
public abstract void drawAxis(boolean init)
init
- true if the initial draw callpublic abstract void drawLabels()
public PathSprite getAxisConfig()
public PreciseRectangle getBBox()
public Chart<M> getChart()
public double getFrom()
public TextSprite getLabelConfig()
public LabelProvider<? super V> getLabelProvider()
LabelProvider
used to provide labels displayed on the
axis.public abstract Chart.Position getPosition()
Chart.Position
of the axis.public TextSprite getTitleConfig()
public double getTo()
public double getX()
public double getY()
public boolean isDisplayGrid()
public boolean isHidden()
public void onMouseDown(PrecisePoint point, Event event)
point
- the point clickedevent
- the event being handledpublic int onMouseMove(PrecisePoint point, Event event)
point
- the point moused overevent
- the event being handledpublic void onMouseOut(PrecisePoint point, Event event)
point
- the point leftevent
- the event being handledpublic void onMouseUp(PrecisePoint point, Event event)
point
- the point clickedevent
- the event being handledpublic void removeToolTip()
public void setAxisConfig(PathSprite axisConfig)
axisConfig
- the configuration for the axis linespublic void setChart(Chart<M> chart)
chart
- the chart that the axis is attachedpublic void setDisplayGrid(boolean displayGrid)
displayGrid
- true if gridpublic void setHidden(boolean hidden)
hidden
- true if hiddenpublic void setLabelConfig(TextSprite labelConfig)
labelConfig
- the configuration for labels on the axispublic void setLabelProvider(LabelProvider<? super V> labelProvider)
LabelProvider
used to provide labels displayed on the
axis.labelProvider
- the label provider used to provide labels displayed on
the axispublic void setTitleConfig(TextSprite titleConfig)
titleConfig
- the configuration of the titlepublic void setToolTipConfig(AxisToolTipConfig<M> config)
config
- the tooltip configurationpublic void setX(double x)
x
- the x-coordinate of the axispublic void setY(double y)
y
- the y-coordinate of the axisprotected HandlerManager ensureHandlers()
Copyright © 2018. All rights reserved.