Skip to content

Commit

Permalink
Explore: Ensure logs volume bar colors match legend colors (#39072)
Browse files Browse the repository at this point in the history
* Ensure logs volume bar colors match legend colors

* Fix tests
  • Loading branch information
ifrost committed Sep 13, 2021
1 parent 15b8b73 commit 88ad9aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions public/app/core/logs_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
dateTimeFormat,
dateTimeFormatTimeAgo,
FieldCache,
FieldColorModeId,
FieldType,
FieldWithIndex,
findCommonLabels,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions public/app/features/explore/utils/decorators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ArrayVector,
DataFrame,
DataQueryRequest,
FieldColorModeId,
FieldType,
LoadingState,
PanelData,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 88ad9aa

Please sign in to comment.