org.swtchart.internal.series
Class BarSeries

java.lang.Object
  extended by org.swtchart.internal.series.Series
      extended by 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.ISeries
ISeries.SeriesType
 
Field Summary
static 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
 
Constructor Summary
protected BarSeries(Chart chart, java.lang.String id)
          Constructor.
 
Method Summary
protected  void draw(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.
 Color getBarColor()
          Gets the bar color.
 int getBarPadding()
          Gets the bar padding in percentage.
 Rectangle[] getBounds()
          Gets the array of bar rectangles.
 void setBarColor(Color color)
          Sets the bar color.
 void setBarPadding(int padding)
          Sets the bar padding in percentage.
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, getId, getLabel, getPixelCoordinates, getRangeWithMargin, getType, getXAxisId, getXDateSeries, getXErrorBar, getXRange, getXSeries, getYAxisId, getYErrorBar, getYRange, getYSeries, isDateSeries, isStackEnabled, isValidStackSeries, isVisible, isVisibleInLegend, 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, getId, getLabel, getPixelCoordinates, getType, getXAxisId, getXDateSeries, getXErrorBar, getXSeries, getYAxisId, getYErrorBar, getYSeries, isStackEnabled, isVisible, isVisibleInLegend, setVisible, setVisibleInLegend, setXAxisId, setXDateSeries, setXSeries, setYAxisId, setYSeries
 

Field Detail

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 chart
id - the series id
Method Detail

getBarPadding

public int getBarPadding()
Description copied from interface: IBarSeries
Gets the bar padding in percentage.

Specified by:
getBarPadding in interface IBarSeries
Returns:
the bar padding in percentage

setBarPadding

public void setBarPadding(int padding)
Description copied from interface: IBarSeries
Sets the bar padding in percentage.

Specified by:
setBarPadding in interface IBarSeries
Parameters:
padding - the bar padding in percentage

getBarColor

public Color getBarColor()
Description copied from interface: IBarSeries
Gets the bar color.

Specified by:
getBarColor in interface IBarSeries
Returns:
the bar color

setBarColor

public void setBarColor(Color color)
Description copied from interface: IBarSeries
Sets the bar color. If null is given, default color will be set.

Specified by:
setBarColor in interface IBarSeries
Parameters:
color - the bar color

getBounds

public 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 interface IBarSeries
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 class Series

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 class Series
Parameters:
axis - the axis
length - the axis length in pixels
Returns:
the adjusted range

draw

protected void draw(GC gc,
                    int width,
                    int height,
                    Axis xAxis,
                    Axis yAxis)
Description copied from class: Series
Draws series.

Specified by:
draw in class Series
Parameters:
gc - the graphics context
width - the width to draw series
height - the height to draw series
xAxis - the x axis
yAxis - the y axis