From 5d75e6299866fa337b043efe1ef8447d675b4b5a Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Fri, 29 Sep 2023 10:26:27 +0200 Subject: [PATCH] implementing scatter and speedChart - not yet working correctly --- gui_vue/src/components/main_active_stats.vue | 151 ++++++++++++++++--- gui_vue/src/js/sock.js | 2 +- gui_vue/src/store/stateStore.js | 4 +- 3 files changed, 131 insertions(+), 26 deletions(-) diff --git a/gui_vue/src/components/main_active_stats.vue b/gui_vue/src/components/main_active_stats.vue index 4fc84f35..a630a33f 100644 --- a/gui_vue/src/components/main_active_stats.vue +++ b/gui_vue/src/components/main_active_stats.vue @@ -13,9 +13,24 @@ const settings = useSettingsStore(pinia); import { useStateStore } from '../store/stateStore.js'; const state = useStateStore(pinia); + +import { + Chart as ChartJS, + CategoryScale, + LinearScale, + PointElement, + LineElement, + Title, + Tooltip, + Legend +} from 'chart.js' +import { Line, Scatter } from 'vue-chartjs' +import { ref, computed } from 'vue'; + + + function selectStatsControl(obj){ -console.log(event.target.id) -switch (event.target.id) { +switch (obj.delegateTarget.id) { case 'list-waterfall-list': settings.spectrum = "waterfall" break; @@ -31,19 +46,104 @@ switch (event.target.id) { } saveSettingsToFile() - } + var transmissionSpeedChartOptions = { + type: "line", + }; + + +const scatterChartOptions = { + plugins: { + legend: { + display: false, + }, + tooltip: { + enabled: false, + }, + annotation: { + annotations: { + line1: { + type: "line", + yMin: 0, + yMax: 0, + borderColor: "rgb(255, 99, 132)", + borderWidth: 2, + }, + line2: { + type: "line", + xMin: 0, + xMax: 0, + borderColor: "rgb(255, 99, 132)", + borderWidth: 2, + }, + }, + }, + }, + animations: false, + scales: { + x: { + type: "linear", + position: "bottom", + display: true, + min: -80, + max: 80, + ticks: { + display: false, + }, + }, + y: { + display: true, + min: -80, + max: 80, + ticks: { + display: false, + }, + }, + }, + }; + + + + +ChartJS.register( + CategoryScale, + LinearScale, + PointElement, + LineElement, + Title, + Tooltip, + Legend +) + + +const transmissionSpeedChartData = computed(() => ({ + labels: ['-10', '-5', '0', '5', '10'], + datasets: [ + { data: state.arq_speed_list, label: 'BPM 0%' ,tension: 0.1, borderColor: 'rgb(0, 255, 0)' }, + ] +} +)); + + + + +const scatterChartData = computed(() => ({ + labels: ['-10', '-5', '0', '5', '10'], + datasets: [ + { type: 'scatter', data: state.scatter, label: 'PER 0%' ,tension: 0.1, borderColor: 'rgb(0, 255, 0)' }, + ] + } +)); + + + - - - -