Skip to content

Add pievisible pipe #473

Description

@AngelaZhang915

What happened?

Pie charts with many segments need a computed Other slice that updates when users toggle visibility in Options. selectattr:'visible' only filters rows — it can’t aggregate hidden segments into a single Other slice.

Use case: a pie chart with primary segments shown individually and secondary segments collapsed into Other by default; toggling a segment in Options promotes it and shrinks Other.

Expected: chart_segments | pievisible returns visible slices plus one Other slice summing hidden values (30 above). When MX is toggled visible, MX appears as its own slice and Other drops to 10. When everything is visible, Other is omitted.

Actual: no built-in pipe for this — authors must precompute slices in Python or hand-roll aggregation in expressions.

Proposed approach (comment on the issue if filing before the PR):

Add a pievisible pipe in renderer/src/expression.ts that:

takes segments with label, value, visible, and group (primary / secondary)
returns {label, value} slices for visible rows
aggregates hidden rows into a single Other slice

Example Code

Version Information

0.0.1.dev584+5cb520a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to existing functionality or new capabilities.rendererRelated to the TypeScript/React renderer.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions