').addClass('tilemap-legend');
- $wrapper.append($div);
-
- const titleText = self.getLabel();
- const $title = $('
').addClass('tilemap-legend-title').text(titleText);
- $div.append($title);
-
- _.each(self._legendColors, function (color) {
- const labelText = self._legendQuantizer
- .invertExtent(color)
- .map(self._valueFormatter)
- .join(' – ');
-
- const label = $('
');
-
- const icon = $('').css({
- background: color,
- 'border-color': self.darkerColor(color)
- });
-
- const text = $('').text(labelText);
-
- label.append(icon);
- label.append(text);
- $div.append(label);
- });
-
- return $wrapper.get(0);
- };
-
- self._legend.addTo(self.map);
- }
-
- /**
- * Apply style with shading to feature
- *
- * @method applyShadingStyle
- * @param value {Object}
- * @return {Object}
- */
- applyShadingStyle(value) {
- const color = this._legendQuantizer(value);
-
- return {
- fillColor: color,
- color: this.darkerColor(color),
- weight: 1.5,
- opacity: 1,
- fillOpacity: 0.75
- };
- }
-
- /**
- * Binds popup and events to each feature on map
- *
- * @method bindPopup
- * @param feature {Object}
- * @param layer {Object}
- * return {undefined}
- */
- bindPopup(feature, layer) {
- const self = this;
-
- const popup = layer.on({
- mouseover: function (e) {
- const layer = e.target;
- // bring layer to front if not older browser
- if (!L.Browser.ie && !L.Browser.opera) {
- layer.bringToFront();
- }
- self._showTooltip(feature);
- },
- mouseout: function () {
- self._hidePopup();
- }
- });
-
- self.popups.push(popup);
- }
-
- /**
- * d3 method returns a darker hex color,
- * used for marker stroke color
- *
- * @method darkerColor
- * @param color {String} hex color
- * @param amount? {Number} amount to darken by
- * @return {String} hex color
- */
- darkerColor(color, amount) {
- amount = amount || 1.3;
- return d3.hcl(color).darker(amount).toString();
- }
-
- destroy() {
- const self = this;
-
- // remove popups
- self.popups = self.popups.filter(function (popup) {
- popup.off('mouseover').off('mouseout');
- });
-
- if (self._legend) {
- self.map.removeControl(self._legend);
- self._legend = undefined;
- }
-
- // remove marker layer from map
- if (self._markerGroup) {
- self.map.removeLayer(self._markerGroup);
- self._markerGroup = undefined;
- }
- }
-
- _addToMap() {
- this.map.addLayer(this._markerGroup);
- }
-
- /**
- * Creates leaflet marker group, passing options to L.geoJson
- *
- * @method _createMarkerGroup
- * @param options {Object} Options to pass to L.geoJson
- */
- _createMarkerGroup(options) {
- const self = this;
- const defaultOptions = {
- onEachFeature: function (feature, layer) {
- self.bindPopup(feature, layer);
- },
- style: function (feature) {
- const value = _.get(feature, 'properties.value');
- return self.applyShadingStyle(value);
- },
- filter: self._filterToMapBounds()
- };
-
- this._markerGroup = L.geoJson(this.geoJson, _.defaults(defaultOptions, options));
- this._addToMap();
- }
-
- /**
- * return whether feature is within map bounds
- *
- * @method _filterToMapBounds
- * @param map {Leaflet Object}
- * @return {boolean}
- */
- _filterToMapBounds() {
- const self = this;
- return function (feature) {
- const mapBounds = self.map.getBounds();
- const bucketRectBounds = _.get(feature, 'properties.rectangle');
- return mapBounds.intersects(bucketRectBounds);
- };
- }
-
- /**
- * Checks if event latlng is within bounds of mapData
- * features and shows tooltip for that feature
- *
- * @method _showTooltip
- * @param feature {LeafletFeature}
- * @param latLng? {Leaflet latLng}
- * @return undefined
- */
- _showTooltip(feature, latLng) {
- const hasMap = !!this.map;
- const hasTooltip = !!this._attr.addTooltip;
- if (!hasMap || !hasTooltip) {
- return;
- }
- const lat = _.get(feature, 'geometry.coordinates.1');
- const lng = _.get(feature, 'geometry.coordinates.0');
- latLng = latLng || L.latLng(lat, lng);
-
- const content = this._tooltipFormatter(feature);
-
- if (!content) return;
- this._createTooltip(content, latLng);
- }
-
- _createTooltip(content, latLng) {
- this._popup = L.popup({ autoPan: false });
- this._popup.setLatLng(latLng)
- .setContent(content)
- .openOn(this.map);
- }
-
- /**
- * Closes the tooltip on the map
- *
- * @method _hidePopup
- * @return undefined
- */
- _hidePopup() {
- if (!this.map) return;
-
- this._popup = null;
- this.map.closePopup();
- }
-
- /**
- * d3 quantize scale returns a hex color, used for marker fill color
- *
- * @method quantizeLegendColors
- * return {undefined}
- */
- quantizeLegendColors() {
- const min = _.get(this.geoJson, 'properties.allmin', 0);
- const max = _.get(this.geoJson, 'properties.allmax', 1);
- const quantizeDomain = (min !== max) ? [min, max] : d3.scale.quantize().domain();
-
- const reds1 = ['#ff6128'];
- const reds3 = ['#fecc5c', '#fd8d3c', '#e31a1c'];
- const reds5 = ['#fed976', '#feb24c', '#fd8d3c', '#f03b20', '#bd0026'];
- const bottomCutoff = 2;
- const middleCutoff = 24;
-
- if (max - min <= bottomCutoff) {
- this._legendColors = reds1;
- } else if (max - min <= middleCutoff) {
- this._legendColors = reds3;
- } else {
- this._legendColors = reds5;
- }
-
- this._legendQuantizer = d3.scale.quantize().domain(quantizeDomain).range(this._legendColors);
- }
- }
-
- return BaseMarker;
-}
diff --git a/src/ui/public/vis_maps/visualizations/marker_types/geohash_grid.js b/src/ui/public/vis_maps/visualizations/marker_types/geohash_grid.js
deleted file mode 100644
index 99f63311b6873..0000000000000
--- a/src/ui/public/vis_maps/visualizations/marker_types/geohash_grid.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import L from 'leaflet';
-import VislibVisualizationsMarkerTypesBaseMarkerProvider from './base_marker';
-export default function GeohashGridMarkerFactory(Private) {
-
- const BaseMarker = Private(VislibVisualizationsMarkerTypesBaseMarkerProvider);
-
- /**
- * Map overlay: rectangles that show the geohash grid bounds
- *
- * @param map {Leaflet Object}
- * @param geoJson {geoJson Object}
- * @param params {Object}
- */
- class GeohashGridMarker extends BaseMarker {
- constructor(map, geoJson, params) {
- super(map, geoJson, params);
-
- this._createMarkerGroup({
- pointToLayer: function (feature) {
- const geohashRect = feature.properties.rectangle;
- // get bounds from northEast[3] and southWest[1]
- // corners in geohash rectangle
- const corners = [
- [geohashRect[3][0], geohashRect[3][1]],
- [geohashRect[1][0], geohashRect[1][1]]
- ];
- return L.rectangle(corners);
- }
- });
- }
- }
-
- return GeohashGridMarker;
-}
diff --git a/src/ui/public/vis_maps/visualizations/marker_types/heatmap.js b/src/ui/public/vis_maps/visualizations/marker_types/heatmap.js
deleted file mode 100644
index 46507c47c9607..0000000000000
--- a/src/ui/public/vis_maps/visualizations/marker_types/heatmap.js
+++ /dev/null
@@ -1,206 +0,0 @@
-import d3 from 'd3';
-import _ from 'lodash';
-import L from 'leaflet';
-import VislibVisualizationsMarkerTypesBaseMarkerProvider from './base_marker';
-export default function HeatmapMarkerFactory(Private) {
-
- const BaseMarker = Private(VislibVisualizationsMarkerTypesBaseMarkerProvider);
-
- /**
- * Map overlay: canvas layer with leaflet.heat plugin
- *
- * @param map {Leaflet Object}
- * @param geoJson {geoJson Object}
- * @param params {Object}
- */
- class HeatmapMarker extends BaseMarker {
- constructor(map, geoJson, params) {
- super(map, geoJson, params);
- this._disableTooltips = false;
-
- this._createMarkerGroup({
- radius: +this._attr.heatRadius,
- blur: +this._attr.heatBlur,
- maxZoom: +this._attr.heatMaxZoom,
- minOpacity: +this._attr.heatMinOpacity
- });
-
- this.addLegend = _.noop;
-
- this._getLatLng = _.memoize(function (feature) {
- return L.latLng(
- feature.geometry.coordinates[1],
- feature.geometry.coordinates[0]
- );
- }, function (feature) {
- // turn coords into a string for the memoize cache
- return [feature.geometry.coordinates[1], feature.geometry.coordinates[0]].join(',');
- });
- }
-
- _createMarkerGroup(options) {
- const max = _.get(this.geoJson, 'properties.allmax');
- const points = this._dataToHeatArray(max);
-
- this._markerGroup = L.heatLayer(points, options);
- this._fixTooltips();
- this._addToMap();
- }
-
- _fixTooltips() {
- const self = this;
- const debouncedMouseMoveLocation = _.debounce(mouseMoveLocation.bind(this), 15, {
- 'leading': true,
- 'trailing': false
- });
-
- if (!this._disableTooltips && this._attr.addTooltip) {
- this.map.on('mousemove', debouncedMouseMoveLocation);
- this.map.on('mouseout', function () {
- self.map.closePopup();
- });
- this.map.on('mousedown', function () {
- self._disableTooltips = true;
- self.map.closePopup();
- });
- this.map.on('mouseup', function () {
- self._disableTooltips = false;
- });
- }
-
- function mouseMoveLocation(e) {
- const latlng = e.latlng;
- // unhighlight all svgs
- d3.selectAll('path.geohash', this.chartEl).classed('geohash-hover', false);
-
- if (!this.geoJson.features.length || this._disableTooltips) {
- this._hidePopup();
- return;
- }
-
- // find nearest feature to event latlng
- const feature = this._nearestFeature(latlng);
-
- // show tooltip if close enough to event latlng
- if (this._tooltipProximity(latlng, feature)) {
- if (this.currentFeature !== feature) {
- this._hidePopup();
- this.currentFeature = feature;
- this._showTooltip(feature, latlng);
- } else {
- if (this._popup) {
- this._popup.setLatLng(latlng);
- }
- }
- } else {
- this._hidePopup();
- this.currentFeature = null;
- }
- }
- }
-
- /**
- * Finds nearest feature in mapData to event latlng
- *
- * @method _nearestFeature
- * @param latLng {Leaflet latLng}
- * @return nearestPoint {Leaflet latLng}
- */
- _nearestFeature(latLng) {
- const self = this;
- let nearest;
-
- if (latLng.lng < -180 || latLng.lng > 180) {
- return;
- }
-
- _.reduce(this.geoJson.features, function (distance, feature) {
- const featureLatLng = self._getLatLng(feature);
- const dist = latLng.distanceTo(featureLatLng);
-
- if (dist < distance) {
- nearest = feature;
- return dist;
- }
-
- return distance;
- }, Infinity);
-
- return nearest;
- }
-
- /**
- * display tooltip if feature is close enough to event latlng
- *
- * @method _tooltipProximity
- * @param latlng {Leaflet latLng Object}
- * @param feature {geoJson Object}
- * @return {Boolean}
- */
- _tooltipProximity(latlng, feature) {
- if (!feature) return;
-
- let showTip = false;
- const featureLatLng = this._getLatLng(feature);
-
- // zoomScale takes map zoom and returns proximity value for tooltip display
- // domain (input values) is map zoom (min 1 and max 18)
- // range (output values) is distance in meters
- // used to compare proximity of event latlng to feature latlng
- const zoomScale = d3.scale.linear()
- .domain([1, 4, 7, 10, 13, 16, 18])
- .range([1000000, 300000, 100000, 15000, 2000, 150, 50]);
-
- const proximity = zoomScale(this.map.getZoom());
- const distance = latlng.distanceTo(featureLatLng);
-
- // maxLngDif is max difference in longitudes
- // to prevent feature tooltip from appearing 360°
- // away from event latlng
- const maxLngDif = 40;
- const lngDif = Math.abs(latlng.lng - featureLatLng.lng);
-
- if (distance < proximity && lngDif < maxLngDif) {
- showTip = true;
- }
-
- d3.scale.pow().exponent(0.2)
- .domain([1, 18])
- .range([1500000, 50]);
- return showTip;
- }
-
-
- /**
- * returns data for data for heat map intensity
- * if heatNormalizeData attribute is checked/true
- • normalizes data for heat map intensity
- *
- * @method _dataToHeatArray
- * @param max {Number}
- * @return {Array}
- */
- _dataToHeatArray(max) {
- const self = this;
-
- return this.geoJson.features.map(function (feature) {
- const lat = feature.properties.center[0];
- const lng = feature.properties.center[1];
- let heatIntensity;
-
- if (!self._attr.heatNormalizeData) {
- // show bucket value on heatmap
- heatIntensity = feature.properties.value;
- } else {
- // show bucket value normalized to max value
- heatIntensity = feature.properties.value / max;
- }
-
- return [lat, lng, heatIntensity];
- });
- }
- }
-
-
- return HeatmapMarker;
-}
diff --git a/src/ui/public/vis_maps/visualizations/marker_types/scaled_circles.js b/src/ui/public/vis_maps/visualizations/marker_types/scaled_circles.js
deleted file mode 100644
index 7eed1d6653977..0000000000000
--- a/src/ui/public/vis_maps/visualizations/marker_types/scaled_circles.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import _ from 'lodash';
-import L from 'leaflet';
-import VislibVisualizationsMarkerTypesBaseMarkerProvider from './base_marker';
-export default function ScaledCircleMarkerFactory(Private) {
-
- const BaseMarker = Private(VislibVisualizationsMarkerTypesBaseMarkerProvider);
-
- /**
- * Map overlay: circle markers that are scaled to illustrate values
- *
- * @param map {Leaflet Object}
- * @param mapData {geoJson Object}
- * @param params {Object}
- */
- class ScaledCircleMarker extends BaseMarker {
- constructor(map, geoJson, params) {
- super(map, geoJson, params);
-
- // multiplier to reduce size of all circles
- const scaleFactor = 0.6;
-
- this._createMarkerGroup({
- pointToLayer: (feature, latlng) => {
- const value = feature.properties.value;
- const scaledRadius = this._radiusScale(value) * scaleFactor;
- return L.circleMarker(latlng).setRadius(scaledRadius);
- }
- });
- }
-
- /**
- * radiusScale returns a number for scaled circle markers
- * for relative sizing of markers
- *
- * @method _radiusScale
- * @param value {Number}
- * @return {Number}
- */
- _radiusScale(value) {
- const precisionBiasBase = 5;
- const precisionBiasNumerator = 200;
- const zoom = this.map.getZoom();
- const maxValue = this.geoJson.properties.allmax;
- const precision = _.max(this.geoJson.features.map(function (feature) {
- return String(feature.properties.geohash).length;
- }));
-
- const pct = Math.abs(value) / Math.abs(maxValue);
- const zoomRadius = 0.5 * Math.pow(2, zoom);
- const precisionScale = precisionBiasNumerator / Math.pow(precisionBiasBase, precision);
-
- // square root value percentage
- return Math.pow(pct, 0.5) * zoomRadius * precisionScale;
- }
- }
-
-
- return ScaledCircleMarker;
-}
diff --git a/src/ui/public/vis_maps/visualizations/marker_types/shaded_circles.js b/src/ui/public/vis_maps/visualizations/marker_types/shaded_circles.js
deleted file mode 100644
index a498056af1070..0000000000000
--- a/src/ui/public/vis_maps/visualizations/marker_types/shaded_circles.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import _ from 'lodash';
-import L from 'leaflet';
-import VislibVisualizationsMarkerTypesBaseMarkerProvider from './base_marker';
-export default function ShadedCircleMarkerFactory(Private) {
-
- const BaseMarker = Private(VislibVisualizationsMarkerTypesBaseMarkerProvider);
-
- /**
- * Map overlay: circle markers that are shaded to illustrate values
- *
- * @param map {Leaflet Object}
- * @param mapData {geoJson Object}
- * @return {Leaflet object} featureLayer
- */
- class ShadedCircleMarker extends BaseMarker {
- constructor(map, geoJson, params) {
- super(map, geoJson, params);
-
- // multiplier to reduce size of all circles
- const scaleFactor = 0.8;
-
- this._createMarkerGroup({
- pointToLayer: (feature, latlng) => {
- const radius = this._geohashMinDistance(feature) * scaleFactor;
- return L.circle(latlng, radius);
- }
- });
- }
-
-
- /**
- * _geohashMinDistance returns a min distance in meters for sizing
- * circle markers to fit within geohash grid rectangle
- *
- * @method _geohashMinDistance
- * @param feature {Object}
- * @return {Number}
- */
- _geohashMinDistance(feature) {
- const centerPoint = _.get(feature, 'properties.center');
- const geohashRect = _.get(feature, 'properties.rectangle');
-
- // centerPoint is an array of [lat, lng]
- // geohashRect is the 4 corners of the geoHash rectangle
- // an array that starts at the southwest corner and proceeds
- // clockwise, each value being an array of [lat, lng]
-
- // center lat and southeast lng
- const east = L.latLng([centerPoint[0], geohashRect[2][1]]);
- // southwest lat and center lng
- const north = L.latLng([geohashRect[3][0], centerPoint[1]]);
-
- // get latLng of geohash center point
- const center = L.latLng([centerPoint[0], centerPoint[1]]);
-
- // get smallest radius at center of geohash grid rectangle
- const eastRadius = Math.floor(center.distanceTo(east));
- const northRadius = Math.floor(center.distanceTo(north));
- return _.min([eastRadius, northRadius]);
- }
- }
-
-
- return ShadedCircleMarker;
-}
diff --git a/src/ui/public/vis_maps/visualizations/tile_map.js b/src/ui/public/vis_maps/visualizations/tile_map.js
deleted file mode 100644
index 1c423d6fee24a..0000000000000
--- a/src/ui/public/vis_maps/visualizations/tile_map.js
+++ /dev/null
@@ -1,128 +0,0 @@
-import _ from 'lodash';
-import $ from 'jquery';
-import VislibVisualizationsChartProvider from './_chart';
-import VislibVisualizationsMapProvider from './_map';
-export default function TileMapFactory(Private) {
-
- const Chart = Private(VislibVisualizationsChartProvider);
- const TileMapMap = Private(VislibVisualizationsMapProvider);
-
- /**
- * Tile Map Visualization: renders maps
- *
- * @class TileMap
- * @constructor
- * @extends Chart
- * @param handler {Object} Reference to the Handler Class Constructor
- * @param chartEl {HTMLElement} HTML element to which the map will be appended
- * @param chartData {Object} Elasticsearch query results for this map
- */
- class TileMap extends Chart {
- constructor(handler, chartEl, chartData) {
- super(handler, chartEl, chartData);
-
- // track the map objects
- this.maps = [];
- this._chartData = chartData || {};
- _.assign(this, this._chartData);
-
- this._appendGeoExtents();
- }
-
- /**
- * Draws tile map, called on chart render
- *
- * @method draw
- * @return {Function} - function to add a map to a selection
- */
- draw() {
- const self = this;
-
- return function (selection) {
- selection.each(function () {
- self._appendMap(this);
- });
- };
- }
-
- /**
- * Invalidate the size of the map, so that leaflet will resize to fit.
- * then moves to center
- *
- * @method resizeArea
- * @return {undefined}
- */
- resizeArea() {
- this.maps.forEach(function (map) {
- map.updateSize();
- });
- }
-
- /**
- * clean up the maps
- *
- * @method destroy
- * @return {undefined}
- */
- destroy() {
- this.maps = this.maps.filter(function (map) {
- map.destroy();
- });
- }
-
- /**
- * Adds allmin and allmax properties to geoJson data
- *
- * @method _appendMap
- * @param selection {Object} d3 selection
- */
- _appendGeoExtents() {
- // add allmin and allmax to geoJson
- const geoMinMax = this.handler.data.getGeoExtents();
- this.geoJson.properties.allmin = geoMinMax.min;
- this.geoJson.properties.allmax = geoMinMax.max;
- }
-
- /**
- * Renders map
- *
- * @method _appendMap
- * @param selection {Object} d3 selection
- */
- _appendMap(selection) {
- const container = $(selection).addClass('tilemap');
- const uiStateParams = {
- mapCenter: this.handler.uiState.get('mapCenter'),
- mapZoom: this.handler.uiState.get('mapZoom')
- };
-
- const params = _.assign({}, _.get(this._chartData, 'geoAgg.vis.params'), uiStateParams);
-
- const tooltipFormatter = this.handler.visConfig.get('addTooltip') ? this.tooltipFormatter : null;
- const map = new TileMapMap(container, this._chartData, {
- center: params.mapCenter,
- zoom: params.mapZoom,
- events: this.events,
- markerType: this.handler.visConfig.get('mapType'),
- tooltipFormatter: tooltipFormatter,
- valueFormatter: this.valueFormatter,
- attr: this.handler.visConfig._values
- });
-
- // add title for splits
- if (this.title) {
- map.addTitle(this.title);
- }
-
- // add fit to bounds control
- if (_.get(this.geoJson, 'features.length') > 0) {
- map.addFitControl();
- map.addBoundingControl();
- }
-
- this.maps.push(map);
- }
- }
-
- return TileMap;
-}
diff --git a/test/functional/apps/visualize/_tile_map.js b/test/functional/apps/visualize/_tile_map.js
deleted file mode 100644
index 586e121049797..0000000000000
--- a/test/functional/apps/visualize/_tile_map.js
+++ /dev/null
@@ -1,330 +0,0 @@
-
-import expect from 'expect.js';
-
-import { bdd } from '../../../support';
-
-import PageObjects from '../../../support/page_objects';
-
-bdd.describe('visualize app', function describeIndexTests() {
- const fromTime = '2015-09-19 06:31:44.000';
- const toTime = '2015-09-23 18:31:44.000';
-
- bdd.before(function () {
-
- PageObjects.common.debug('navigateToApp visualize');
- return PageObjects.common.navigateToUrl('visualize', 'new')
- .then(function () {
- PageObjects.common.debug('clickTileMap');
- return PageObjects.visualize.clickTileMap();
- })
- .then(function () {
- return PageObjects.visualize.clickNewSearch();
- })
- .then(function () {
- PageObjects.common.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
- return PageObjects.header.setAbsoluteRange(fromTime, toTime);
- })
- .then(function () {
- PageObjects.common.debug('select bucket Geo Coordinates');
- return PageObjects.visualize.clickBucket('Geo Coordinates');
- })
- .then(function () {
- PageObjects.common.debug('Click aggregation Geohash');
- return PageObjects.visualize.selectAggregation('Geohash');
- })
- .then(function () {
- PageObjects.common.debug('Click field geo.coordinates');
- return PageObjects.common.try(function tryingForTime() {
- return PageObjects.visualize.selectField('geo.coordinates');
- });
- })
- .then(function () {
- return PageObjects.visualize.clickGo();
- })
- .then(function () {
- return PageObjects.header.waitUntilLoadingHasFinished();
- });
- });
-
- bdd.describe('tile map chart', function indexPatternCreation() {
-
- bdd.it('should show correct tile map data on default zoom level', function () {
- const expectedTableData = [ 'dn 1,429', 'dp 1,418', '9y 1,215', '9z 1,099', 'dr 1,076',
- 'dj 982', '9v 938', '9q 722', '9w 475', 'cb 457', 'c2 453', '9x 420', 'dq 399',
- '9r 396', '9t 274', 'c8 271', 'dh 214', 'b6 207', 'bd 206', 'b7 167', 'f0 141',
- 'be 128', '9m 126', 'bf 85', 'de 73', 'bg 71', '9p 71', 'c1 57', 'c4 50', '9u 48',
- 'f2 46', '8e 45', 'b3 38', 'bs 36', 'c0 31', '87 28', 'bk 23', '8f 18', 'b5 14',
- '84 14', 'dx 9', 'bu 9', 'b1 9', 'b4 6', '9n 3', '8g 3'
- ];
-
- return PageObjects.visualize.collapseChart()
- .then(function () {
- return PageObjects.settings.setPageSize('All');
- })
- .then(function getDataTableData() {
- return PageObjects.visualize.getDataTableData()
- .then(function showData(data) {
- expect(data.trim().split('\n')).to.eql(expectedTableData);
- return PageObjects.visualize.collapseChart();
- });
- });
- });
-
-
- bdd.it('should zoom out to level 1 from default level 2', function () {
- const expectedPrecision2Circles = [ { color: '#750000', radius: 48 },
- { color: '#750000', radius: 48 },
- { color: '#750000', radius: 44 },
- { color: '#a40000', radius: 42 },
- { color: '#a40000', radius: 42 },
- { color: '#a40000', radius: 40 },
- { color: '#a40000', radius: 39 },
- { color: '#b45100', radius: 34 },
- { color: '#b67501', radius: 28 },
- { color: '#b67501', radius: 27 },
- { color: '#b67501', radius: 27 },
- { color: '#b67501', radius: 26 },
- { color: '#b67501', radius: 25 },
- { color: '#b67501', radius: 25 },
- { color: '#b99939', radius: 21 },
- { color: '#b99939', radius: 21 },
- { color: '#b99939', radius: 19 },
- { color: '#b99939', radius: 18 },
- { color: '#b99939', radius: 18 },
- { color: '#b99939', radius: 16 },
- { color: '#b99939', radius: 15 },
- { color: '#b99939', radius: 14 },
- { color: '#b99939', radius: 14 },
- { color: '#b99939', radius: 12 },
- { color: '#b99939', radius: 11 },
- { color: '#b99939', radius: 11 },
- { color: '#b99939', radius: 11 },
- { color: '#b99939', radius: 10 },
- { color: '#b99939', radius: 9 },
- { color: '#b99939', radius: 9 },
- { color: '#b99939', radius: 9 },
- { color: '#b99939', radius: 9 },
- { color: '#b99939', radius: 8 },
- { color: '#b99939', radius: 8 },
- { color: '#b99939', radius: 7 },
- { color: '#b99939', radius: 7 },
- { color: '#b99939', radius: 6 },
- { color: '#b99939', radius: 5 },
- { color: '#b99939', radius: 5 },
- { color: '#b99939', radius: 5 },
- { color: '#b99939', radius: 4 },
- { color: '#b99939', radius: 4 },
- { color: '#b99939', radius: 4 },
- { color: '#b99939', radius: 3 },
- { color: '#b99939', radius: 2 },
- { color: '#b99939', radius: 2 }
- ];
-
- return PageObjects.visualize.clickMapZoomOut()
- .then(function () {
- return PageObjects.visualize.getMapZoomOutEnabled();
- })
- // we can tell we're at level 1 because zoom out is disabled
- .then(function () {
- return PageObjects.common.try(function tryingForTime() {
- return PageObjects.visualize.getMapZoomOutEnabled()
- .then(function (enabled) {
- //should be able to zoom more as current config has 0 as min level.
- expect(enabled).to.be(true);
- });
- });
- })
- .then(function () {
- return PageObjects.common.try(function tryingForTime() {
- return PageObjects.visualize.getTileMapData()
- .then(function (data) {
- expect(data).to.eql(expectedPrecision2Circles);
- });
- });
- })
- .then(function takeScreenshot() {
- PageObjects.common.debug('Take screenshot (success)');
- PageObjects.common.saveScreenshot('map-after-zoom-from-1-to-2');
- });
- });
-
- bdd.it('Fit data bounds should zoom to level 3', function () {
- const expectedPrecision2ZoomCircles = [ { color: '#750000', radius: 192 },
- { color: '#750000', radius: 191 },
- { color: '#750000', radius: 177 },
- { color: '#a40000', radius: 168 },
- { color: '#a40000', radius: 167 },
- { color: '#a40000', radius: 159 },
- { color: '#a40000', radius: 156 },
- { color: '#b45100', radius: 136 },
- { color: '#b67501', radius: 111 },
- { color: '#b67501', radius: 109 },
- { color: '#b67501', radius: 108 },
- { color: '#b67501', radius: 104 },
- { color: '#b67501', radius: 101 },
- { color: '#b67501', radius: 101 },
- { color: '#b99939', radius: 84 },
- { color: '#b99939', radius: 84 },
- { color: '#b99939', radius: 74 },
- { color: '#b99939', radius: 73 },
- { color: '#b99939', radius: 73 },
- { color: '#b99939', radius: 66 },
- { color: '#b99939', radius: 60 },
- { color: '#b99939', radius: 57 },
- { color: '#b99939', radius: 57 },
- { color: '#b99939', radius: 47 },
- { color: '#b99939', radius: 43 },
- { color: '#b99939', radius: 43 },
- { color: '#b99939', radius: 43 },
- { color: '#b99939', radius: 38 },
- { color: '#b99939', radius: 36 },
- { color: '#b99939', radius: 35 },
- { color: '#b99939', radius: 34 },
- { color: '#b99939', radius: 34 },
- { color: '#b99939', radius: 31 },
- { color: '#b99939', radius: 30 },
- { color: '#b99939', radius: 28 },
- { color: '#b99939', radius: 27 },
- { color: '#b99939', radius: 24 },
- { color: '#b99939', radius: 22 },
- { color: '#b99939', radius: 19 },
- { color: '#b99939', radius: 19 },
- { color: '#b99939', radius: 15 },
- { color: '#b99939', radius: 15 },
- { color: '#b99939', radius: 15 },
- { color: '#b99939', radius: 12 },
- { color: '#b99939', radius: 9 },
- { color: '#b99939', radius: 9 }
- ];
-
- return PageObjects.visualize.clickMapFitDataBounds()
- .then(function () {
- return PageObjects.visualize.getTileMapData();
- })
- .then(function (data) {
- expect(data).to.eql(expectedPrecision2ZoomCircles);
- });
- });
-
- /*
- ** NOTE: Since we don't have a reliable way to know the zoom level, we can
- ** check some data after we save the viz, then zoom in and check that the data
- ** changed, then open the saved viz and check that it's back to the original data.
- */
- bdd.it('should save with zoom level and load, take screenshot', function () {
- const vizName1 = 'Visualization TileMap';
- const expectedTableData = [ 'dr4 127', 'dr7 92', '9q5 91', '9qc 89', 'drk 87',
- 'dps 82', 'dph 82', 'dp3 79', 'dpe 78', 'dp8 77'
- ];
-
- const expectedTableDataZoomed = [ 'dr5r 21', 'dps8 20', '9q5b 19', 'b6uc 17',
- '9y63 17', 'c20g 16', 'dqfz 15', 'dr8h 14', 'dp8p 14', 'dp3k 14'
- ];
-
- return PageObjects.visualize.clickMapZoomIn()
- .then(function () {
- return PageObjects.visualize.clickMapZoomIn();
- })
- .then(function () {
- return PageObjects.visualize.saveVisualization(vizName1);
- })
- .then(function (message) {
- PageObjects.common.debug('Saved viz message = ' + message);
- expect(message).to.be('Visualization Editor: Saved Visualization \"' + vizName1 + '\"');
- })
- .then(function testVisualizeWaitForToastMessageGone() {
- return PageObjects.visualize.waitForToastMessageGone();
- })
- .then(function () {
- return PageObjects.visualize.collapseChart();
- })
- // we're not selecting page size all, so we only have to verify the first page of data
- .then(function getDataTableData() {
- PageObjects.common.debug('first get the zoom level 5 page data and verify it');
- return PageObjects.visualize.getDataTableData();
- })
- .then(function showData(data) {
- expect(data.trim().split('\n')).to.eql(expectedTableData);
- return PageObjects.visualize.collapseChart();
- })
- .then(function () {
- // zoom to level 6, and make sure we go back to the saved level 5
- return PageObjects.visualize.clickMapZoomIn();
- })
- .then(function () {
- return PageObjects.visualize.collapseChart();
- })
- .then(function getDataTableData() {
- PageObjects.common.debug('second get the zoom level 6 page data and verify it');
- return PageObjects.visualize.getDataTableData();
- })
- .then(function showData(data) {
- expect(data.trim().split('\n')).to.eql(expectedTableDataZoomed);
- return PageObjects.visualize.collapseChart();
- })
- .then(function () {
- return PageObjects.visualize.loadSavedVisualization(vizName1);
- })
- .then(function waitForVisualization() {
- return PageObjects.visualize.waitForVisualization();
- })
- // sleep a bit before taking the screenshot or it won't show data
- .then(function sleep() {
- return PageObjects.common.sleep(4000);
- })
- .then(function () {
- return PageObjects.visualize.collapseChart();
- })
- .then(function getDataTableData() {
- PageObjects.common.debug('third get the zoom level 5 page data and verify it');
- return PageObjects.visualize.getDataTableData();
- })
- .then(function showData(data) {
- expect(data.trim().split('\n')).to.eql(expectedTableData);
- return PageObjects.visualize.collapseChart();
- })
- .then(function takeScreenshot() {
- PageObjects.common.debug('Take screenshot');
- PageObjects.common.saveScreenshot('Visualize-site-map');
- });
- });
-
-
- bdd.it('should zoom in to level 10', function () {
- // 6
- return PageObjects.visualize.clickMapZoomIn()
- .then(function () {
- // 7
- return PageObjects.visualize.clickMapZoomIn();
- })
- .then(function () {
- // 8
- return PageObjects.visualize.clickMapZoomIn();
- })
- .then(function () {
- // 9
- return PageObjects.visualize.clickMapZoomIn();
- })
- .then(function () {
- return PageObjects.common.try(function tryingForTime() {
- return PageObjects.visualize.getMapZoomInEnabled()
- .then(function (enabled) {
- expect(enabled).to.be(true);
- });
- });
- })
- .then(function () {
- return PageObjects.visualize.clickMapZoomIn();
- })
- .then(function () {
- return PageObjects.visualize.getMapZoomInEnabled();
- })
- // now we're at level 10 and zoom out should be disabled
- .then(function (enabled) {
- expect(enabled).to.be(false);
- });
- });
-
-
- });
-});
diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js
index d4cf50d7b7fe3..f37c917bd870d 100644
--- a/test/functional/apps/visualize/index.js
+++ b/test/functional/apps/visualize/index.js
@@ -36,7 +36,6 @@ bdd.describe('visualize app', function () {
require('./_data_table');
require('./_metric_chart');
require('./_pie_chart');
- require('./_tile_map');
require('./_vertical_bar_chart');
require('./_heatmap_chart');
require('./_point_series_options');