org.faceless.graph2
Class Marker
java.lang.Object
org.faceless.graph2.AbstractMarker
org.faceless.graph2.Marker
public class Marker
- extends AbstractMarker
A Marker is simply a point marked on the graph with a symbol like a star or a circle.
Markers can be placed anywhere on a series using the Series.addMarker
method - a typical use would be to highlight points on a LineSeries
, like so:
LineSeries series = new LineSeries("Data");
for (int i=0;i<data.length;i++) {
series.set(data.x(), data.y());
Marker marker = new Marker("diamond", 15);
marker.setStyle(style);
series.addMarker(marker, data.x(), data.y());
}
Markers can also be added to the Key using the addCustom
method, or
a MarkerAxis
can be used to draw markers directly onto an axis.
The Graph Library is supplied with several predefined markers, including
square | A square |
diamond | A diamond-shape |
circle | A circle |
star | A five-pointed star |
plus | A plus-sign |
cross | An "x" or diagonal cross |
In addition the marker flag.XX
can be used to display the national flag for
the specified country. "XX" is the two letter country code, eg. "US", "NZ", "CA", "DE"
(the United Kingdom uses "UK"). Additionally flag.EU
can be used as well.
- See Also:
Series.addMarker
,
Key.addCustom
,
MarkerAxis
Constructor Summary |
Marker(String type,
double size)
Create a new Marker. |
Method Summary |
void |
setRotate(double rotate)
Set the rotation of this marker around its center, in degrees clockwise |
void |
setStyle(Style style)
Set the style of this marker. |
String |
toString()
|
Marker
public Marker(String type,
double size)
- Create a new Marker. The shape of the marker is defined by it's type, which
is name of a
ResourceBundle
representing the shape of the marker. See this
classes API docs for more information.
- Parameters:
type
- the type of Markersize
- the size of the marker in pixels, points or whatever the native unit of your Output
class is
setRotate
public void setRotate(double rotate)
- Set the rotation of this marker around its center, in degrees clockwise
- Parameters:
rotate
- how far to rotate the marker. The default is 0.
setStyle
public void setStyle(Style style)
- Set the style of this marker. For uncolored markers like "square", "circle" etc.,
this method may be called to change the color of a specific marker. If not set,
the color defaults to the series color. For colored markers like flags, this method
can optionally set a border color around the marker, but the main color is ignored.
- Parameters:
style
- the style to draw the marker in
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2001-2011 Big Faceless Organization