[SIP-185] Proposal for Chart Customization / Dynamic Group By in Dashboards
Motivation
There is a need to enhance dashboard interactivity by enabling users to dynamically change group by fields in charts directly from dashboards. This will allow end users greater flexibility in data exploration and reduce the need for creating multiple static charts for different group by dimensions.
Proposed Change
Introduce a feature that allows dashboard viewers to select and adjust the group by column(s) for charts in real time. This could involve UI changes to add group by selectors on charts, backend enhancements to support dynamic query generation, and state management for user selections. Reference implementation and early discussion can be found in PR #33831.
New or Changed Public Interfaces
- Changes to chart and dashboard React components to support group by selectors
- Updates to REST endpoints (if needed) to accept dynamic group by parameters
- Potential updates to chart metadata and dashboard state
New dependencies
No new dependencies
Migration Plan and Compatibility
- Ensure dashboards with static group bys continue to work as before
Rejected Alternatives
- Continue requiring users to create multiple charts for each group by scenario. This approach leads to dashboard clutter, increased maintenance overhead, and a less dynamic user experience. It also does not scale well when users want to explore multiple dimensions interactively.
Comment From: LevisNgigi
Thanks for this,I believe the feature is quite useful and will enable users to change dimensions at the dashboard level.
Comment From: geido
+1 for this!
Comment From: mistercrunch
This is great! +1 for sure. Quick questions:
- how do identify the "group by column" in various viz plugins? Without looking into the details, there's a variety of controls with different names and configurations for what is in theory the "primary dimension / group-by column" across visualizations. How does the feature know which control to force/override?
- Some viz plugins may allow for multiple group-bys (ie: country, state), but others only support single-value, how does the control behave? only single-selection?
- related to previous questions, but charts line the time-series may have both X-axis grouping and a
dimension
field, how do we know which field to target? Seems in this particular case we should target dimension, but if a user hascountry
on x-axis, guessing we still target thedimension
field?
Comment From: msyavuz
Good questions, here's how it's handled in the referenced pr:
- The implementation directly sets groupby field in the formData bypassing control names
- There is actually a
chartTypeLimitations.ts
file that enforces limitations based on chart type. - Yes, for that case we always target dimension
Comment From: an3uryzm
I believe there is something wrong in the motivation of this feature.
Having a feeling that it tries to replace/reinvent cross filters and drill by's on dashboard-level, and exploration tool. Dynamic dimensions/dashboards are actually achieved with cross filters.
On the other hand there are indeed some cases (or better say - charts) where dynamic dimensions described here could be useful (table or pivot tables).
With other charts (line, bar) I think it will always be a pain when a user will accidently choose high cardinality column.
This would be a cool feature on the chart-level, not as global selectors on the dashboard-level
Comment From: LevisNgigi
This is great! +1 for sure. Quick questions:
- how do identify the "group by column" in various viz plugins? Without looking into the details, there's a variety of controls with different names and configurations for what is in theory the "primary dimension / group-by column" across visualizations. How does the feature know which control to force/override?
- Some viz plugins may allow for multiple group-bys (ie: country, state), but others only support single-value, how does the control behave? only single-selection?
- related to previous questions, but charts line the time-series may have both X-axis grouping and a
dimension
field, how do we know which field to target? Seems in this particular case we should target dimension, but if a user hascountry
on x-axis, guessing we still target thedimension
field?
These are great questions and some had been discussed with the inputs of Sophie and Rebecca: 1) When a dashboard group by is applied, we look up the chart type and replace the correct form-data field (e.g. groupby, series, columns, source/target, etc.).
2) We follow the limits defined in chartTypeLimitations.ts: Charts in SINGLE_COLUMN_DIMENSION_CHARTS (like heatmap, waterfall) always get one column only. Most others accept an array of columns, so we simply inject the full array. A few special charts (graph, sankey, bubble) are capped at exactly two. limitColumnsForChartType enforces these rules.
3) For time-series (e.g., echarts_timeseries, echarts_area): If an X-axis is already set, new group-bys are written to the groupby/dimension field. so for these we target dimensions as Memo has pointed out above.