Package org.swtchart.internal.series
Class BarSeries
- java.lang.Object
-
- org.swtchart.internal.series.Series
-
- org.swtchart.internal.series.BarSeries
-
- All Implemented Interfaces:
IBarSeries
,ISeries
public class BarSeries extends Series implements IBarSeries
Bar series.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.swtchart.IBarSeries
IBarSeries.BarWidthStyle
-
Nested classes/interfaces inherited from interface org.swtchart.ISeries
ISeries.SeriesType
-
-
Field Summary
Fields Modifier and Type Field Description static int
INITIAL_BAR_WIDTH
the initial bar width in pixelsstatic int
INITIAL_PADDING
the initial bar padding in percentage-
Fields inherited from class org.swtchart.internal.series.Series
chart, compressor, DEFAULT_SERIES_TYPE, id, isXMonotoneIncreasing, maxX, maxY, minX, minY, seriesLabel, stackEnabled, stackSeries, type, visible, xAxisId, xErrorBar, xSeries, yAxisId, yErrorBar, ySeries
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
draw(org.eclipse.swt.graphics.GC gc, int width, int height, Axis xAxis, Axis yAxis)
Draws series.Range
getAdjustedRange(Axis axis, int length)
Gets the adjusted range to show all series in screen.org.eclipse.swt.graphics.Color
getBarColor()
Gets the bar color.int
getBarPadding()
Gets the bar padding in percentage.int
getBarWidth()
Gets the bar width in pixels.IBarSeries.BarWidthStyle
getBarWidthStyle(IBarSeries.BarWidthStyle style)
Gets the bar width style.org.eclipse.swt.graphics.Rectangle[]
getBounds()
Gets the array of bar rectangles.void
setBarColor(org.eclipse.swt.graphics.Color color)
Sets the bar color.void
setBarPadding(int padding)
Sets the bar padding in percentage.void
setBarWidth(int width)
Sets the bar width in pixels.void
setBarWidthStyle(IBarSeries.BarWidthStyle style)
Sets the bar width style.protected void
setCompressor()
Sets the compressor.protected void
setRiserIndex(int riserIndex)
Sets the index of riser in a category.-
Methods inherited from class org.swtchart.internal.series.Series
addDisposeListener, dispose, draw, enableStack, getCompressor, getDescription, getId, getLabel, getPixelCoordinates, getRangeWithMargin, getType, getXAxisId, getXDateSeries, getXErrorBar, getXRange, getXSeries, getYAxisId, getYErrorBar, getYRange, getYSeries, isDateSeries, isStackEnabled, isValidStackSeries, isVisible, isVisibleInLegend, setDescription, setStackSeries, setVisible, setVisibleInLegend, setXAxisId, setXDateSeries, setXSeries, setYAxisId, setYSeries
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.swtchart.ISeries
addDisposeListener, enableStack, getDescription, getId, getLabel, getPixelCoordinates, getType, getXAxisId, getXDateSeries, getXErrorBar, getXSeries, getYAxisId, getYErrorBar, getYSeries, isStackEnabled, isVisible, isVisibleInLegend, setDescription, setVisible, setVisibleInLegend, setXAxisId, setXDateSeries, setXSeries, setYAxisId, setYSeries
-
-
-
-
Field Detail
-
INITIAL_BAR_WIDTH
public static final int INITIAL_BAR_WIDTH
the initial bar width in pixels- See Also:
- Constant Field Values
-
INITIAL_PADDING
public static final int INITIAL_PADDING
the initial bar padding in percentage- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BarSeries
protected BarSeries(Chart chart, java.lang.String id)
Constructor.- Parameters:
chart
- the chartid
- the series id
-
-
Method Detail
-
getBarWidthStyle
public IBarSeries.BarWidthStyle getBarWidthStyle(IBarSeries.BarWidthStyle style)
Description copied from interface:IBarSeries
Gets the bar width style.- Specified by:
getBarWidthStyle
in interfaceIBarSeries
- Parameters:
style
- the bar width style- Returns:
- the bar width style
-
setBarWidthStyle
public void setBarWidthStyle(IBarSeries.BarWidthStyle style)
Description copied from interface:IBarSeries
Sets the bar width style. The default is BarWidthStyle.STRETCHED .- Specified by:
setBarWidthStyle
in interfaceIBarSeries
- Parameters:
style
- the bar width style
-
getBarWidth
public int getBarWidth()
Description copied from interface:IBarSeries
Gets the bar width in pixels.- Specified by:
getBarWidth
in interfaceIBarSeries
- Returns:
- the bar width in pixels
-
setBarWidth
public void setBarWidth(int width)
Description copied from interface:IBarSeries
Sets the bar width in pixels. The specified bar width is active only when the bar width style is set to BarWidthStyle.FIXED.- Specified by:
setBarWidth
in interfaceIBarSeries
- Parameters:
width
- the bar width in pixels
-
getBarPadding
public int getBarPadding()
Description copied from interface:IBarSeries
Gets the bar padding in percentage.- Specified by:
getBarPadding
in interfaceIBarSeries
- Returns:
- the bar padding in percentage
-
setBarPadding
public void setBarPadding(int padding)
Description copied from interface:IBarSeries
Sets the bar padding in percentage. The specified padding is active only when the bar width style is set to BarWidthStyle.STRETCHED.- Specified by:
setBarPadding
in interfaceIBarSeries
- Parameters:
padding
- the bar padding in percentage
-
getBarColor
public org.eclipse.swt.graphics.Color getBarColor()
Description copied from interface:IBarSeries
Gets the bar color.- Specified by:
getBarColor
in interfaceIBarSeries
- Returns:
- the bar color
-
setBarColor
public void setBarColor(org.eclipse.swt.graphics.Color color)
Description copied from interface:IBarSeries
Sets the bar color. If null is given, default color will be set.- Specified by:
setBarColor
in interfaceIBarSeries
- Parameters:
color
- the bar color
-
getBounds
public org.eclipse.swt.graphics.Rectangle[] getBounds()
Description copied from interface:IBarSeries
Gets the array of bar rectangles. This method is typically used for mouse listener to check whether mouse cursor is on bar.The returned array has the same size as data points. Depending on X axis range, some bars can be out of screen. In this case, the rectangles for invisible bars will be null in the returned array.
- Specified by:
getBounds
in interfaceIBarSeries
- Returns:
- the array of bar rectangles in pixels.
-
setRiserIndex
protected void setRiserIndex(int riserIndex)
Sets the index of riser in a category.- Parameters:
riserIndex
- the index of riser in a category
-
setCompressor
protected void setCompressor()
Description copied from class:Series
Sets the compressor.- Specified by:
setCompressor
in classSeries
-
getAdjustedRange
public Range getAdjustedRange(Axis axis, int length)
Description copied from class:Series
Gets the adjusted range to show all series in screen. This range includes the size of plot like symbol or bar.- Specified by:
getAdjustedRange
in classSeries
- Parameters:
axis
- the axislength
- the axis length in pixels- Returns:
- the adjusted range
-
-