From f566d598a0b98b8490ffb1baddb184ee289c8e85 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 16 Feb 2021 13:30:11 +0200 Subject: [PATCH 1/2] feat(legacy-plugin-chart-map-box): show all points in mapbox chart --- plugins/legacy-plugin-chart-map-box/src/MapBox.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx b/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx index 887130044a..99e0697f6d 100644 --- a/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx +++ b/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx @@ -108,7 +108,14 @@ class MapBox extends React.Component { // Compute the clusters based on the original bounds and current zoom level. Note when zoom/pan // to an area outside of the original bounds, no additional queries are made to the backend to // retrieve additional data. - const bbox = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]]; + // add this variable to widen the visible area + const offset = 0.05; + const bbox = [ + bounds[0][0] - offset, + bounds[0][1] - offset, + bounds[1][0] + offset, + bounds[1][1] + offset, + ]; const clusters = clusterer.getClusters(bbox, Math.round(viewport.zoom)); return ( From 4d32f1e3bd2f9da7b48fb24410868b384a6746fd Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 16 Feb 2021 15:36:46 +0200 Subject: [PATCH 2/2] to percentage --- plugins/legacy-plugin-chart-map-box/src/MapBox.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx b/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx index 99e0697f6d..de3652d05e 100644 --- a/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx +++ b/plugins/legacy-plugin-chart-map-box/src/MapBox.jsx @@ -109,12 +109,13 @@ class MapBox extends React.Component { // to an area outside of the original bounds, no additional queries are made to the backend to // retrieve additional data. // add this variable to widen the visible area - const offset = 0.05; + const offsetHorizontal = (width * 0.5) / 100; + const offsetVertical = (height * 0.5) / 100; const bbox = [ - bounds[0][0] - offset, - bounds[0][1] - offset, - bounds[1][0] + offset, - bounds[1][1] + offset, + bounds[0][0] - offsetHorizontal, + bounds[0][1] - offsetVertical, + bounds[1][0] + offsetHorizontal, + bounds[1][1] + offsetVertical, ]; const clusters = clusterer.getClusters(bbox, Math.round(viewport.zoom));