Skip to content

Commit c624340

Browse files
committed
UX Clarity Improvements for Spectrogram
1 parent 0030e7f commit c624340

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Update Band Power widget and add Average Band Power data type to Networking Widget
1818
* Update ControlP5 Library to 2.3.3 and change ScrollableList behavior to be more consistent with other front-end libraries
1919
* Remove old multi-line filter buttons in TopNav that draw incorrectly on some PCs #1013
20+
* Minor UI/UX improvements to Spectrogram widget to increase clarity for all users
2021

2122
# v5.0.9
2223

OpenBCI_GUI/SessionSettings.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class SessionSettings {
159159

160160
//Used to set text in dropdown menus when loading Spectrogram Setings
161161
String[] spectMaxFrqArray = {"20 Hz", "40 Hz", "60 Hz", "100 Hz", "120 Hz", "250 Hz"};
162-
String[] spectSampleRateArray = {"1 Hz", "5 hz", "10 Hz", "20 Hz", "40 Hz"};
162+
String[] spectSampleRateArray = {"30 Min.", "6 Min.", "3 Min.", "1.5 Min.", "1 Min."};
163163

164164
//Load Accel. dropdown variables
165165
int loadAccelVertScale;

OpenBCI_GUI/W_Spectrogram.pde

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class W_Spectrogram extends Widget {
9393
//Note that these 3 dropdowns correspond to the 3 global functions below
9494
//You just need to make sure the "id" (the 1st String) has the same name as the corresponding function
9595
addDropdown("SpectrogramMaxFreq", "Max Freq", Arrays.asList(settings.spectMaxFrqArray), settings.spectMaxFrqSave);
96-
addDropdown("SpectrogramSampleRate", "Samples", Arrays.asList(settings.spectSampleRateArray), settings.spectSampleRateSave);
96+
addDropdown("SpectrogramSampleRate", "Window", Arrays.asList(settings.spectSampleRateArray), settings.spectSampleRateSave);
9797
addDropdown("SpectrogramLogLin", "Log/Lin", Arrays.asList(settings.fftLogLinArray), settings.spectLogLinSave);
9898

9999
//Resize the height of the data image using default
@@ -334,20 +334,27 @@ class W_Spectrogram extends Widget {
334334

335335
void drawColorScaleReference() {
336336
int colorScaleHeight = 128;
337+
//Dynamically scale the Log/Lin amplitude-to-color reference line. If it won't fit, don't draw it.
338+
if (graphH < colorScaleHeight) {
339+
colorScaleHeight = int(h * 1/2);
340+
if (colorScaleHeight > graphH) {
341+
return;
342+
}
343+
}
337344
pushStyle();
338345
//draw color scale reference to the right of the spectrogram
339346
for (int i = 0; i < colorScaleHeight; i++) {
340-
float hueValue = hueLimit - map(i * 2, 0, 256, 0, hueLimit);
347+
float hueValue = hueLimit - map(i * 2, 0, colorScaleHeight*2, 0, hueLimit);
341348
if (settings.spectLogLinSave == 0) {
342349
hueValue = map(log(hueValue) / log(10), 0, 2, 0, hueLimit);
343350
}
344351
//println(hueValue);
345352
// colorMode is HSB, the range for hue is 256, for saturation is 100, brightness is 100.
346353
colorMode(HSB, 256, 100, 100);
347354
// color for stroke is specified as hue, saturation, brightness.
348-
stroke(int(hueValue), 100, 80);
355+
stroke(ceil(hueValue), 100, 80);
349356
strokeWeight(10);
350-
point(x + w - paddingRight/2 + 1, y + paddingTop + midLineY - colorScaleHeight/3 - 14 - i);
357+
point(x + w - paddingRight/2 + 1, midLineY + colorScaleHeight/2 - i);
351358
}
352359
popStyle();
353360
}

0 commit comments

Comments
 (0)