Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa committed Jan 22, 2022
1 parent 262a2ea commit 84bbe33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
17 changes: 7 additions & 10 deletions x-pack/plugins/lens/public/metric_visualization/expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,13 @@ function getColorStyling(
const cssProp = colorMode === ColorMode.Background ? 'backgroundColor' : 'color';
let rawIndex = stops.findIndex((v) => v > value);

// we should check it only if we don't find color index
if (rawIndex !== -1) {
if (!isFinite(rangeMax) && value > stops[stops.length - 1]) {
rawIndex = stops.length - 1;
}

// in this case first stop is -Infinity
if (!isFinite(rangeMin) && value < (isFinite(stops[0]) ? stops[0] : stops[1])) {
rawIndex = 0;
}
if (!isFinite(rangeMax) && value > stops[stops.length - 1]) {
rawIndex = stops.length - 1;
}

// in this case first stop is -Infinity
if (!isFinite(rangeMin) && value < (isFinite(stops[0]) ? stops[0] : stops[1])) {
rawIndex = 0;
}

const colorIndex = rawIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ export function CustomizablePalette({
palettes={palettes}
activePalette={localState.activePalette}
setPalette={(newPalette) => {
dispatch({
type: 'changeColorPalette',
payload: { palette: newPalette, dataBounds, palettes, disableSwitchingContinuity },
});
const isPaletteChanged = newPalette.name !== activePalette.name;
if (isPaletteChanged) {
dispatch({
type: 'changeColorPalette',
payload: { palette: newPalette, dataBounds, palettes, disableSwitchingContinuity },
});
}
}}
showCustomPalette
showDynamicColorOnly
Expand Down

0 comments on commit 84bbe33

Please sign in to comment.