Skip to content

Stacked bar chart with several bars in one element #4263

Description

@jecrapo

What a stacked bar chart is

Twelve stacked bars side by side, one per month, sharing one scale and one legend

Several bars on one scale, each split into the same series, with one legend and one row of labels.

What limel-chart draws

A single stacked bar

One bar. The stacked-bar type takes one list of items and stacks them into a single bar, and every other type is one series per element too. The 2024 review raised the multi-bar case, and the answer then was that a "chart set" could come later, with consumers placing elements side by side in the meantime.

What consumers do in the meantime

The Lime Admin usage page in Lundalogik/lime-crm-components#4652 is the first picture: twelve limel-chart elements in a flex row, one per month. It works, at a cost the component cannot see:

  • The shared scale is the consumer's job. Giving every element the same maxValue makes each tooltip percentage a share of the tallest bar rather than of the bar's own total, so the consumer sizes each element's height in CSS instead.
  • Assistive technology gets twelve tables for one chart, each with its own caption and header row.
  • The legend and the bucket labels live outside the component, so their colors, spacing, and wrapping are the consumer's to keep in step with the bars.
  • Nothing ties the bars together: no shared axis or gridlines, and no hover that highlights one series across all bars.

Ask

A way to draw several bars, or several series, in one chart: one scale, one legend, one accessible table. The shape of the API is open, items grouped into series, a chart-set element as suggested in 2024, or something else. The usage page can serve as the first consumer to validate against.

Tooltip percentages and their opt-out are handled in #4262 and are out of scope here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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