Class RangeBarSeries


public class RangeBarSeries extends BarSeries

Floating bars that span from a start value to an end value: schedules, temperature ranges, price ranges. Combine with Chart.setRotated(true) for a timeline.

double[] lows = {4, 6, 9}, highs = {12, 15, 19};
new RangeBarSeries("Temperature").setRanges(null, lows, highs);

Range bars

  • Constructor Details

    • RangeBarSeries

      public RangeBarSeries(String name)

      Creates an empty series.

      Parameters
      • name: the series name
  • Method Details

    • auxDefault

      protected double auxDefault(int channel, double y)
      A range added by add(x, y) or setData starts at zero, so its bar spans 0..y.
      Overrides:
      auxDefault in class XYSeries
    • setRanges

      public RangeBarSeries setRanges(double[] x, double[] start, double[] end)

      Replaces all ranges.

      Parameters
      • x: the x value of each bar, or null for 0, 1, 2...

      • start: where each bar starts

      • end: where each bar ends

      Returns

      this series

    • addRange

      public RangeBarSeries addRange(double x, double start, double end)

      Appends one range.

      Parameters
      • x: the x value

      • start: the start value

      • end: the end value

      Returns

      this series

    • getStart

      public double getStart(int i)
      The start of range i.
    • getEnd

      public double getEnd(int i)
      The end of range i.
    • getBase

      public double getBase(int i)
      Description copied from class: XYSeries
      The base this series' point i rests on: 0, or the stacked sum of the earlier series in its group.
      Overrides:
      getBase in class XYSeries
    • 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 BarSeries
    • hasOwnBase

      protected boolean hasOwnBase()
      Description copied from class: XYSeries

      True for a series whose base is its own data (a range bar's start, a waterfall's running total) rather than a stack: it is drawn from that base but is no layer of a stack.

      Returns

      false by default

      Overrides:
      hasOwnBase in class XYSeries
    • targetBase

      protected double targetBase(int i)
      Description copied from class: XYSeries

      The base point i settles on once the running transition ends: the stack of the earlier layers weighted by the fraction each ends at, or XYSeries.getBase(int) outside a stack group. A series whose base is its own data (a range bar's start, a waterfall's running total) overrides this to answer that, so the tween ends exactly where the settled value is.

      • i: the point index
      Returns

      the settled base

      Overrides:
      targetBase 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 BarSeries
    • formatTooltip

      public String formatTooltip(ChartContext ctx, ChartPoint p)
      Description copied from class: Series

      The tooltip row for a point: the series or point name and its formatted value. Series with several values per point (open/high/low/close, ranges, box plots) override this.

      Parameters
      • ctx: the last paint context

      • p: the point

      Returns

      one line of text

      Overrides:
      formatTooltip in class Series
    • tableValue

      protected String tableValue(int i)
      Description copied from class: XYSeries

      The text of point i in the accessible data table.

      Parameters
      • i: the point index
      Returns

      the formatted value

      Overrides:
      tableValue in class XYSeries