Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To verify a waterfall chart, recompute its running balance from the CSV’s ordered change rows, then compare that independent result with each recorded checkpoint and the chart’s final total. Parse the CSV correctly first: a quoting or column-mapping mistake can produce incorrect arithmetic from otherwise valid JavaScript.

What the arithmetic should represent

A waterfall chart shows sequential positive or negative changes as cumulative columns. Start with the stated opening balance; add each signed change in source-row order. The resulting sequence—not the chart’s rendered bars—is the independent reference for checking intermediate values and the ending balance. Highcharts describes the chart as one that “displays sequentially introduced positive or negative values in cumulative columns” in its waterfall API documentation.

Before calculating, identify the chart library and version, the CSV columns used for labels and values, the opening balance, units, sign convention, and which rows represent changes versus summaries. Do not assume Highcharts summary-point behavior applies to another chart library.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Parse and validate the CSV before calculating

Use a CSV parser that supports the file’s delimiter, quoting, and newline conventions. Splitting each line on commas is unsafe when a quoted field can contain a comma or line break. Highcharts’ Data module can load CSV text or a URL and map columns to series options, but its built-in parser does not cover every CSV variant; see the Highcharts Data module guide and the Highcharts Stock data.csv reference. The latter points to external parsing, such as Papa Parse, for cases requiring broader CSV support.

  • Preserve the original row order; do not sort by label or value.
  • Check that each required label and numeric field is present.
  • Keep an empty value distinct from zero, and reject non-finite numbers.
  • Establish whether values are already signed. Do not turn a negative change positive or negate it a second time.
  • Record any rounding or currency conversion applied before comparison.

Parsing and arithmetic are separate checks: correct running-total code cannot compensate for reading the wrong column or interpreting a quoted field incorrectly.

Recompute every running balance

  1. Set the initial balance to the opening value documented for the chart. If there is no opening balance, establish whether the intended chart starts at zero or uses another baseline.
  2. Read each change row in source order and add its signed value to the running balance.
  3. After each change, compare the computed balance with any checkpoint recorded in the CSV or represented in the chart.
  4. At a subtotal row, compare the displayed subtotal with the changes in the interval that the chart is meant to summarize. Do not add that displayed subtotal to the running balance as if it were another change.
  5. After the final change, compare the computed balance with the chart’s final total point.

For example, with an opening balance of 100 and ordered changes of +25, -10, and +5, the successive balances are 125, 115, and 120. A checkpoint of 115 after the second change agrees; a claimed ending total of 125 does not. This example is illustrative, not a sourced dataset. A script must classify summary rows before arithmetic so they are not mistaken for changes.

Account for chart-specific summary points

In Highcharts, isIntermediateSum marks a point that summarizes additions and subtractions since the previous intermediate sum or the start of the series; the point’s y value is ignored. isSum marks a point that displays the total across the series, and its y value is also ignored. These semantics are documented in the Highcharts waterfall API reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This distinction matters when inspecting the chart configuration: a summary point’s stored y is not necessarily the value shown by the chart. Recompute the relevant interval from change rows and compare the derived result with the displayed summary. Other libraries may represent opening points, missing values, subtotals, and totals differently; confirm the exact library and version before interpreting those markers. For Apache ECharts dataset-based charts, consult the project’s Dataset documentation.

Report discrepancies in a way that can be checked

For each checkpoint or total, report its row label, expected value from the independent calculation, logged or chart value, difference, and comparison tolerance. Say whether the check is exact or permits rounding, and explain the tolerance’s basis—for example, the precision used to store or display the values. Do not silently round intermediate balances if the source data retains more precision.

A useful difference convention is observed value − expected value. State that convention in the report so a positive or negative difference is unambiguous. If values use different units, precision, or currency conversions, reconcile those rules before treating a numerical difference as a chart error.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

JavaScript pattern for the independent calculation

The following core pattern assumes a CSV parser has already produced ordered records with a type, label, and numeric value. It treats only rows marked change as changes and checks optional checkpoint values after applying each change. Adapt field names and summary handling to the actual file and chart configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
function verifyWaterfall(rows, openingBalance, tolerance = 0) {
  if (!Number.isFinite(openingBalance)) {
    throw new Error("Opening balance must be a finite number");
  }
  if (!Number.isFinite(tolerance) || tolerance < 0) {
    throw new Error("Tolerance must be a finite, non-negative number");
  }

  let running = openingBalance;
  const checks = [];

  for (const row of rows) {
    if (row.type === "change") {
      if (!Number.isFinite(row.value)) {
        throw new Error(`Invalid change value at ${row.label}`);
      }
      running += row.value;
    } else if (row.type !== "checkpoint" && row.type !== "subtotal" && row.type !== "total") {
      throw new Error(`Unknown row type at ${row.label}`);
    }

    if (row.type === "checkpoint" || row.type === "total") {
      if (!Number.isFinite(row.value)) {
        throw new Error(`Invalid recorded value at ${row.label}`);
      }
      const difference = row.value - running;
      checks.push({
        label: row.label,
        expected: running,
        observed: row.value,
        difference,
        matches: Math.abs(difference) <= tolerance
      });
    }

    // Subtotal rows are summaries, not changes. Validate each against the
    // interval rules defined by your chart library/configuration.
  }

  return { endingBalance: running, checks };
}

This example deliberately leaves subtotal-interval calculation to the chart’s defined rules: the Highcharts intermediate-sum interval, for instance, resets at a preceding intermediate sum. If the CSV stores a subtotal separately, compare it with the independently calculated interval rather than adding it to running. The parser, CSV schema, chart configuration, and tolerance must be supplied for a real file; no particular CSV or chart has been tested here.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.