Legend: Fix desc sort so NaNs are not display first (#75685)

do not put NaNs as first in legend desc sort

Co-authored-by: Simon Podlipsky <simon@podlipsky.net>
Co-authored-by: Adela Almasan <adela.almasan@grafana.com>
This commit is contained in:
Nathan Marrs 2023-10-03 17:50:57 +02:00 committed by GitHub
parent 5b63cdb5b0
commit a417402c77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,10 @@ export const VizLegendTable = <T extends unknown>({
if (item.getDisplayValues) {
const stat = item.getDisplayValues().filter((stat) => stat.title === sortKey)[0];
return stat && stat.numeric;
if (stat) {
return isNaN(stat.numeric) ? -Infinity : stat.numeric;
}
}
return undefined;
},