mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
very first test of scatter plot diagram
This commit is contained in:
parent
c0ec0c1853
commit
fd9f45546f
4 changed files with 838 additions and 1856 deletions
2577
gui/package-lock.json
generated
2577
gui/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -26,6 +26,7 @@
|
|||
"dependencies": {
|
||||
"@electron/remote": "^1.2.0",
|
||||
"bootstrap": "^5.0.1",
|
||||
"electron-builder": "^22.11.7"
|
||||
"chart.js": "^3.5.0",
|
||||
"electron-builder": "^22.9.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ setInterval(sock.getHeardStations, 1000)
|
|||
|
||||
|
||||
// UPDATE FFT DEMO
|
||||
|
||||
/*
|
||||
updateFFT = function(fft) {
|
||||
var fft = Array.from({
|
||||
length: 2048
|
||||
|
@ -24,6 +24,8 @@ updateFFT = function(fft) {
|
|||
spectrum.addData(fft);
|
||||
}
|
||||
setInterval(updateFFT, 250)
|
||||
*/
|
||||
|
||||
|
||||
// WINDOW LISTENER
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
|
@ -40,12 +42,58 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// Create spectrum object on canvas with ID "waterfall"
|
||||
global.spectrum = new Spectrum(
|
||||
"waterfall", {
|
||||
spectrumPercent: 20
|
||||
});
|
||||
*/
|
||||
|
||||
// SETUP OF SCATTER DIAGRAM
|
||||
|
||||
var data = {
|
||||
datasets: [{
|
||||
label: 'Scatter Dataset',
|
||||
data: [{
|
||||
x: 0,
|
||||
y: 0
|
||||
}],
|
||||
backgroundColor: 'rgb(255, 99, 132)'
|
||||
}],
|
||||
};
|
||||
|
||||
|
||||
var ctx = document.getElementById('myChart').getContext('2d');
|
||||
global.myChart = new Chart(ctx, {
|
||||
type: 'scatter',
|
||||
data: data,
|
||||
options: {
|
||||
animation: false,
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
|
||||
scales: {
|
||||
display: false,
|
||||
grid: {
|
||||
display: false
|
||||
},
|
||||
x: {
|
||||
type: 'linear',
|
||||
position: 'bottom',
|
||||
display: false
|
||||
},
|
||||
y: {
|
||||
display: false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// on change port and host
|
||||
|
@ -136,6 +184,52 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||
|
||||
|
||||
// SCATTER DIAGRAM PLOTTING
|
||||
global.myChart.destroy();
|
||||
|
||||
var data = arg.scatter
|
||||
var data = {
|
||||
datasets: [{
|
||||
//label: false,
|
||||
data: data,
|
||||
backgroundColor: 'rgb(255, 99, 132)'
|
||||
}],
|
||||
};
|
||||
|
||||
|
||||
var ctx = document.getElementById('myChart').getContext('2d');
|
||||
global.myChart = new Chart(ctx, {
|
||||
type: 'scatter',
|
||||
data: data,
|
||||
options: {
|
||||
animation: false,
|
||||
legend: {
|
||||
display: false,
|
||||
tooltips: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
|
||||
scales: {
|
||||
display: false,
|
||||
grid: {
|
||||
display: false
|
||||
},
|
||||
x: {
|
||||
type: 'linear',
|
||||
position: 'bottom',
|
||||
display: false
|
||||
},
|
||||
y: {
|
||||
display: false
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
// PTT STATE
|
||||
if (arg.ptt_state == 'True') {
|
||||
document.getElementById("ptt_state").className = "btn btn-danger";
|
||||
|
|
16
gui/sock.js
16
gui/sock.js
|
@ -92,9 +92,9 @@ client.on('data', function(data) {
|
|||
|
||||
data = data.toString('utf8'); // convert data to string
|
||||
msg += data.toString('utf8'); // append data to buffer so we can stick long data together
|
||||
|
||||
//console.log(data)
|
||||
// check if we reached an EOF, if true, clear buffer and parse JSON data
|
||||
if (data.endsWith('}')) {
|
||||
if (data.endsWith('"EOF": "EOF"}')) {
|
||||
//console.log(msg)
|
||||
try {
|
||||
//console.log(msg)
|
||||
|
@ -116,6 +116,7 @@ client.on('data', function(data) {
|
|||
mode: data['MODE'],
|
||||
bandwith: data['BANDWITH'],
|
||||
rms_level: (data['AUDIO_RMS'] / 1000) * 100,
|
||||
scatter: data['SCATTER'],
|
||||
};
|
||||
console.log(Data)
|
||||
ipcRenderer.send('request-update-tnc-state', Data);
|
||||
|
@ -146,7 +147,14 @@ client.on('data', function(data) {
|
|||
ipcRenderer.send('request-update-heard-stations', Data);
|
||||
}
|
||||
|
||||
|
||||
if (data['COMMAND'] == 'SCATTER') {
|
||||
console.log(data['SCATTER'])
|
||||
let Data = {
|
||||
stations: data['STATIONS'],
|
||||
};
|
||||
//console.log(Data)
|
||||
//ipcRenderer.send('request-update-heard-stations', Data);
|
||||
}
|
||||
// check if EOF ...
|
||||
}
|
||||
|
||||
|
@ -161,8 +169,6 @@ function hexToBytes(hex) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Save myCall
|
||||
exports.saveMyCall = function(callsign) {
|
||||
command = '{"type" : "SET", "command": "MYCALLSIGN" , "parameter": "' + callsign + '" }'
|
||||
|
|
Loading…
Reference in a new issue