Browse Components

Waterfall

Explain changes from an opening value to a final total.

Basic

Hover, tap or focus a mark to inspect exact values. Arrow keys move between observations.

Monthly balance
Monthly balance — example data
ObservationChange
Opening120
Sales75
Services32
Payroll-58
Tools-14
Tax-22
View Code
HTML
<figure class="chart" data-chart="waterfall">
  <figcaption>
    Monthly balance
  </figcaption>
  <div class="chart-data">
    <table>
      <caption>
        Monthly balance — example data
      </caption>
      <thead>
        <tr>
          <th scope="col">
            Observation
          </th>
          <th scope="col">
            Change
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">
            Opening
          </th>
          <td>
            120
          </td>
        </tr>
        <tr>
          <th scope="row">
            Sales
          </th>
          <td>
            75
          </td>
        </tr>
        <tr>
          <th scope="row">
            Services
          </th>
          <td>
            32
          </td>
        </tr>
        <tr>
          <th scope="row">
            Payroll
          </th>
          <td>
            -58
          </td>
        </tr>
        <tr>
          <th scope="row">
            Tools
          </th>
          <td>
            -14
          </td>
        </tr>
        <tr>
          <th scope="row">
            Tax
          </th>
          <td>
            -22
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</figure>

Right-to-left

Labels follow the reading direction. Numeric and radial axes keep their established orientation.

Monthly balance
Monthly balance — example data
ObservationChange
Opening120
Sales75
Services32
Payroll-58
Tools-14
Tax-22
View Code
HTML
<figure class="chart" dir="rtl" data-chart="waterfall">
  <figcaption>
    Monthly balance
  </figcaption>
  <div class="chart-data">
    <table>
      <caption>
        Monthly balance — example data
      </caption>
      <thead>
        <tr>
          <th scope="col">
            Observation
          </th>
          <th scope="col">
            Change
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">
            Opening
          </th>
          <td>
            120
          </td>
        </tr>
        <tr>
          <th scope="row">
            Sales
          </th>
          <td>
            75
          </td>
        </tr>
        <tr>
          <th scope="row">
            Services
          </th>
          <td>
            32
          </td>
        </tr>
        <tr>
          <th scope="row">
            Payroll
          </th>
          <td>
            -58
          </td>
        </tr>
        <tr>
          <th scope="row">
            Tools
          </th>
          <td>
            -14
          </td>
        </tr>
        <tr>
          <th scope="row">
            Tax
          </th>
          <td>
            -22
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</figure>

Empty data

The chart keeps its reserved space without inventing observations.

Monthly balance
Monthly balance — example data
ObservationChange
View Code
HTML
<figure
  class="chart"
  data-chart-labels="[&quot;Opening&quot;, &quot;Sales&quot;, &quot;Services&quot;, &quot;Payroll&quot;, &quot;Tools&quot;, &quot;Tax&quot;]"
  data-chart="waterfall"
>
  <figcaption>
    Monthly balance
  </figcaption>
  <div class="chart-data">
    <table>
      <caption>
        Monthly balance — example data
      </caption>
      <thead>
        <tr>
          <th scope="col">
            Observation
          </th>
          <th scope="col">
            Change
          </th>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>
  </div>
</figure>

Installation

Download these files into the matching paths in your project, or use Create to assemble a kit. Include each dependency once. Do not also load app.css.

Add to your page
<link rel="stylesheet" href="/library/assets/base.css">
<link rel="stylesheet" href="/library/assets/chart-core.css">
<link rel="stylesheet" href="/library/assets/chart-plots.css">
<link rel="stylesheet" href="/library/assets/waterfall-chart.css">
<script defer src="/library/assets/chart-core.js"></script>
<script defer src="/library/assets/chart-plots.js"></script>
<script defer src="/library/assets/waterfall-chart.js"></script>

12,194 bytes CSS including base · 16,484 bytes runtime JavaScript

Usage

Data format

One column of signed changes, including the opening balance as the first change. The final Total is calculated automatically; do not add a total row to the table. Connectors show intermediate balances. Positive, negative and total bars use distinct series colors.

Shared interactions

Hover, tap or focus a mark to inspect its exact value. Arrow keys, Home and End move between marks; Escape dismisses the tooltip. The source table remains available without JavaScript. Enhanced charts expose exact values through accessible marks and tooltips.

Lifecycle and themes

Load Chart Core, Chart Plots and this component module. Theme tokens supply colors in light and dark modes. Use layoutCharts.refresh(root) after changing the table and destroy(root) before unmounting. Wide charts scroll within their frame.

Building with AI? The AI Manifest has these notes and the full contract. See the AI Guide.