Canvas BarChart SDK can't accommodate positive/negative stacked bars

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Canvas SDK BarChart Mixed Positive/Negative Stacked Bar Bug

Summary

Canvas SDK BarChart should support stacked bar charts with both positive and negative values. In this use case, product growth contribution can be positive or negative by week, and the chart needs to show positive contributions above the 0 pp baseline and negative contributions below it.

Repro

Canvas repro:


The repro uses:

  • BarChart
  • stacked
  • one positive contribution series
  • one negative contribution series
  • one small positive contribution series
  • referenceLines={[{ value: 0, label: "0 pp", tone: "neutral" }]}

Expected Behavior

  • Positive series stack upward from the 0 baseline.
  • Negative series stack downward from the 0 baseline.
  • The y-domain includes both the positive stack max and negative stack min.
  • Hover tooltips preserve signed values for each segment.

Actual Behavior

In the THP dashboard prototype, negative stacked values were not visibly rendered below the 0 pp baseline. This made negative Storefront/DO contribution appear missing even though the underlying contribution value was negative.

Why This Matters

Mixed positive/negative stacked contribution charts are useful for business decomposition reads:

  • Product contribution to same-store sales growth
  • Margin / THP driver contribution
  • Cost bucket decomposition
  • Any bridge chart where some components offset growth

Likely Fix

In the BarChart stacked layout logic:

  1. Compute positive and negative stack extents separately for each category.
  2. Use max(sum(positive values)) for the positive domain.
  3. Use min(sum(negative values)) for the negative domain.
  4. Render positive segments upward from zero.
  5. Render negative segments downward from zero.
  6. Keep tooltip values signed and attached to the correct segment.

Workaround Used

The THP prototype currently uses a custom SVG combo chart so negative contribution bars render correctly below 0 pp, with a total growth line overlaid.

Steps to Reproduce

see above

Expected Behavior

see above

Operating System

MacOS

Version Information

Version: 3.9.8 (Universal)
VS Code Extension API: 1.105.1
Commit: 4aa8ff1b7877ed7bd01bcba308698f71a6735380
Date: 2026-06-25T01:39:30.490Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Darwin arm64 25.5.0

For AI issues: which model did you use?

GPT 5.5

Does this stop you from using Cursor

No - Cursor works, but with this issue

@Meg_Davy Thanks for the report! I’ve been able to reproduce the issue on my end. We should either render this correctly or provide a clear warning to users when we can’t. In the meantime, the SVG workaround is a solid solution.