fix: Bar Chart not rendering as expected when breakdown is present (#5624)

#5597 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved label retrieval process to handle cases with undefined axis
keys.
  - Enhanced series generation logic for bar and horizontal bar charts.

These updates ensure a more reliable experience when processing chart
configurations in the dashboard.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Omkar Kesarkhane
2025-01-09 12:07:56 +05:30
committed by GitHub
parent f4a7388aae
commit 4ad642ad99
+8 -5
View File
@@ -1190,7 +1190,11 @@ export const convertSQLData = async (
panelSchema.type == "h-stacked") &&
panelSchema.queries[0].fields.breakdown?.length)
) {
return yAxisKeys.length === 1 ? xAXisKey : `${xAXisKey} (${label})`;
return yAxisKeys.length === 1
? xAXisKey
? xAXisKey
: label
: `${xAXisKey} (${label})`;
}
return label;
@@ -1214,7 +1218,8 @@ export const convertSQLData = async (
if (
breakDownKeys.length &&
(panelSchema.type === "bar" || panelSchema.type === "h-bar")
(panelSchema.type === "bar" || panelSchema.type === "h-bar") &&
!panelSchema.config.trellis?.layout
) {
const seriesData = getAxisDataFromKey(yAxis);
return getSeriesObj(yAxisName, seriesData, seriesConfig);
@@ -2097,9 +2102,7 @@ export const convertSQLData = async (
}
});
options.xAxis.forEach((it: any) => {
it.type = "time";
});
options.xAxis[0].type = "time";
options.xAxis[0].data = [];