Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce vertical size of scan plot #953

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions auto_rx/autorx/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ input:checked + .slider:before {
color:inherit;
}

#telem_table {
margin-top: 0.25em;
margin-bottom: 0.25em;
}

/* Modal Header */
.modal-header {
padding: 2px 16px;
Expand Down
15 changes: 15 additions & 0 deletions auto_rx/autorx/static/js/scan_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function setup_scan_chart(){
['x_spectra',autorx_config.min_freq, autorx_config.max_freq],
['Spectra',0,0]
],
colors: {
Spectra: "#2f77b4"
},
Comment on lines +19 to +21
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the legend had the side effect of assigning colours to the datasets randomly, so I've explicitly defined them here.

type:'line'
};

Expand All @@ -27,6 +30,9 @@ function setup_scan_chart(){
['x_peaks',0],
['Peaks',0]
],
colors: {
Peaks: "#ff7f0e"
},
type:'scatter'
};

Expand All @@ -38,6 +44,9 @@ function setup_scan_chart(){
['x_thresh',autorx_config.min_freq, autorx_config.max_freq],
['Threshold',autorx_config.snr_threshold,autorx_config.snr_threshold]
],
colors: {
Threshold: "#2ca02c"
},
type:'line'
};

Expand Down Expand Up @@ -70,6 +79,12 @@ function setup_scan_chart(){
label:"Power (dB - Uncalibrated)"
}
},
size: {
height: 200
},
legend: {
show: false
},
point:{r:10}
});
}
Expand Down
11 changes: 5 additions & 6 deletions auto_rx/autorx/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@
document.getElementById("main").style.marginLeft = "350px";
document.getElementById("mySidenav").style.borderRadius = "0px 25px 25px 0px";
mymap.invalidateSize();
setTimeout(scan_chart_obj.resize,500);
scan_chart_obj.flush();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling resize() here would blow away the size set in the constructor, so I've replaced the call with flush(), which forces a redraw. The 500-ms delay seems to have been unnecessary.

} else { // Fullsize on mobile.
x.style.display = "block";
y.style.display = "none";
Expand All @@ -1288,7 +1288,7 @@
document.getElementById("mySidenav").style.width = 0;
document.getElementById("main").style.marginLeft = 0;
mymap.invalidateSize();
setTimeout(scan_chart_obj.resize,500);
scan_chart_obj.flush();
}
}

Expand All @@ -1304,7 +1304,7 @@
document.getElementById("main").style.marginRight = "350px";
document.getElementById("mySettings").style.borderRadius = "25px 0px 0px 25px";
mymap.invalidateSize();
setTimeout(scan_chart_obj.resize,500);
scan_chart_obj.flush();
setTimeout(showDown,500);
} else { // Fullsize on mobile.
y.style.display = "none";
Expand All @@ -1319,7 +1319,7 @@
document.getElementById("mySettings").style.width = 0;
document.getElementById("main").style.marginRight = 0;
mymap.invalidateSize();
setTimeout(scan_chart_obj.resize,500);
scan_chart_obj.flush();
setTimeout(showDown,500);
}
}
Expand Down Expand Up @@ -1355,7 +1355,7 @@
setCookie("scan", 'true', 365);
mymap.invalidateSize();
redraw_scan_chart();
setTimeout(scan_chart_obj.resize,500);
scan_chart_obj.flush();
}
}

Expand Down Expand Up @@ -1642,7 +1642,6 @@ <h2 style="display:inline;vertical-align:middle;">Historical View</h2>
<div id="telem_table"></div>
</div>
<div id="scanid">
<h2>Scan Results</h2>
<div id='scan_results'>No scan data yet...</div>
<div id="scan_chart" style="width:100%;"></div>
</div>
Expand Down
Loading