dosubot[bot] commented on issue #30045: URL: https://github.com/apache/superset/issues/30045#issuecomment-2317040317
<!-- Answer --> I found two similar unsolved discussions that might be relevant to your issue: 1. [Mixed Chart - Stacked Bar metrics sort](https://github.com/apache/superset/discussions/28392) <sup>[[1]](https://github.com/apache/superset/discussions/28392)</sup>. 2. [How to fix the sorting of bars in bar-chart by metric?](https://github.com/apache/superset/discussions/28636) <sup>[[2]](https://github.com/apache/superset/discussions/28636)</sup>. To address your specific issue where the tooltip order does not match the order of the stacked bars in a Mixed Chart, you can sort the `forecastValue` array by the metric values in the tooltip formatter function. This is already handled in the code by the following snippet: ```ts if (richTooltip && tooltipSortByMetric) { forecastValue.sort((a, b) => b.data[1] - a.data[1]); } ``` This code sorts the `forecastValue` array in descending order based on the metric values, ensuring that the tooltip order matches the order of the stacked bars <sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts)</sup>. Additionally, the bar colors in the Mixed Chart are assigned based on the `colorScheme` parameter, which is set to `bnbColors` in the provided configuration. To customize or reorder the bar colors, you would need to modify the `colorScheme` parameter to use a different color scheme or define a custom one <sup>[[4]](https://github.com/apache/superset/blob/master/superset/examples/configs/charts/Featured Charts/Mixed.yaml)</sup>. If you need further customization, you can use the `sort_series_type` and `sort_series_ascending` parameters to control the order of the series on the chart and legend <sup>[[5]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx)</sup>. I hope this helps! Let me know if you need further assistance. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- 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]
