diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/es_geo_grid_source.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/es_geo_grid_source.js index 4a18fdc1a2e96..39f7666589a73 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/es_geo_grid_source.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/es_geo_grid_source.js @@ -19,6 +19,7 @@ import { getDefaultDynamicProperties, VECTOR_STYLES, } from '../../styles/vector/vector_style_defaults'; +import { COLOR_GRADIENTS } from '../../styles/color_utils'; import { RENDER_AS } from './render_as'; import { CreateSourceEditor } from './create_source_editor'; import { UpdateSourceEditor } from './update_source_editor'; @@ -255,7 +256,7 @@ export class ESGeoGridSource extends AbstractESAggSource { name: COUNT_PROP_NAME, origin: SOURCE_DATA_ID_ORIGIN, }, - color: 'Blues', + color: COLOR_GRADIENTS[0].value, }, }, [VECTOR_STYLES.LINE_COLOR]: { diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js index 66d62dd5644ac..e14c42bae5fd2 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js @@ -29,6 +29,7 @@ import { Schemas } from 'ui/vis/editors/default/schemas'; import { AggConfigs } from 'ui/agg_types'; import { AbstractESAggSource } from '../es_agg_source'; import { DynamicStyleProperty } from '../../styles/vector/properties/dynamic_style_property'; +import { COLOR_GRADIENTS } from '../../styles/color_utils'; const MAX_GEOTILE_LEVEL = 29; @@ -142,7 +143,7 @@ export class ESPewPewSource extends AbstractESAggSource { name: COUNT_PROP_NAME, origin: SOURCE_DATA_ID_ORIGIN, }, - color: 'Blues', + color: COLOR_GRADIENTS[0].value, }, }, [VECTOR_STYLES.LINE_WIDTH]: { diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/color_utils.js b/x-pack/legacy/plugins/maps/public/layers/styles/color_utils.js index bdcb6f3d86af9..1f4250d3331d8 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/color_utils.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/color_utils.js @@ -52,6 +52,9 @@ export function getHexColorRangeStrings(colorRampName, numberColors = GRADIENT_I } export function getColorRampCenterColor(colorRampName) { + if (!colorRampName) { + return null; + } const colorRamp = getColorRamp(colorRampName); const centerIndex = Math.floor(colorRamp.value.length / 2); return getColor(colorRamp.value, centerIndex); diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/legend/extract_color_from_style_property.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/legend/extract_color_from_style_property.js index 3b11c7b77a237..d3862f80385f4 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/legend/extract_color_from_style_property.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/legend/extract_color_from_style_property.js @@ -30,6 +30,10 @@ export function extractColorFromStyleProperty(colorStyleProperty, defaultColor) : defaultColor; } + if (!colorStyleProperty.options.color) { + return null; + } + const palette = getColorPalette(colorStyleProperty.options.color); return palette[0]; } else { @@ -46,6 +50,9 @@ export function extractColorFromStyleProperty(colorStyleProperty, defaultColor) return colorStyleProperty.options.customColorRamp[middleIndex].color; } + if (!colorStyleProperty.options.color) { + return null; + } return getColorRampCenterColor(colorStyleProperty.options.color); } } diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js index 4bae90c3165f2..85d6a8b500b73 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js @@ -6,7 +6,7 @@ import { VectorStyle } from './vector_style'; import { SYMBOLIZE_AS_CIRCLE, DEFAULT_ICON_SIZE } from './vector_constants'; -import { COLOR_GRADIENTS, DEFAULT_FILL_COLORS, DEFAULT_LINE_COLORS } from '../color_utils'; +import { DEFAULT_FILL_COLORS, DEFAULT_LINE_COLORS } from '../color_utils'; import chrome from 'ui/chrome'; const DEFAULT_ICON = 'airfield'; @@ -114,7 +114,7 @@ export function getDefaultDynamicProperties() { [VECTOR_STYLES.FILL_COLOR]: { type: VectorStyle.STYLE_TYPE.DYNAMIC, options: { - color: COLOR_GRADIENTS[0].value, + color: undefined, field: undefined, fieldMetaOptions: { isEnabled: true, @@ -125,7 +125,7 @@ export function getDefaultDynamicProperties() { [VECTOR_STYLES.LINE_COLOR]: { type: VectorStyle.STYLE_TYPE.DYNAMIC, options: { - color: COLOR_GRADIENTS[0].value, + color: undefined, field: undefined, fieldMetaOptions: { isEnabled: true, @@ -176,7 +176,7 @@ export function getDefaultDynamicProperties() { [VECTOR_STYLES.LABEL_COLOR]: { type: VectorStyle.STYLE_TYPE.STATIC, options: { - color: COLOR_GRADIENTS[0].value, + color: undefined, field: undefined, fieldMetaOptions: { isEnabled: true,