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.
  • Field Details

    • INITIAL_BAR_WIDTH

      public static final int INITIAL_BAR_WIDTH
      the initial bar width in pixels
      See Also:
    • INITIAL_PADDING

      public static final int INITIAL_PADDING
      the initial bar padding in percentage
      See Also:
  • Constructor Details

    • BarSeries

      protected BarSeries(Chart chart, String id)
      Constructor.
      Parameters:
      chart - the chart
      id - the series id
  • Method Details

    • getBarWidthStyle

      public IBarSeries.BarWidthStyle getBarWidthStyle(IBarSeries.BarWidthStyle style)
      Description copied from interface: IBarSeries
      Gets the bar width style.
      Specified by:
      getBarWidthStyle in interface IBarSeries
      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 interface IBarSeries
      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 interface IBarSeries
      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 interface IBarSeries
      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 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. The specified padding is active only when the bar width style is set to BarWidthStyle.STRETCHED.
      Specified by:
      setBarPadding in interface IBarSeries
      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 interface IBarSeries
      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 interface IBarSeries
      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 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(org.eclipse.swt.graphics.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