LevisNgigi commented on issue #32496:
URL: https://github.com/apache/superset/issues/32496#issuecomment-2711312120
# 🚀 Feature Proposal: Support for Stacking & Grouping in ECharts Bar Chart
## 👋 Hey @beliaev-maksim and the canonical team!
I am excited about contributing this feature to **Apache Superset**. Here’s
my **straightforward plan** to tackle this enhancement:
---
## 1️⃣ Objective
The goal is to enhance the **ECharts-based Bar Chart** to support:
✅ Both **stacking and grouping** simultaneously.
✅ Mixed formats (**bar + line overlay**).
✅ **Trend lines** for key metrics.
✅ Support for both **categorical and time-series** X-axis.
✅ **Improved UI** for configuring these settings.
---
## 2️⃣ Current Behavior
- **Bar charts** currently support either **stacking OR grouping**, but
**not both** at the same time.
- **Trend lines** are **not natively supported** in bar charts.
- The **X-axis** can be either **categorical or time-series**, but this is
**not configurable dynamically**.
- Users must **manually toggle stacking** in the "Customize" panel.
---
## 3️⃣ Challenges in the Current Implementation
🔴 **No support** for **simultaneous stacking & grouping**.
🔴 **No way** to add **trend lines** to selected metrics.
🔴 **No clear separation** between **stacking and grouping options** in the
UI.
🔴 The **X-axis** cannot be **dynamically switched** between categorical and
time-series.
---
## 4️⃣ Proposed Solution
To implement these features, I will:
### **1️⃣ Modify the Control Panel UI (`controlPanel.tsx`)**
✅ Add two new controls: **“Stack Bars By”** and **“Split Bars By”** (as
suggested by a PMC member).
✅ Add a **multi-select control** for **Trend Lines**.
✅ Add an option to **switch between categorical and time-series** X-axis.
### **2️⃣ Update the Chart Transformation Logic (`transformProps.ts`)**
✅ Modify how data is processed to allow **stacking & grouping at the same
time**.
✅ Ensure **trend lines** are properly applied as **separate line series**.
✅ Dynamically handle **categorical vs. time-series X-axis**.
### **3️⃣ Modify the ECharts Configuration**
✅ Update the **series generation logic** to:
- Stack bars when a **stack dimension** is chosen.
- Group bars when a **split dimension** is chosen.
- Overlay a **line series** for selected **trend metrics**.
- Allow users to **toggle between time-series and categorical** axes.
### **4️⃣ Ensure Compatibility with Superset’s Query Engine**
✅ Verify that the **backend query** correctly supports the new
**grouping/stacking settings**.
✅ Ensure that **existing bar chart queries remain unaffected**.
---
## 5️⃣ Testing & Validation
To ensure that the solution works correctly:
### **1️⃣ Unit Testing:**
✅ Ensure **CI passes** and nothing is broken.
✅ Write **new tests** where necessary.
### **2️⃣ Manual Testing:**
✅ Verify that users can **stack & group bars** simultaneously.
✅ Test **trend lines overlaying bar charts**.
✅ Ensure the **X-axis type switch** works properly.
---
## 6️⃣ Estimated Timeline ⏳
🕒 **10 business days**
---
Looking forward to your feedback! 🚀
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]