Class WaterfallSeries
A waterfall (bridge) chart: each bar starts where the previous one ended, so a sequence of gains and losses reads as a running total. Total bars restart from zero and show the sum.
A total's value is always computed: it is the sum of the steps before it that are still in
the series, so set on a total bar is ignored, and once a setMaxPoints window slides the
oldest steps out a total sums only the steps that remain (the bridge must stay joined to
what is drawn). Which bars are totals is fixed by setSteps; setData keeps that marking
by position (row i stays a total if it was one) and new rows are plain steps, so replacing
the numbers of a bridge does not silently turn its totals into steps. To change the marking,
call setSteps again. A point added by add is always a plain step.
new WaterfallSeries("Profit").setSteps(new double[]{120, -30, -25, 40, 0}, new boolean[]{false, false, false, false, true});

-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doubleauxDefault(int channel, double y) A point added byaddis a plain step, never a total.protected intcolorAt(ChartContext ctx, int i) The fill colour of bari; the series colour unless a subclass colours bars by value.protected booleanTrue 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).protected voidRecomputes every base and total from the deltas, soset,addand a slide keep the bridge joined.formatTooltip(ChartContext ctx, ChartPoint p) The tooltip row for a point: the series or point name and its formatted value.doublegetBase(int i) The base this series' pointirests on: 0, or the stacked sum of the earlier series in its group.double[]The extent of the data along y,{min, max}, or null when empty or not cartesian.protected booleanTrue 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.booleanisTotal(int i) True when bariis a total.voidpaint(ChartContext ctx) Paints the series.setConnectors(boolean c) Shows or hides the thin lines joining each bar's end to the next bar's start.setData(double[] x, double[] y) Replaces the deltas, keeping which rows are totals by position: rowistays a total when it was one, and rows past the old size are plain steps.setSteps(double[] deltas, boolean[] isTotal) Replaces all steps.protected doubletargetBase(int i) The base pointisettles on once the running transition ends: the stack of the earlier layers weighted by the fraction each ends at, orXYSeries.getBase(int)outside a stack group.Methods inherited from class BarSeries
getXBounds, hitTest, setBarFraction, setCornerRadiusMethods inherited from class XYSeries
add, add, addRow, animatedAux, animatedBase, animatedY, captureEntryStart, captureTransitionStart, clear, collectTableRows, getAux, getMinXSpacing, getPoint, getPointCount, getStackGroup, getX, getXBoundsWithin, getY, isAscending, isAuxRelative, isCartesian, isGapAt, lowerBound, nearestIndexOfX, nearestScreenIndex, screenPosition, set, setMaxPoints, setRows, setStackGroup, setValues, size, tableValue, transitionEnded, visibleRangeMethods inherited from class Series
attached, detached, formatValue, getChart, getColor, getLegendEntryCount, getLegendEntryName, getName, getSelectablePointCount, getValueFormatter, getVisibilityFraction, handleTap, isGap, isLegendEntryVisible, isPointCountFromLayout, isSecondaryAxis, isShowValues, isVisible, lerp, paintLegendEntrySymbol, paintLegendSymbol, repaintChart, setColor, setName, setSecondaryAxis, setShowValues, setValueFormatter, setVisible, toggleLegendEntry
-
Constructor Details
-
WaterfallSeries
Creates an empty series.
Parameters
name: the series name
-
-
Method Details
-
setSteps
Replaces all steps.
Parameters
-
deltas: the change at each step; ignored for total bars -
isTotal: which bars show the running total instead of a change, or null for none
Returns
this series
-
-
setData
-
dataChanged
protected void dataChanged()Recomputes every base and total from the deltas, soset,addand a slide keep the bridge joined. A NaN delta is a gap: its bar is not drawn and the running total carries past it.- Overrides:
dataChangedin classXYSeries
-
setConnectors
Shows or hides the thin lines joining each bar's end to the next bar's start.
Parameters
c: true to draw connectors
Returns
this series
-
isTotal
public boolean isTotal(int i) True when bariis a total. -
auxDefault
protected double auxDefault(int channel, double y) A point added byaddis a plain step, never a total.- Overrides:
auxDefaultin classXYSeries
-
getBase
-
consumesStackBase
protected boolean consumesStackBase()Description copied from class:XYSeriesTrue 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:
consumesStackBasein classBarSeries
-
hasOwnBase
protected boolean hasOwnBase()Description copied from class:XYSeriesTrue 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:
hasOwnBasein classXYSeries
-
targetBase
protected double targetBase(int i) Description copied from class:XYSeriesThe base point
isettles on once the running transition ends: the stack of the earlier layers weighted by the fraction each ends at, orXYSeries.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:
targetBasein classXYSeries
-
getYBounds
public double[] getYBounds()Description copied from class:SeriesThe extent of the data along y,{min, max}, or null when empty or not cartesian.- Overrides:
getYBoundsin classBarSeries
-
colorAt
Description copied from class:BarSeriesThe 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
-
-
paint
Description copied from class:SeriesPaints the series.
Parameters
ctx: the current frame: graphics, plot area, axes and animation progress
-
formatTooltip
Description copied from class:SeriesThe 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:
formatTooltipin classSeries
-
-