From 525b340ed28720145ac5cdb3b43e399588bf52c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wawrzyniec=20Urba=C5=84czyk?= Date: Thu, 19 Aug 2021 12:13:01 +0200 Subject: [PATCH] GeoMap: Ignore points with null coordinate values (#1775) --- CHANGELOG.md | 4 ++++ .../visualization/java_script/geoMap.js | 20 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ba299f6aa..bf293e3e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,14 @@ #### Enso Compiler +- [GeoMap visualization will ignore points with `null` coordinates][1775]. Now + the presence of such points in the dataset will not break initial map + positioning. - [Updated Enso engine to version 0.2.11][1798]. If you're interested in the enhancements and fixes made to the Enso compiler, you can find their release notes [here](https://github.com/enso-org/enso/blob/main/RELEASES.md). +[1775]: https://github.com/enso-org/ide/pull/1775 [1798]: https://github.com/enso-org/ide/pull/1798 # Enso 2.0.0-alpha.11 (2021-08-09) diff --git a/src/rust/ide/view/graph-editor/src/builtin/visualization/java_script/geoMap.js b/src/rust/ide/view/graph-editor/src/builtin/visualization/java_script/geoMap.js index 9a38430992..b3190b1489 100644 --- a/src/rust/ide/view/graph-editor/src/builtin/visualization/java_script/geoMap.js +++ b/src/rust/ide/view/graph-editor/src/builtin/visualization/java_script/geoMap.js @@ -160,7 +160,7 @@ class GeoMapVisualization extends Visualization { extractDataPoints(data, this.dataPoints, this.accentColor) if (this.dataPoints.length === 0) { - // We have no valid data and should skip initialisation. + // We have no valid data and should skip initialization. return false } const { latitude, longitude } = this.centerPoint() @@ -219,7 +219,7 @@ class GeoMapVisualization extends Visualization { } /** - * Reset the internal state of the visualisation, discarding all previous data updates. + * Reset the internal state of the visualization, discarding all previous data updates. */ resetState() { // We only need to reset the data points as everything else will be overwritten when new @@ -288,7 +288,7 @@ class GeoMapVisualization extends Visualization { } /** - * Extract the visualisation data from a full configuration object. + * Extract the visualization data from a full configuration object. */ function extractVisualizationDataFromFullConfig(parsedData, preparedDataPoints, accentColor) { if (parsedData.type === SCATTERPLOT_LAYER && parsedData.data.length) { @@ -306,7 +306,7 @@ function extractVisualizationDataFromFullConfig(parsedData, preparedDataPoints, } /** - * Extract the visualisation data from a dataframe. + * Extract the visualization data from a dataframe. */ function extractVisualizationDataFromDataFrame(parsedData, preparedDataPoints, accentColor) { const geoPoints = parsedData.df_latitude.map(function (latitude, i) { @@ -348,11 +348,13 @@ function extractDataPoints(parsedData, preparedDataPoints, accentColor) { */ function pushPoints(dataPoints, targetList, accentColor) { dataPoints.forEach(geoPoint => { - let position = [geoPoint.longitude, geoPoint.latitude] - let radius = isValidNumber(geoPoint.radius) ? geoPoint.radius : DEFAULT_POINT_RADIUS - let color = ok(geoPoint.color) ? geoPoint.color : accentColor - let label = ok(geoPoint.label) ? geoPoint.label : '' - targetList.push({ position, color, radius, label }) + if (isValidNumber(geoPoint.longitude) && isValidNumber(geoPoint.latitude)) { + let position = [geoPoint.longitude, geoPoint.latitude] + let radius = isValidNumber(geoPoint.radius) ? geoPoint.radius : DEFAULT_POINT_RADIUS + let color = geoPoint.color ?? accentColor + let label = geoPoint.label ?? '' + targetList.push({ position, color, radius, label }) + } }) }