mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
use separte colors for each geo field layer (#140344)
This commit is contained in:
parent
b36df1914b
commit
4fa5518ee8
1 changed files with 25 additions and 2 deletions
|
@ -9,7 +9,10 @@ import { FeatureCollection, Feature, Geometry } from 'geojson';
|
|||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { htmlIdGenerator } from '@elastic/eui';
|
||||
import { FIELD_ORIGIN, STYLE_TYPE, LayerDescriptor } from '@kbn/maps-plugin/common';
|
||||
import { ESSearchSourceDescriptor } from '@kbn/maps-plugin/common/descriptor_types';
|
||||
import {
|
||||
ESSearchSourceDescriptor,
|
||||
VectorStyleDescriptor,
|
||||
} from '@kbn/maps-plugin/common/descriptor_types';
|
||||
import type { SerializableRecord } from '@kbn/utility-types';
|
||||
import { fromKueryExpression, luceneStringToDsl, toElasticsearchQuery } from '@kbn/es-query';
|
||||
import { ESSearchResponse } from '@kbn/core/types/elasticsearch';
|
||||
|
@ -20,6 +23,7 @@ import { formatHumanReadableDateTimeSeconds } from '../../common/util/date_utils
|
|||
import type { MlApiServices } from '../application/services/ml_api_service';
|
||||
import { MLAnomalyDoc } from '../../common/types/anomalies';
|
||||
import { SEARCH_QUERY_LANGUAGE } from '../../common/constants/search';
|
||||
import { tabColor } from '../../common/util/group_color_utils';
|
||||
import { getIndexPattern } from '../application/explorer/reducers/explorer_reducer/get_index_pattern';
|
||||
import { AnomalySource } from './anomaly_source';
|
||||
import { SourceIndexGeoFields } from '../application/explorer/explorer_utils';
|
||||
|
@ -119,9 +123,28 @@ export function getInitialSourceIndexFieldLayers(sourceIndexWithGeoFields: Sourc
|
|||
const { dataViewId, geoFields } = sourceIndexWithGeoFields[index];
|
||||
|
||||
geoFields.forEach((geoField) => {
|
||||
const color = tabColor(geoField);
|
||||
|
||||
initialLayers.push({
|
||||
id: htmlIdGenerator()(),
|
||||
type: LAYER_TYPE.MVT_VECTOR,
|
||||
type: LAYER_TYPE.GEOJSON_VECTOR,
|
||||
style: {
|
||||
type: 'VECTOR',
|
||||
properties: {
|
||||
fillColor: {
|
||||
type: 'STATIC',
|
||||
options: {
|
||||
color,
|
||||
},
|
||||
},
|
||||
lineColor: {
|
||||
type: 'STATIC',
|
||||
options: {
|
||||
color,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as VectorStyleDescriptor,
|
||||
sourceDescriptor: {
|
||||
id: htmlIdGenerator()(),
|
||||
type: SOURCE_TYPES.ES_SEARCH,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue