From 88ad9aad427fba49939ab155ac5a86aa421a3232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Jamr=C3=B3z?= Date: Mon, 13 Sep 2021 11:11:49 +0200 Subject: [PATCH] Explore: Ensure logs volume bar colors match legend colors (#39072) * Ensure logs volume bar colors match legend colors * Fix tests --- public/app/core/logs_model.ts | 5 +++++ public/app/features/explore/utils/decorators.test.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/public/app/core/logs_model.ts b/public/app/core/logs_model.ts index 34386bb2003..4d29360f66d 100644 --- a/public/app/core/logs_model.ts +++ b/public/app/core/logs_model.ts @@ -10,6 +10,7 @@ import { dateTimeFormat, dateTimeFormatTimeAgo, FieldCache, + FieldColorModeId, FieldType, FieldWithIndex, findCommonLabels, @@ -143,6 +144,10 @@ export function makeDataFramesForLogs(sortedRows: LogRowModel[], bucketSize: num data.fields[valueField.index].config.min = 0; data.fields[valueField.index].config.decimals = 0; + data.fields[valueField.index].config.color = { + mode: FieldColorModeId.Fixed, + fixedColor: series.color, + }; data.fields[valueField.index].config.custom = { drawStyle: GraphDrawStyle.Bars, diff --git a/public/app/features/explore/utils/decorators.test.ts b/public/app/features/explore/utils/decorators.test.ts index 9a89255baa9..ffc6abcc775 100644 --- a/public/app/features/explore/utils/decorators.test.ts +++ b/public/app/features/explore/utils/decorators.test.ts @@ -4,6 +4,7 @@ import { ArrayVector, DataFrame, DataQueryRequest, + FieldColorModeId, FieldType, LoadingState, PanelData, @@ -361,6 +362,10 @@ describe('decorateWithLogsResult', () => { labels: undefined, values: new ArrayVector([3]), config: { + color: { + fixedColor: '#8e8e8e', + mode: FieldColorModeId.Fixed, + }, min: 0, decimals: 0, unit: undefined,