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 intINITIAL_BAR_WIDTHthe initial bar width in pixelsstatic intINITIAL_PADDINGthe 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 voiddraw(org.eclipse.swt.graphics.GC gc, int width, int height, Axis xAxis, Axis yAxis)Draws series.RangegetAdjustedRange(Axis axis, int length)Gets the adjusted range to show all series in screen.org.eclipse.swt.graphics.ColorgetBarColor()Gets the bar color.intgetBarPadding()Gets the bar padding in percentage.intgetBarWidth()Gets the bar width in pixels.IBarSeries.BarWidthStylegetBarWidthStyle(IBarSeries.BarWidthStyle style)Gets the bar width style.org.eclipse.swt.graphics.Rectangle[]getBounds()Gets the array of bar rectangles.voidsetBarColor(org.eclipse.swt.graphics.Color color)Sets the bar color.voidsetBarPadding(int padding)Sets the bar padding in percentage.voidsetBarWidth(int width)Sets the bar width in pixels.voidsetBarWidthStyle(IBarSeries.BarWidthStyle style)Sets the bar width style.protected voidsetCompressor()Sets the compressor.protected voidsetRiserIndex(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:IBarSeriesGets the bar width style.- Specified by:
getBarWidthStylein interfaceIBarSeries- Parameters:
style- the bar width style- Returns:
- the bar width style
-
setBarWidthStyle
public void setBarWidthStyle(IBarSeries.BarWidthStyle style)
Description copied from interface:IBarSeriesSets the bar width style. The default is BarWidthStyle.STRETCHED .- Specified by:
setBarWidthStylein interfaceIBarSeries- Parameters:
style- the bar width style
-
getBarWidth
public int getBarWidth()
Description copied from interface:IBarSeriesGets the bar width in pixels.- Specified by:
getBarWidthin interfaceIBarSeries- Returns:
- the bar width in pixels
-
setBarWidth
public void setBarWidth(int width)
Description copied from interface:IBarSeriesSets the bar width in pixels. The specified bar width is active only when the bar width style is set to BarWidthStyle.FIXED.- Specified by:
setBarWidthin interfaceIBarSeries- Parameters:
width- the bar width in pixels
-
getBarPadding
public int getBarPadding()
Description copied from interface:IBarSeriesGets the bar padding in percentage.- Specified by:
getBarPaddingin interfaceIBarSeries- Returns:
- the bar padding in percentage
-
setBarPadding
public void setBarPadding(int padding)
Description copied from interface:IBarSeriesSets the bar padding in percentage. The specified padding is active only when the bar width style is set to BarWidthStyle.STRETCHED.- Specified by:
setBarPaddingin interfaceIBarSeries- Parameters:
padding- the bar padding in percentage
-
getBarColor
public org.eclipse.swt.graphics.Color getBarColor()
Description copied from interface:IBarSeriesGets the bar color.- Specified by:
getBarColorin interfaceIBarSeries- Returns:
- the bar color
-
setBarColor
public void setBarColor(org.eclipse.swt.graphics.Color color)
Description copied from interface:IBarSeriesSets the bar color. If null is given, default color will be set.- Specified by:
setBarColorin interfaceIBarSeries- Parameters:
color- the bar color
-
getBounds
public org.eclipse.swt.graphics.Rectangle[] getBounds()
Description copied from interface:IBarSeriesGets 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:
getBoundsin 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:SeriesSets the compressor.- Specified by:
setCompressorin classSeries
-
getAdjustedRange
public Range getAdjustedRange(Axis axis, int length)
Description copied from class:SeriesGets the adjusted range to show all series in screen. This range includes the size of plot like symbol or bar.- Specified by:
getAdjustedRangein classSeries- Parameters:
axis- the axislength- the axis length in pixels- Returns:
- the adjusted range
-
-