Skip to content

Commit

Permalink
Preserve color state when generating XY suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
drewdaemon committed Dec 1, 2021
1 parent 4e1d60b commit 67c0f7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ describe('xy_suggestions', () => {
valueLabels: 'hide',
fittingFunction: 'None',
axisTitlesVisibilitySettings: { x: true, yLeft: true, yRight: true },
axisColors: { x: '#123456', yLeft: '#123456', yRight: '#123456' },
gridlinesVisibilitySettings: { x: true, yLeft: true, yRight: true },
tickLabelsVisibilitySettings: { x: true, yLeft: false, yRight: false },
labelsOrientation: { x: 0, yLeft: -45, yRight: -45 },
Expand Down Expand Up @@ -681,6 +682,7 @@ describe('xy_suggestions', () => {
preferredSeriesType: 'bar',
fittingFunction: 'None',
axisTitlesVisibilitySettings: { x: true, yLeft: true, yRight: true },
axisColors: { x: '#123456', yLeft: '#123456', yRight: '#123456' },
gridlinesVisibilitySettings: { x: true, yLeft: true, yRight: true },
tickLabelsVisibilitySettings: { x: true, yLeft: false, yRight: false },
labelsOrientation: { x: 0, yLeft: -45, yRight: -45 },
Expand Down Expand Up @@ -800,6 +802,7 @@ describe('xy_suggestions', () => {
preferredSeriesType: 'bar',
fittingFunction: 'None',
axisTitlesVisibilitySettings: { x: true, yLeft: true, yRight: true },
axisColors: { x: '#123456', yLeft: '#123456', yRight: '#123456' },
gridlinesVisibilitySettings: { x: true, yLeft: true, yRight: true },
tickLabelsVisibilitySettings: { x: true, yLeft: false, yRight: false },
labelsOrientation: { x: 0, yLeft: -45, yRight: -45 },
Expand Down Expand Up @@ -845,6 +848,7 @@ describe('xy_suggestions', () => {
preferredSeriesType: 'bar',
fittingFunction: 'None',
axisTitlesVisibilitySettings: { x: true, yLeft: true, yRight: true },
axisColors: { x: '#123456', yLeft: '#123456', yRight: '#123456' },
gridlinesVisibilitySettings: { x: true, yLeft: true, yRight: true },
tickLabelsVisibilitySettings: { x: true, yLeft: false, yRight: false },
labelsOrientation: { x: 0, yLeft: -45, yRight: -45 },
Expand Down Expand Up @@ -891,6 +895,7 @@ describe('xy_suggestions', () => {
preferredSeriesType: 'bar',
fittingFunction: 'None',
axisTitlesVisibilitySettings: { x: true, yLeft: true, yRight: true },
axisColors: { x: '#123456', yLeft: '#123456', yRight: '#123456' },
gridlinesVisibilitySettings: { x: true, yLeft: true, yRight: true },
tickLabelsVisibilitySettings: { x: true, yLeft: false, yRight: false },
labelsOrientation: { x: 0, yLeft: -45, yRight: -45 },
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/lens/public/xy_visualization/xy_suggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { State, XYState, visualizationTypes } from './types';
import type { SeriesType, XYLayerConfig } from '../../common/expressions';
import { layerTypes } from '../../common';
import { getIconForSeries } from './state_helpers';
import { defaultAxisLineColor } from './color_assignment';

const columnSortOrder = {
document: 0,
Expand Down Expand Up @@ -540,6 +541,11 @@ function buildSuggestion({
yLeft: true,
yRight: true,
},
axisColors: currentState?.axisColors || {
x: defaultAxisLineColor,
yLeft: defaultAxisLineColor,
yRight: defaultAxisLineColor,
},
tickLabelsVisibilitySettings: currentState?.tickLabelsVisibilitySettings || {
x: true,
yLeft: true,
Expand Down

0 comments on commit 67c0f7b

Please sign in to comment.