Yield Curve Chart
A yield-curve chart plots yield against maturity (in months) rather than against time. It uses TVL’s createYieldCurveChart renderer, which puts a numeric maturity axis on the horizontal, so the x-coordinates are durations, not timestamps. Use it when the x-axis is “how far out” rather than “when”.
The chart supports two series shapes: "line" (default) and "area". Other series types are rejected at construction time, so passing "histogram" or anything else raises a ValueError.
What are yield-curve charts useful for?
- Treasury / sovereign curves: The canonical use. Render the on-the-run curve and watch its shape evolve from a normal upward slope to inversion.
- Swap and forward curves: Any term structure indexed by maturity rather than time fits naturally on this chart.
- Volatility term structure: Implied vol by tenor reads the same way as yield by tenor.
- Cross-section snapshots: Anything indexed by “horizon” (forward returns, expected payout) where comparing across maturities matters more than time evolution.
Examples
A basic yield curve
tvl.data.yields() is an 11-tenor snapshot with columns Tenor and Yield. Tenor is the maturity in months (3, 6, 12, 24, … 480), the unit LWC’s yield-curve axis expects. Pass maturity="Tenor" and value="Yield", and set start_time_range=480 so the initial viewport actually contains the long-end tenors (the LWC default is 120 months, which would clip everything past 10y to the right margin).
A single line traces the data from the short end (3m) to the long end (40y). The x-axis tick formatter renders the tenor values as Xm / Xy durations.
Switch to an area rendering
series_type="area" swaps the line for a filled area. Pair it with top_color/bottom_color for a custom gradient, or leave the colors at their defaults.
The gradient fades down to transparent so the area looks like a “rising tide” shape. Color kwargs accept a Deephaven theme color (e.g. "positive", "accent-300"), a hex code, a named CSS color, or an rgb()/rgba() string. Theme colors adapt automatically when the user switches themes.
Customize color and width (line mode)
In line mode, color is the line CSS color and line_width is the integer pixel width (1-4, default 3). title is the legend label.
The line is now red, one pixel wide, with a custom legend entry.
Tune the maturity axis
Three integer parameters control the maturity axis. They are all expressed in months, regardless of how your maturity column is labeled.
base_resolution: the number of months represented by one base unit on the axis. Increase it to widen tick spacing on long-dated curves.minimum_time_range: the smallest axis span the chart will ever zoom to (in months). Stops zoom from going below this.start_time_range: the initial visible span in months.
The chart opens showing 40 years of curve and won’t zoom in past a 2-year window.
API Reference
A yield-curve chart has a numeric horizontal axis representing maturity in months and is rendered via the TVL createYieldCurveChart backend. Only Line and Area series are supported.
Returns: TvlChart A yield-curve chart with a single series.
Raises: ValueError -- If series_type is not "line" or "area".
| Parameters | Type | Default | Description |
|---|---|---|---|
| table | Any | Deephaven table with the yield-curve data. | |
| maturity | str | 'Maturity' | Column name for the x-axis (months, numeric). |
| value | str | 'Yield' | Column name for the y-axis (yield values). |
| series_type | str | 'line' | "line" (default) or "area". |
| color | Optional[Color] | None | Line color (also used as the area's line color when line_color is not set). |
| line_width | Optional[LineWidth] | None | Stroke width in pixels (1–4). |
| title | Optional[str] | None | Title shown in the series tooltip / legend. |
| line_color | Optional[Color] | None | Area-only: explicit line color (overrides color). |
| top_color | Optional[Color] | None | Area-only: top gradient fill color. |
| bottom_color | Optional[Color] | None | Area-only: bottom gradient fill color. |
| base_resolution | Optional[int] | None | Yield-curve x-axis base resolution in seconds. |
| minimum_time_range | Optional[int] | None | Minimum visible time range. |
| start_time_range | Optional[int] | None | Initial visible time range. |
| background_color | Optional[Color] | None | Chart background CSS color. |
| text_color | Optional[Color] | None | Axis / label text color. |
| crosshair_mode | Optional[CrosshairMode] | None | Crosshair mode; see CrosshairMode. |
| watermark_text | Optional[str] | None | Single-line watermark text. |