Class BarSeries

Direct Known Subclasses:
HistogramSeries, RangeBarSeries, VolumeSeries, WaterfallSeries

public class BarSeries extends XYSeries

Vertical columns, or horizontal bars when the chart is rotated. Several bar series side by side form groups; bar series sharing a stack group stack instead.

Grouped bars Stacked bars Horizontal bars

  • Constructor Details

    • BarSeries

      public BarSeries(String name)

      Creates an empty bar series.

      Parameters
      • name: the legend name
    • BarSeries

      protected BarSeries(String name, int auxChannels)

      Creates a bar series that keeps extra values per bar, for range and waterfall bars.

      Parameters
      • name: the series name

      • auxChannels: number of extra values per bar

  • Method Details

    • setBarFraction

      public BarSeries setBarFraction(float f)
      The share of each category band the bar group fills, 0.1 to 1.
    • setCornerRadius

      public BarSeries setCornerRadius(float mm)
      The radius of the bar's outer corners in millimetres; 0 for square bars.
    • consumesStackBase

      protected boolean consumesStackBase()
      Description copied from class: XYSeries

      True for a series drawn on its stack base (an area or a bar), which a stack group lifts and whose layer shrinks with the fraction it is shown while it fades; false for marks that keep their own values (scatter, error bars, candles, boxes).

      Returns

      false by default

      Overrides:
      consumesStackBase in class XYSeries
    • getYBounds

      public double[] getYBounds()
      Description copied from class: Series
      The extent of the data along y, {min, max}, or null when empty or not cartesian.
      Overrides:
      getYBounds in class XYSeries
    • getXBounds

      public double[] getXBounds()
      Description copied from class: Series
      The extent of the data along x, {min, max}, or null when empty or not cartesian.
      Overrides:
      getXBounds in class XYSeries
    • paint

      public void paint(ChartContext ctx)
      Description copied from class: Series

      Paints the series.

      Parameters
      • ctx: the current frame: graphics, plot area, axes and animation progress
      Specified by:
      paint in class Series
    • colorAt

      protected int colorAt(ChartContext ctx, int i)

      The fill colour of bar i; the series colour unless a subclass colours bars by value.

      Parameters
      • ctx: the paint context

      • i: the bar index

      Returns

      an RGB colour

    • hitTest

      public ChartPoint hitTest(ChartContext ctx, int x, int y, int radius)
      Description copied from class: Series

      Finds the data point nearest a screen position.

      Parameters
      • ctx: the frame the series was last painted in

      • x: chart relative x

      • y: chart relative y

      • radius: how far from the point a touch may land and still hit it

      Returns

      the point, or null

      Overrides:
      hitTest in class XYSeries