Skip to content

Commit

Permalink
[Maps] hide map visualization types with default kibana.yml settings (#…
Browse files Browse the repository at this point in the history
…49103) (#49585)

* [Maps] hide map visualization types with default kibana.yml settings

* add docs explaining xpack.maps.showMapVisualizationTypes

* clean up docs

* fix docs build

* fix typescript failures

* move docs to troubleshooting section

* add message about xpack.maps.showMapVisualizationTypes in coordinate map and region map docs

* doc updates based on gchaps feedback

* Update docs/visualize/regionmap.asciidoc

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/visualize/tilemap.asciidoc

Co-Authored-By: gchaps <33642766+gchaps@users.noreply.github.com>
  • Loading branch information
nreese and gchaps authored Oct 29, 2019
1 parent 7a755d0 commit eb23b46
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 13 deletions.
5 changes: 5 additions & 0 deletions docs/maps/trouble-shooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ image::maps/images/inspector.png[]
* Ensure your tile server has configured https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS[Cross-Origin Resource Sharing (CORS)] so tile requests from your Kibana domain have permission to access your tile server domain.
* Ensure tiles have the required coordinate system. Vector data must use EPSG:4326 and tiles must use EPSG:3857.

[float]
==== Coordinate and region map visualizations not available in New Visualization menu

Kibana’s out-of-the-box settings no longer offers coordinate and region maps as a choice in the New Visualization menu because you can create these maps in *Elastic Maps*.
If you want to create new coordinate and region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

17 changes: 10 additions & 7 deletions docs/visualize/regionmap.asciidoc
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
[[regionmap]]
== Region Maps

Region maps are thematic maps in which boundary vector shapes are colored using a gradient:
higher intensity colors indicate larger values, and lower intensity colors indicate smaller values.
These are also known as choropleth maps.
Region maps are thematic maps in which boundary vector shapes are colored using a gradient:
higher intensity colors indicate larger values, and lower intensity colors indicate smaller values.
These are also known as choropleth maps.

Kibana’s out-of-the-box settings do not show a region map in the New Visualization menu. Use <<maps>> instead, which offers more functionality and is easier to use.
If you want to create new region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

image::images/regionmap.png[]

[float]
[[regionmap-configuration]]
=== Configuration

To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation
To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation
and a reference vector file based on a shared key.

[float]
Expand All @@ -23,7 +26,7 @@ and a reference vector file based on a shared key.
Select any of the supported _Metric_ or _Sibling Pipeline Aggregations_.

[float]
===== Buckets
===== Buckets

Configure a _Terms_ aggregation. The term is the _key_ that is used to join the results to the vector data on the map.

Expand All @@ -35,7 +38,7 @@ Configure a _Terms_ aggregation. The term is the _key_ that is used to join the
- *Vector map*: select from a list of vector maps. This list includes the maps that are hosted by the © https://www.elastic.co/elastic-maps-service[Elastic Maps Service],
as well as your self-hosted layers that are configured in the *config/kibana.yml* file. To learn more about how to configure Kibana
to make self-hosted layers available, see the <<regionmap-settings,regionmap settings>> documentation. You can also explore and preview vector layers available in Elastic Maps Service at https://maps.elastic.co[https://maps.elastic.co].
- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation.
- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation.
When terms cannot be joined to any of the shapes in the vector layer because there is no exact match in the vector layer, Kibana will display a warning.
To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `visualization:regionmap:showWarnings` to `false`.

Expand All @@ -46,4 +49,4 @@ To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `
[float]
===== Basic Settings
- *Legend Position*: the location on the screen where the legend should be rendered.
- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape..
- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape..
5 changes: 4 additions & 1 deletion docs/visualize/tilemap.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

A coordinate map displays a geographic area overlaid with circles keyed to the data determined by the buckets you specify.

NOTE: By default, Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service]
Kibana’s out-of-the-box settings do not show a coordinate map in the New Visualization menu. Use <<maps>> instead, which offers more functionality and is easier to use.
If you want to create new coordinate map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service]
to display map tiles. To use other tile service providers, configure the <<tilemap-settings,tilemap settings>>
in `kibana.yml`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const createSetupContract = (): VisualizationsSetup => ({
types: {
registerVisualization: jest.fn(),
registerAlias: jest.fn(),
hideTypes: jest.fn(),
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,30 @@ export interface VisType {
*/
export class TypesService {
private types: Record<string, VisType> = {};
private unregisteredHiddenTypes: string[] = [];
public setup() {
return {
registerVisualization: (registerFn: () => VisType) => {
const visDefinition = registerFn();
if (this.unregisteredHiddenTypes.includes(visDefinition.name)) {
visDefinition.hidden = true;
}

if (this.types[visDefinition.name]) {
throw new Error('type already exists!');
}
this.types[visDefinition.name] = visDefinition;
},
registerAlias: visTypeAliasRegistry.add,
hideTypes: (typeNames: string[]) => {
typeNames.forEach((name: string) => {
if (this.types[name]) {
this.types[name].hidden = true;
} else {
this.unregisteredHiddenTypes.push(name);
}
});
},
};
}

Expand Down
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function maps(kibana) {
const mapConfig = serverConfig.get('map');

return {
showMapVisualizationTypes: serverConfig.get('xpack.maps.showMapVisualizationTypes'),
showMapsInspectorAdapter: serverConfig.get('xpack.maps.showMapsInspectorAdapter'),
preserveDrawingBuffer: serverConfig.get('xpack.maps.preserveDrawingBuffer'),
isEmsEnabled: mapConfig.includeElasticMapsService,
Expand Down Expand Up @@ -92,6 +93,7 @@ export function maps(kibana) {
config(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
showMapVisualizationTypes: Joi.boolean().default(false),
showMapsInspectorAdapter: Joi.boolean().default(false), // flag used in functional testing
preserveDrawingBuffer: Joi.boolean().default(false), // flag used in functional testing
}).default();
Expand Down
24 changes: 19 additions & 5 deletions x-pack/legacy/plugins/maps/public/register_vis_type_alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,35 @@
* you may not use this file except in compliance with the Elastic License.
*/

import chrome from 'ui/chrome';
import { setup as visualizationsSetup } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants';

const showMapVisualizationTypes = chrome.getInjected('showMapVisualizationTypes', false);

const description = i18n.translate('xpack.maps.visTypeAlias.description', {
defaultMessage: 'Create and style maps with multiple layers and indices.',
});

const legacyMapVisualizationWarning = i18n.translate('xpack.maps.visTypeAlias.legacyMapVizWarning', {
defaultMessage: `Use the Maps app instead of Coordinate Map and Region Map.
The Maps app offers more functionality and is easier to use.`,
});

visualizationsSetup.types.registerAlias({
aliasUrl: MAP_BASE_URL,
name: APP_ID,
title: i18n.translate('xpack.maps.visTypeAlias.title', {
defaultMessage: 'Maps',
}),
description: i18n.translate('xpack.maps.visTypeAlias.description', {
defaultMessage: `Create and style maps with multiple layers and indices.
Use the Maps app instead of Coordinate Map and Region Map.
The Maps app offers more functionality and is easier to use.`,
}),
description: showMapVisualizationTypes
? `${description} ${legacyMapVisualizationWarning}`
: description,
icon: APP_ICON,
stage: 'production',
});

if (!showMapVisualizationTypes) {
visualizationsSetup.types.hideTypes(['region_map', 'tile_map']);
}

0 comments on commit eb23b46

Please sign in to comment.