Charts / Diverging bar chart

Charts

Diverging bar chart

Two opposed amounts per period, growing up and down from one strong zero line on one shared scale.

import { EcoDivergingBarChart } from "vue-ecosphere"

Over and under, by month

Over in s1, under in s6: one blue and one neutral, never red and green. A tiny amount still draws a 3px stub; the exact figure is in the tooltip.

Spend against budget

By month, May 2025 – October 2026

Over budget, above the line
Under budget, below the line

Narrow and empty

At 360px every third month is labelled and the legend wraps.

Spend against budget

At 360px: every third month

Over budget, above the line
Under budget, below the line

Spend against budget

No data

Nothing to compare yet

Bars appear once a month has both a budget and recorded spend.

API

NameTypeDefaultDescription
dataDivergingDatum[]—Per period: label, both amounts as positive numbers, the year and a long title.
overLabel / underLabelstring"Over budget" / "Under budget"Words for each side, used in the legend, the tooltip and every hit label.
valueFormat(v: number) => string—Full figures (“$15,800”).
tickFormat(v: number) => string—Unsigned tick figures; the chart adds + and a true minus.
height / widthnumber240 / measuredviewBox size; labels thin from the measured width, counted back from the latest.
title / subtitle / caption / ariaLabelstring—Head, closing chart__sub and the svg label. Slot actions holds the Chart | Table toggle.
emptyTitle / emptyTextstring—chart__empty when there is no data.