Package org.swtchart.internal.series
Class SeriesLabel
java.lang.Object
org.swtchart.internal.series.SeriesLabel
- All Implemented Interfaces:
ISeriesLabel
A series label.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddraw(GC gc, int h, int v, double ySeriesValue, int seriesIndex, int alignment) Draws series label.FontgetFont()Gets the label font.ColorGets the label color.Gets the format for label.String[]Gets the formats for all data points.booleanGets the label visibility state.voidsetFont(Font font) Sets the label font.voidsetForeground(Color color) Sets the label color.voidSets the decimal formatDecimalFormator/plus plain string.voidsetFormats(String[] formats) Sets the formats for all data points.voidsetVisible(boolean visible) Sets the label visibility state.
-
Field Details
-
font
protected Font fontthe series label font -
color
protected Color colorthe series label color
-
-
Constructor Details
-
SeriesLabel
public SeriesLabel()Constructor.
-
-
Method Details
-
getFormat
Description copied from interface:ISeriesLabelGets the format for label.- Specified by:
getFormatin interfaceISeriesLabel- Returns:
- the format
-
setFormat
Description copied from interface:ISeriesLabelSets the decimal formatDecimalFormator/plus plain string.If formats have been set with setFormats(String[]), the format set with this method will be ignored.
If null is given, default format "#.###########" will be set.
- Specified by:
setFormatin interfaceISeriesLabel- Parameters:
format- the format
-
getFormats
Description copied from interface:ISeriesLabelGets the formats for all data points.- Specified by:
getFormatsin interfaceISeriesLabel- Returns:
- the formats, or empty array if not set
-
setFormats
Description copied from interface:ISeriesLabelSets the formats for all data points. If null or empty array is given, formats will be cleared, and the format set with setFormat(String) will be used instead.- Specified by:
setFormatsin interfaceISeriesLabel- Parameters:
formats- the formats
-
getForeground
public Color getForeground()Description copied from interface:ISeriesLabelGets the label color.- Specified by:
getForegroundin interfaceISeriesLabel- Returns:
- the label color
-
setForeground
public void setForeground(Color color) Description copied from interface:ISeriesLabelSets the label color. If null is given, default color will be set.- Specified by:
setForegroundin interfaceISeriesLabel- Parameters:
color- the label color
-
getFont
public Font getFont()Description copied from interface:ISeriesLabelGets the label font.- Specified by:
getFontin interfaceISeriesLabel- Returns:
- the label font
-
setFont
public void setFont(Font font) Description copied from interface:ISeriesLabelSets the label font.- Specified by:
setFontin interfaceISeriesLabel- Parameters:
font- the label font
-
isVisible
public boolean isVisible()Description copied from interface:ISeriesLabelGets the label visibility state.- Specified by:
isVisiblein interfaceISeriesLabel- Returns:
- true if label is visible
-
setVisible
public void setVisible(boolean visible) Description copied from interface:ISeriesLabelSets the label visibility state.- Specified by:
setVisiblein interfaceISeriesLabel- Parameters:
visible- the label visibility state
-
draw
protected void draw(GC gc, int h, int v, double ySeriesValue, int seriesIndex, int alignment) Draws series label.- Parameters:
gc- the GC objecth- the horizontal coordinate to draw labelv- the vertical coordinate to draw labelySeriesValue- the Y series valueseriesIndex- the series indexalignment- the alignment of label position (SWT.CENTER or SWT.BOTTOM)
-