mirror of
https://github.com/grafana/grafana.git
synced 2025-09-25 16:03:46 +08:00
NodeGraph: Show gradient fields in legend (#34078)
* Add gradient fields to legend * Fix test * Remove unnecessary mapping * Add tests
This commit is contained in:
@ -4,7 +4,6 @@ import {
|
||||
Field,
|
||||
FieldCache,
|
||||
FieldType,
|
||||
getFieldColorModeForField,
|
||||
GrafanaTheme2,
|
||||
MutableDataFrame,
|
||||
NodeGraphDataFrameFieldNames,
|
||||
@ -100,7 +99,7 @@ export function processNodes(
|
||||
mainStat: nodeFields.mainStat,
|
||||
secondaryStat: nodeFields.secondaryStat,
|
||||
arcSections: nodeFields.arc,
|
||||
color: nodeFields.color ? getColor(nodeFields.color, index, theme) : '',
|
||||
color: nodeFields.color,
|
||||
};
|
||||
return acc;
|
||||
}, {}) || {};
|
||||
@ -271,14 +270,6 @@ function edgesFrame() {
|
||||
});
|
||||
}
|
||||
|
||||
function getColor(field: Field, index: number, theme: GrafanaTheme2): string {
|
||||
if (!field.config.color) {
|
||||
return field.values.get(index);
|
||||
}
|
||||
|
||||
return getFieldColorModeForField(field).getCalculator(field, theme)(0, field.values.get(index));
|
||||
}
|
||||
|
||||
export interface Bounds {
|
||||
top: number;
|
||||
right: number;
|
||||
|
Reference in New Issue
Block a user