mirror of
https://github.com/apache/superset.git
synced 2026-04-27 03:55:47 +00:00
feat: add sort legend to legend section (#34911)
This commit is contained in:
@@ -188,6 +188,7 @@ export default function transformProps(
|
||||
legendMargin,
|
||||
legendOrientation,
|
||||
legendType,
|
||||
legendSort,
|
||||
showLegend,
|
||||
baseEdgeWidth,
|
||||
baseNodeSize,
|
||||
@@ -353,7 +354,10 @@ export default function transformProps(
|
||||
},
|
||||
legend: {
|
||||
...getLegendProps(legendType, legendOrientation, showLegend, theme),
|
||||
data: categoryList,
|
||||
data: categoryList.sort((a: string, b: string) => {
|
||||
if (!legendSort) return 0;
|
||||
return legendSort === 'asc' ? a.localeCompare(b) : b.localeCompare(a);
|
||||
}),
|
||||
},
|
||||
series,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user