Skip to content

Commit

Permalink
Don't show color schema selection for heatmap tile maps (elastic#44260)…
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-lapata authored Sep 4, 2019
1 parent 6220db0 commit c4e6fa7
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from '../../../kbn_vislib_vis_types/public/components';
import { WmsOptions } from './wms_options';
import { TileMapVisParams } from '../types';
import { MapTypes } from '../map_types';

export type TileMapOptionsProps = { serviceSettings: ServiceSettings } & VisOptionsProps<
TileMapVisParams
Expand Down Expand Up @@ -58,17 +59,7 @@ function TileMapOptions(props: TileMapOptionsProps) {
setValue={setValue}
/>

<SelectOption
label={i18n.translate('tileMap.visParams.colorSchemaLabel', {
defaultMessage: 'Color schema',
})}
options={vis.type.editorConfig.collections.colorSchemas}
paramName="colorSchema"
value={stateParams.colorSchema}
setValue={setValue}
/>

{stateParams.mapType === 'Heatmap' && (
{stateParams.mapType === MapTypes.Heatmap ? (
<RangeOption
label={i18n.translate('tileMap.visParams.clusterSizeLabel', {
defaultMessage: 'Cluster size',
Expand All @@ -80,6 +71,16 @@ function TileMapOptions(props: TileMapOptionsProps) {
value={stateParams.heatClusterSize}
setValue={setValue}
/>
) : (
<SelectOption
label={i18n.translate('tileMap.visParams.colorSchemaLabel', {
defaultMessage: 'Color schema',
})}
options={vis.type.editorConfig.collections.colorSchemas}
paramName="colorSchema"
value={stateParams.colorSchema}
setValue={setValue}
/>
)}

<BasicOptions {...props} />
Expand Down
9 changes: 5 additions & 4 deletions src/legacy/core_plugins/tile_map/public/geohash_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { HeatmapMarkers } from './markers/heatmap';
import { ScaledCirclesMarkers } from './markers/scaled_circles';
import { ShadedCirclesMarkers } from './markers/shaded_circles';
import { GeohashGridMarkers } from './markers/geohash_grid';
import { MapTypes } from './map_types';

export class GeohashLayer extends KibanaMapLayer {

Expand Down Expand Up @@ -54,19 +55,19 @@ export class GeohashLayer extends KibanaMapLayer {
colorRamp: this._geohashOptions.colorRamp
};
switch (this._geohashOptions.mapType) {
case 'Scaled Circle Markers':
case MapTypes.ScaledCircleMarkers:
this._geohashMarkers = new ScaledCirclesMarkers(this._featureCollection,
this._featureCollectionMetaData, markerOptions, this._zoom, this._kibanaMap);
break;
case 'Shaded Circle Markers':
case MapTypes.ShadedCircleMarkers:
this._geohashMarkers = new ShadedCirclesMarkers(this._featureCollection,
this._featureCollectionMetaData, markerOptions, this._zoom, this._kibanaMap);
break;
case 'Shaded Geohash Grid':
case MapTypes.ShadedGeohashGrid:
this._geohashMarkers = new GeohashGridMarkers(this._featureCollection,
this._featureCollectionMetaData, markerOptions, this._zoom, this._kibanaMap);
break;
case 'Heatmap':
case MapTypes.Heatmap:

let radius = 15;
if (this._featureCollectionMetaData.geohashGridDimensionsAtEquator) {
Expand Down
25 changes: 25 additions & 0 deletions src/legacy/core_plugins/tile_map/public/map_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export enum MapTypes {
ScaledCircleMarkers = 'Scaled Circle Markers',
ShadedCircleMarkers = 'Shaded Circle Markers',
ShadedGeohashGrid = 'Shaded Geohash Grid',
Heatmap = 'Heatmap',
}
9 changes: 5 additions & 4 deletions src/legacy/core_plugins/tile_map/public/tile_map_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { convertToGeoJson } from 'ui/vis/map/convert_to_geojson';
import { createTileMapVisualization } from './tile_map_visualization';
import { visFactory } from '../../visualizations/public';
import { TileMapOptions } from './components/tile_map_options';
import { MapTypes } from './map_types';

export function createTileMapTypeDefinition(dependencies) {
const CoordinateMapsVisualization = createTileMapVisualization(dependencies);
Expand Down Expand Up @@ -87,25 +88,25 @@ export function createTileMapTypeDefinition(dependencies) {
}],
mapTypes: [
{
value: 'Scaled Circle Markers',
value: MapTypes.ScaledCircleMarkers,
text: i18n.translate('tileMap.vis.editorConfig.mapTypes.scaledCircleMarkersText', {
defaultMessage: 'Scaled circle markers',
}),
},
{
value: 'Shaded Circle Markers',
value: MapTypes.ShadedCircleMarkers,
text: i18n.translate('tileMap.vis.editorConfig.mapTypes.shadedCircleMarkersText', {
defaultMessage: 'Shaded circle markers',
}),
},
{
value: 'Shaded Geohash Grid',
value: MapTypes.ShadedGeohashGrid,
text: i18n.translate('tileMap.vis.editorConfig.mapTypes.shadedGeohashGridText', {
defaultMessage: 'Shaded geohash grid',
}),
},
{
value: 'Heatmap',
value: MapTypes.Heatmap,
text: i18n.translate('tileMap.vis.editorConfig.mapTypes.heatmapText', {
defaultMessage: 'Heatmap',
}),
Expand Down
3 changes: 2 additions & 1 deletion src/legacy/core_plugins/tile_map/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { TmsLayer } from 'ui/vis/map/service_settings';
import { MapTypes } from './map_types';

export interface WMSOptions {
selectedTmsLayer?: TmsLayer;
Expand All @@ -35,7 +36,7 @@ export interface WMSOptions {

export interface TileMapVisParams {
colorSchema: string;
mapType: 'Scaled Circle Markers' | 'Shaded Circle Markers' | 'Shaded geohash grid' | 'Heatmap';
mapType: MapTypes;
isDesaturated: boolean;
addTooltip: boolean;
heatClusterSize: number;
Expand Down

0 comments on commit c4e6fa7

Please sign in to comment.