[v10.0.x] Heatmap: Sort fields by numeric names when single frame (#69880)
Heatmap: Sort fields by numeric names when single frame (#69879)
(cherry picked from commit cc8bedc173)
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
co-authored by
Leon Sorokin
parent
4184cd09f4
commit
f7766f73b8
@@ -108,7 +108,20 @@ export function prepareHeatmapData(
|
||||
})!,
|
||||
][0];
|
||||
} else {
|
||||
rowsHeatmap = frames[0];
|
||||
let frame = frames[0];
|
||||
let numberFields = frame.fields.filter((field) => field.type === FieldType.number);
|
||||
let allNamesNumeric = numberFields.every((field) => !Number.isNaN(parseSampleValue(field.name)));
|
||||
|
||||
if (allNamesNumeric) {
|
||||
numberFields.sort((a, b) => parseSampleValue(a.name) - parseSampleValue(b.name));
|
||||
|
||||
rowsHeatmap = {
|
||||
...frame,
|
||||
fields: [frame.fields.find((f) => f.type === FieldType.time)!, ...numberFields],
|
||||
};
|
||||
} else {
|
||||
rowsHeatmap = frame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user