Waterfall

Waterfall Charts are Categorical charts which display the cumulative effect of sequentially introduced positive or negative values.

Basic Usage

The following example demonstrates the Waterfall Chart in action.

import React from 'react';
import ReactDOM from 'react-dom';

import {
    Chart,
    ChartTitle,
    ChartValueAxis,
    ChartValueAxisItem,
    ChartSeries,
    ChartSeriesItem,
    ChartSeriesLabels
} from '@progress/kendo-react-charts';

import data from './waterfall-data.json';

const pointColor = (point) => {
    let summary = point.dataItem.summary;

    if (summary) {
        return summary === 'total' ? '#555' : 'gray';
    }

    if (point.value > 0) {
        return 'green';
    } else {
        return 'red';
    }
};

const ChartContainer = () => (
    <Chart>
        <ChartTitle text="Cash flow" />
        <ChartSeries>
            <ChartSeriesItem
                type="waterfall"
                data={data}
                color={pointColor}
                field="amount"
                categoryField="period"
                summaryField="summary"
            >
                <ChartSeriesLabels format="C0" position="insideEnd" />
            </ChartSeriesItem>
        </ChartSeries>
        <ChartValueAxis>
            <ChartValueAxisItem title={{ format: 'C0' }} />
        </ChartValueAxis>
    </Chart>
);

ReactDOM.render(
    <ChartContainer />,
    document.querySelector('my-app')
);
[{
    "period": "Beginning\\nBalance",
    "amount": 50000
  }, {
    "period": "Jan",
    "amount": 17000
  }, {
    "period": "Feb",
    "amount": 14000
  }, {
    "period": "Mar",
    "amount": -12000
  }, {
    "period": "Q1",
    "summary": "runningTotal"
  }, {
    "period": "Apr",
    "amount": -22000
  }, {
    "period": "May",
    "amount": -18000
  }, {
    "period": "Jun",
    "amount": 10000
  }, {
    "period": "Q2",
    "summary": "runningTotal"
  }, {
    "period": "Ending\\nBalance",
    "summary": "total"
  }]

In this article