Skip to content

Bar chart stacked toggle has no effect — BarChartTransformer checks mark.stack instead of config.stacked #556

Description

@Ju4n5e

Bug Description

The Stacked toggle on bar charts (the layers icon in the chart context menu) has no effect. Bars always render side-by-side (grouped) regardless of the stacked setting.

Root Cause

In src/core/react/components/Visualization/transformers/BarChartTransformer.ts, line 140:

const isStacked = config.mark?.stack === true;

This checks config.mark.stack, but the UI toggle and the config parser (vizConfigFromProps) set the top-level config.stacked property — never config.mark.stack. So isStacked is always false.

The type definitions in src/shared/types/visualization.ts confirm both properties exist:

  • mark.stack?: boolean (line 51) — never set by the UI
  • stacked?: boolean (line 187) — set by the UI toggle

The legacy renderLegacy path in D3VisualizationEngine.tsx correctly checks the top-level stacked property, but the newer renderWithTransformedData path (which takes priority when transformedData exists) relies on BarChartTransformer, which only checks mark.stack.

Steps to Reproduce

  1. Create a folder with notes that have a frontmatter property (e.g., Assignee)
  2. Create a bar chart visualization with:
    • X field: Assignee
    • Y field: File with count aggregate
    • Color field: Priority (or any other property)
  3. Toggle Stacked to On
  4. Observe bars are still side-by-side (grouped), not stacked

Expected Behavior

Bars should stack on top of each other, segmented by the color field.

Suggested Fix

In BarChartTransformer.ts line 140, also check the top-level stacked property:

const isStacked = config.mark?.stack === true || config.stacked === true;

Environment

  • make.md version: 1.3.5
  • Obsidian: latest
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions