public class BarSeries extends Series implements IBarSeries
IBarSeries.BarWidthStyle
ISeries.SeriesType
Modifier and Type | Field and Description |
---|---|
private static int |
ALPHA
the alpha value
|
private org.eclipse.swt.graphics.Color |
barColor
the riser color
|
private int |
barWidth
the bar width
|
private IBarSeries.BarWidthStyle |
barWidthStyle
the bar width style
|
private static int |
DEFAULT_BAR_COLOR
the default bar color
|
static int |
INITIAL_BAR_WIDTH
the initial bar width in pixels
|
static int |
INITIAL_PADDING
the initial bar padding in percentage
|
private static int |
MARGIN_AT_MIN_MAX_PLOT
the margin in pixels attached at the minimum/maximum plot
|
private int |
padding
the padding
|
private int |
riserIndex
the riser index in a category
|
chart, compressor, DEFAULT_SERIES_TYPE, id, isXMonotoneIncreasing, maxX, maxY, minX, minY, seriesLabel, stackEnabled, stackSeries, type, visible, xAxisId, xErrorBar, xSeries, yAxisId, yErrorBar, ySeries
Modifier | Constructor and Description |
---|---|
protected |
BarSeries(Chart chart,
java.lang.String id)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
draw(org.eclipse.swt.graphics.GC gc,
int width,
int height,
Axis xAxis,
Axis yAxis)
Draws series.
|
private void |
drawRiser(org.eclipse.swt.graphics.GC gc,
int h,
int v,
int width,
int height)
Draws riser.
|
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.
|
private org.eclipse.swt.graphics.Rectangle[] |
getBoundsForCompressedSeries()
Gets the array of bar rectangles for compressed series.
|
private static org.eclipse.swt.graphics.Color |
getFrameColor(org.eclipse.swt.graphics.Color color)
Gets the color for riser frame.
|
private int |
getRiserWidth(double[] series,
int index,
Axis xAxis,
double min,
double max)
Gets the riser width.
|
private org.eclipse.swt.graphics.Rectangle |
getVisibleRectangle(int x,
int y,
int width,
int height)
Gets the rectangle that is visible part of given rectangle.
|
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.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
private int riserIndex
private org.eclipse.swt.graphics.Color barColor
private int barWidth
private int padding
private IBarSeries.BarWidthStyle barWidthStyle
public static final int INITIAL_BAR_WIDTH
public static final int INITIAL_PADDING
private static final int ALPHA
private static final int MARGIN_AT_MIN_MAX_PLOT
private static final int DEFAULT_BAR_COLOR
protected BarSeries(Chart chart, java.lang.String id)
chart
- the chartid
- the series idpublic IBarSeries.BarWidthStyle getBarWidthStyle(IBarSeries.BarWidthStyle style)
IBarSeries
getBarWidthStyle
in interface IBarSeries
style
- the bar width stylepublic void setBarWidthStyle(IBarSeries.BarWidthStyle style)
IBarSeries
setBarWidthStyle
in interface IBarSeries
style
- the bar width stylepublic int getBarWidth()
IBarSeries
getBarWidth
in interface IBarSeries
public void setBarWidth(int width)
IBarSeries
setBarWidth
in interface IBarSeries
width
- the bar width in pixelspublic int getBarPadding()
IBarSeries
getBarPadding
in interface IBarSeries
public void setBarPadding(int padding)
IBarSeries
setBarPadding
in interface IBarSeries
padding
- the bar padding in percentagepublic org.eclipse.swt.graphics.Color getBarColor()
IBarSeries
getBarColor
in interface IBarSeries
public void setBarColor(org.eclipse.swt.graphics.Color color)
IBarSeries
setBarColor
in interface IBarSeries
color
- the bar colorpublic org.eclipse.swt.graphics.Rectangle[] getBounds()
IBarSeries
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.
getBounds
in interface IBarSeries
private org.eclipse.swt.graphics.Rectangle[] getBoundsForCompressedSeries()
private org.eclipse.swt.graphics.Rectangle getVisibleRectangle(int x, int y, int width, int height)
x
- The x coordinatey
- The y coordinatewidth
- the widthheight
- The heightprotected void setRiserIndex(int riserIndex)
riserIndex
- the index of riser in a categoryprotected void setCompressor()
Series
setCompressor
in class Series
public Range getAdjustedRange(Axis axis, int length)
Series
getAdjustedRange
in class Series
axis
- the axislength
- the axis length in pixelsprivate int getRiserWidth(double[] series, int index, Axis xAxis, double min, double max)
series
- the X seriesindex
- the series indexxAxis
- the X axismin
- the min value of rangemax
- the max value of rangeprivate static org.eclipse.swt.graphics.Color getFrameColor(org.eclipse.swt.graphics.Color color)
color
- the riser colorprotected void draw(org.eclipse.swt.graphics.GC gc, int width, int height, Axis xAxis, Axis yAxis)
Series
private void drawRiser(org.eclipse.swt.graphics.GC gc, int h, int v, int width, int height)
gc
- the graphics contexth
- the horizontal coordinatev
- the vertical coordinatewidth
- the riser widthheight
- the riser height