Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combo stacked chart #42085

Merged
merged 11 commits into from
May 16, 2024
Merged

combo stacked chart #42085

merged 11 commits into from
May 16, 2024

Conversation

alxnddr
Copy link
Member

@alxnddr alxnddr commented May 1, 2024

Closes #41976
Closes #12008

Description

  • In Combo charts, on the Display tab, add a new radio setting:
    • Bar and area stacking
      • Don't stack
      • Stack
      • Stack - 100%
  • If Stack or Stack - 100% is selected then:
    • All series with a Display type set to bar should be stacked together.
    • All series with a Display type set to area should be stacked together.
    • But series with a Display type set to line should be unaffected.
  • If Stack - 100% is chosen, if there are any series set to line, there should be two y-axes:
    • one from 0% to 100% that the stacked bars/areas should be associated with,
    • and the other that should depict the scale and measure of the line series.

How to verify

  • Create a multiple series combo chart with at least 5 series
  • Make two of them bars, make the other two areas, keep 1 line series
  • Enable stacking
  • Ensure areas stacked with each other, bars stacked with each other
  • Hover areas: ensure the tooltip shows area series only
  • Hover bars: ensure the tooltip shows bar series only
  • Hover line: ensure it shows a default key-value tooltip with all values
  • Switch to Stack — 100%
  • Ensure left y-axis is normalized and used for stacked areas and bars
  • Ensure right y-axis is used for the line series

Demo

Screenshot 2024-05-02 at 11 02 14 PM

Checklist

  • Tests have been added/updated to cover changes in this PR

@metabase-bot metabase-bot bot added the .Team/DashViz Dashboard and Viz team label May 1, 2024
@alxnddr alxnddr requested review from kdoh, cdeweyx and a team May 3, 2024 02:02
@alxnddr alxnddr marked this pull request as ready for review May 3, 2024 02:03
@metabase-bot metabase-bot bot added the visual Run Percy visual testing label May 3, 2024
Copy link

replay-io bot commented May 3, 2024

Status Complete ↗︎
Commit 2d55b52
Results
⚠️ 2 Flaky
2508 Passed

@alxnddr alxnddr added the no-backport Do not backport this PR to any branch label May 3, 2024
Copy link

@cdeweyx cdeweyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@alxnddr alxnddr force-pushed the combo-stacked-chart branch 2 times, most recently from 5e44bdf to 00611b6 Compare May 3, 2024 16:31
@mazameli
Copy link
Contributor

mazameli commented May 7, 2024

Nice!

Copy link
Contributor

@JesseSDevaney JesseSDevaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

99% LGTM, but there are still a few bugs that make this kind of hard to use. Perhaps these issues are already being tracked separately.

2024-05-07.17-15-23.mp4

When bars are stuck under an area, you cannot hover over the bars and see their tool-tip values. Also, when areas are not stacked, hovering over the smaller one will highlight the larger one (when it should be highlighting the smaller one).

@alxnddr
Copy link
Member Author

alxnddr commented May 7, 2024

@JesseSDevaney thanks for the review!
The issues you mentioned are not related to this change, it worked like this in dc.js implementation:
Screenshot 2024-05-07 at 6 33 37 PM

I created an issue to track it #42366

@alxnddr alxnddr requested review from JesseSDevaney and a team May 7, 2024 21:39
Copy link
Contributor

@JesseSDevaney JesseSDevaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sasha! I found a couple more bugs upon further investigation.

  1. The ability to select the y-axis position for stacked charts is broken (comment)
  2. With the new ability of combo charts, we probably still want to show the Show values on data points setting if we have a line series in a stacked 100% chart (comment)

Once we get these bugs fixed up and fix the type errors + unit test failures (probably coming from updates to the number of arguments in a function and how we handle the data models), we should be good to merge.

@alxnddr alxnddr requested review from JesseSDevaney and a team May 9, 2024 15:55
@JesseSDevaney
Copy link
Contributor

@alxnddr In my PR to move data label formatters from model to option, I noticed that in this new combo chart paradigm, we can have non-stacked lines with stacked bars/areas. We may still want to optionally enable/disable showing values for the non-stacked lines, but this setting gets hidden because of old checks. Would you be able to account for this in this PR?

See #42616 (comment) for more context

alxnddr and others added 5 commits May 14, 2024 20:25
* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data
},
);

expect(isHidden).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(isHidden).toBe(true);
expect(isHidden).toBe(false);

Should be visible implies isHidden = false?

@alxnddr
Copy link
Member Author

alxnddr commented May 16, 2024

@JesseSDevaney good catch, thanks, I fixed it

@alxnddr alxnddr merged commit 8b9e152 into master May 16, 2024
107 checks passed
@alxnddr alxnddr deleted the combo-stacked-chart branch May 16, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/DashViz Dashboard and Viz team visual Run Percy visual testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support combo stacked charts Visualization: Stacked combo charts (stacked bars with lines)
4 participants