add boolean type

This commit is contained in:
2025-12-25 12:44:26 -05:00
parent ebbf864af9
commit 8cfaf468e9
12 changed files with 113 additions and 14 deletions

View File

@@ -96,12 +96,21 @@ watch([value], ([val]) => {
if (val) {
const val_t = Date.parse(val.timestamp);
if (val_t >= min_x) {
const item_val = val.value[
telemetry_data.value!.data_type
] as number;
const raw_item_val = val.value[telemetry_data.value!.data_type];
let item_val = 0;
if (
['Float32', 'Float64'].some(
(e) => e == telemetry_data.value!.data_type,
)
) {
item_val = raw_item_val as number;
} else if (telemetry_data.value!.data_type == 'Boolean') {
item_val = (raw_item_val as boolean) ? 1 : 0;
}
const new_item = {
x: val_t,
y: item_val,
value: raw_item_val,
} as Point;
memo.value.insert(new_item, data_min_sep.value);
if (item_val < min.value) {
@@ -131,10 +140,21 @@ watch(
const response = (await res.json()) as TelemetryDataItem[];
for (const data_item of response) {
const val_t = Date.parse(data_item.timestamp);
const item_val = data_item.value[type] as number;
const raw_item_val = data_item.value[type];
let item_val = 0;
if (
['Float32', 'Float64'].some(
(e) => e == telemetry_data.value!.data_type,
)
) {
item_val = raw_item_val as number;
} else if (type == 'Boolean') {
item_val = (raw_item_val as boolean) ? 1 : 0;
}
const new_item = {
x: val_t,
y: item_val,
value: raw_item_val,
} as Point;
memo.value.insert(new_item);
if (item_val < min.value) {
@@ -392,7 +412,7 @@ function onMouseExit(event: MouseEvent) {
class="fade_other_selected label"
:x="graph_data.x_map(toValue(graph_data.max_x)) + text_offset"
:y="axis_data.y_map(current_data_point.y)"
:value="current_data_point.y"
:value="current_data_point.value"
>
</ValueLabel>
<template v-if="toValue(graph_data.legend_enabled)">
@@ -445,9 +465,10 @@ function onMouseExit(event: MouseEvent) {
<span>{{ telemetry_data?.data_type }}</span>
</div>
<div class="row">
<span>{{
current_data_point?.y || 'Missing Data'
<span v-if="current_data_point !== undefined">{{
current_data_point.value
}}</span>
<span v-else>Missing Data</span>
</div>
</template>
<template v-else>