public class StaticLabelsFormatter extends java.lang.Object implements LabelFormatter
| Modifier and Type | Field and Description |
|---|---|
protected LabelFormatter |
mDynamicLabelFormatter
the label formatter that will format the labels
for that there are no static labels defined.
|
protected GraphView |
mGraphView
reference to the graphview
|
protected java.lang.String[] |
mHorizontalLabels
the horizontal labels, ordered form the left to the right
if it is null, the labels will be generated via the #dynamicLabelFormatter
|
protected java.lang.String[] |
mVerticalLabels
the vertical labels, ordered from bottom to the top
if it is null, the labels will be generated via the #dynamicLabelFormatter
|
protected Viewport |
mViewport
reference to the viewport
|
| Constructor and Description |
|---|
StaticLabelsFormatter(GraphView graphView)
creates the formatter without any static labels
define your static labels via
setHorizontalLabels(String[]) and setVerticalLabels(String[]) |
StaticLabelsFormatter(GraphView graphView,
LabelFormatter dynamicLabelFormatter)
creates the formatter without any static labels.
|
StaticLabelsFormatter(GraphView graphView,
java.lang.String[] horizontalLabels,
java.lang.String[] verticalLabels)
creates the formatter with static labels defined.
|
StaticLabelsFormatter(GraphView graphView,
java.lang.String[] horizontalLabels,
java.lang.String[] verticalLabels,
LabelFormatter dynamicLabelFormatter)
creates the formatter with static labels defined.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
adjust()
adjusts the number of vertical/horizontal labels
|
java.lang.String |
formatLabel(double value,
boolean isValueX)
converts a raw number as input to
a formatted string for the label.
|
protected void |
init(java.lang.String[] horizontalLabels,
java.lang.String[] verticalLabels,
LabelFormatter dynamicLabelFormatter) |
void |
setDynamicLabelFormatter(LabelFormatter dynamicLabelFormatter)
Set a label formatter that will be used for the labels
that don't have static labels.
|
void |
setHorizontalLabels(java.lang.String[] horizontalLabels) |
void |
setVerticalLabels(java.lang.String[] verticalLabels) |
void |
setViewport(Viewport viewport)
will be called in order to have a
reference to the current viewport.
|
protected Viewport mViewport
protected java.lang.String[] mVerticalLabels
protected java.lang.String[] mHorizontalLabels
protected LabelFormatter mDynamicLabelFormatter
protected final GraphView mGraphView
public StaticLabelsFormatter(GraphView graphView)
setHorizontalLabels(String[]) and setVerticalLabels(String[])graphView - reference to the graphviewpublic StaticLabelsFormatter(GraphView graphView, LabelFormatter dynamicLabelFormatter)
setHorizontalLabels(String[]) and setVerticalLabels(String[])graphView - reference to the graphviewdynamicLabelFormatter - the label formatter that will format the labels
for that there are no static labels defined.public StaticLabelsFormatter(GraphView graphView, java.lang.String[] horizontalLabels, java.lang.String[] verticalLabels)
graphView - reference to the graphviewhorizontalLabels - the horizontal labels, ordered form the left to the right
if it is null, the labels will be generated via the #dynamicLabelFormatterverticalLabels - the vertical labels, ordered from bottom to the top
if it is null, the labels will be generated via the #dynamicLabelFormatterpublic StaticLabelsFormatter(GraphView graphView, java.lang.String[] horizontalLabels, java.lang.String[] verticalLabels, LabelFormatter dynamicLabelFormatter)
graphView - reference to the graphviewhorizontalLabels - the horizontal labels, ordered form the left to the right
if it is null, the labels will be generated via the #dynamicLabelFormatterverticalLabels - the vertical labels, ordered from bottom to the top
if it is null, the labels will be generated via the #dynamicLabelFormatterdynamicLabelFormatter - the label formatter that will format the labels
for that there are no static labels defined.protected void init(java.lang.String[] horizontalLabels,
java.lang.String[] verticalLabels,
LabelFormatter dynamicLabelFormatter)
horizontalLabels - the horizontal labels, ordered form the left to the right
if it is null, the labels will be generated via the #dynamicLabelFormatterverticalLabels - the vertical labels, ordered from bottom to the top
if it is null, the labels will be generated via the #dynamicLabelFormatterdynamicLabelFormatter - the label formatter that will format the labels
for that there are no static labels defined.public void setDynamicLabelFormatter(LabelFormatter dynamicLabelFormatter)
dynamicLabelFormatter - the label formatter that will format the labels
for that there are no static labels defined.public void setHorizontalLabels(java.lang.String[] horizontalLabels)
horizontalLabels - the horizontal labels, ordered form the left to the right
if it is null, the labels will be generated via the #dynamicLabelFormatterpublic void setVerticalLabels(java.lang.String[] verticalLabels)
verticalLabels - the vertical labels, ordered from bottom to the top
if it is null, the labels will be generated via the #dynamicLabelFormatterpublic java.lang.String formatLabel(double value,
boolean isValueX)
LabelFormatterformatLabel in interface LabelFormattervalue - raw input numberisValueX - true if it is a value for the x axis
false if it is a value for the y axispublic void setViewport(Viewport viewport)
LabelFormatterLabelFormatter.formatLabel(double, boolean)
method.setViewport in interface LabelFormatterviewport - the used viewportprotected void adjust()