Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-3923: Charting Mode Simple Statistics Modal Style Fix (#6473)

christof-wittreicha4f542a2033d
diff --git a/web/js/components/charting/simple-statistics.js b/web/js/components/charting/simple-statistics.js
index 1fe48149d..b0dafb54a 100644
--- a/web/js/components/charting/simple-statistics.js
+++ b/web/js/components/charting/simple-statistics.js
@@ -4,16 +4,13 @@ import PropTypes from 'prop-types';
function SimpleStatistics(props) {
const { data } = props;
+ const { statData, date } = data;
+
const {
- median, mean, max, min, stdev, timestamp, type, endTimestamp,
- } = data;
+ median, mean, max, min, stdev,
+ } = statData;
- let dateStr;
- if (type === 'date') {
- dateStr = `Date: ${timestamp}`;
- } else {
- dateStr = `Date range: ${timestamp} - ${endTimestamp}`;
- }
+ const dateStr = `Date: ${date}`;
function formatToThreeDigits(str) {
if (parseFloat(str).toFixed(3).split('.')[0].length > 4) {
diff --git a/web/js/components/sidebar/charting-mode-options.js b/web/js/components/sidebar/charting-mode-options.js
index 1865bf1c6..d1b185a6b 100644
--- a/web/js/components/sidebar/charting-mode-options.js
+++ b/web/js/components/sidebar/charting-mode-options.js
@@ -626,7 +626,14 @@ function ChartingModeOptions(props) {
displayChart(chartData.current, screenWidth, toggleErrorDaysExpanded, isErrordaysExpanded);
updateChartRequestStatus(false);
} else {
- displaySimpleStats(dataToRender);
+ chartData.current = {
+ title: dataToRender.title,
+ subtitle: dataToRender.subtitle,
+ unit: dataToRender.unit,
+ statData: { ...data.body },
+ date: primaryDate,
+ };
+ displaySimpleStats(chartData.current);
updateChartRequestStatus(false);
}
} else {
@@ -1022,7 +1029,7 @@ const mapDispatchToProps = (dispatch) => ({
offsetLeft: 'calc(50% - 150px)',
offsetTop: 50,
width: 300,
- height: 360,
+ height: 340,
stayOnscreen: true,
type: 'selection', // This forces the user to specifically close the modal
bodyComponentProps: {
diff --git a/web/scss/features/sidebar.scss b/web/scss/features/sidebar.scss
index 770d7b34d..fb4b3ac63 100644
--- a/web/scss/features/sidebar.scss
+++ b/web/scss/features/sidebar.scss
@@ -647,7 +647,7 @@ div#group-overlays-checkbox-case {
}
.charting-simple.charting-statistics-container {
- padding: 0 18px;
+ padding: 0 18px 20px;
margin: auto;
}