diff --git a/packages/grafana-ui/src/components/VizLegend/VizLegendList.tsx b/packages/grafana-ui/src/components/VizLegend/VizLegendList.tsx index 8bba52a7f37..8a30511c012 100644 --- a/packages/grafana-ui/src/components/VizLegend/VizLegendList.tsx +++ b/packages/grafana-ui/src/components/VizLegend/VizLegendList.tsx @@ -56,26 +56,25 @@ export const VizLegendList = ({ } case 'bottom': default: { + const leftItems = items.filter((item) => item.yAxis === 1); + const rightItems = items.filter((item) => item.yAxis !== 1); + const renderItem = (item: VizLegendItem, index: number) => { return {itemRenderer!(item, index)}; }; return (
-
- item.yAxis === 1)} - renderItem={renderItem} - getItemKey={getItemKey} - /> -
-
- item.yAxis !== 1)} - renderItem={renderItem} - getItemKey={getItemKey} - /> -
+ {leftItems.length > 0 && ( +
+ +
+ )} + {rightItems.length > 0 && ( +
+ +
+ )}
); }