MelikHajlawi opened a new pull request, #38451:
URL: https://github.com/apache/superset/pull/38451

   ### SUMMARY
   Fixes #38190 – "Truncate Metric" had no effect in Mixed Chart.
   
   **Problem**: The Mixed Chart ignored the `truncateMetric` and 
`truncateMetricB` form values, always displaying the full series name (metric + 
group‑by) in the legend and tooltip, regardless of the checkbox state.
   
   **Solution**:  
   - Added `truncateMetric` and `truncateMetricB` to the destructured form data 
in `transformProps.ts`.  
   - Modified series name generation for both queries:  
     - When `truncateMetric` (or `truncateMetricB`) is `true`, the name is 
built using only the group‑by values (from `labelMap`/`labelMapB`).  
     - When `false`, the original logic (metric + group‑by, with optional query 
identifier) is used.  
   - Added the missing properties to the `EchartsMixedTimeseriesFormData` type 
and set defaults to `false` in `DEFAULT_FORM_DATA` (in `types.ts`).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!-- Add screenshots here to show the visual change.  
        **Before**: Truncate Metric enabled – legend still shows "COUNT(name): 
boy".  
        **After**: Truncate Metric enabled – legend shows only "boy".  
   -->
   _Before_ – Truncate Metric ON, but metric still visible in legend:  
   ![before]<img width="1908" height="961" alt="Capture d&#39;écran 2026-03-05 
204450" 
src="https://github.com/user-attachments/assets/428d2d2e-ab12-4279-aceb-bf8654f50158";
 />
   
   _After_ – Truncate Metric ON, legend shows only group‑by values:  
   ![after]
   <img width="1910" height="963" alt="Capture d&#39;écran 2026-03-05 203856" 
src="https://github.com/user-attachments/assets/fa2bbf24-ab2e-4a58-8d02-4995a56c9dbb";
 />
   
   (Replace the placeholder URLs with your actual screenshot links after 
uploading them.)
   
   ### TESTING INSTRUCTIONS
   1. **Create a Mixed Chart** with two queries:  
      - Use a dataset with a time column, a metric, and a group‑by column 
(e.g., `birth_names` with `SUM(num)` and `gender` for Query A; `COUNT(*)` and 
`state` for Query B).  
   2. **Enable "Truncate Metric"** for both queries (under the Data tab in 
Query A and Query B sections).  
   3. **Click Update Chart**.  
      - **Expected**: Legend entries show only the group‑by values (e.g., 
`male`, `female` for Query A; state names for Query B). Tooltips also omit the 
metric.  
   4. **Disable the checkboxes** and update again.  
      - **Expected**: Full names (metric + group‑by) reappear.  
   5. Test edge cases:  
      - No group‑by – with truncation enabled, series should disappear from 
legend/tooltip (empty name).  
      - Multiple metrics per query – each series truncates independently.  
      - `showQueryIdentifiers` enabled – the identifier should not appear when 
truncation is on.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: #38190  
   - [ ] Required feature flags: none  
   - [x] Changes UI  
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))  
   - [ ] Introduces new feature or API  
   - [ ] Removes existing feature or API  


-- 
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]

Reply via email to