Skip to content

Commit

Permalink
#7 make line Logger protein-mCherrytemp
Browse files Browse the repository at this point in the history
  • Loading branch information
ok09ra authored and shundroid committed Sep 10, 2022
1 parent 5ed2ff0 commit 908125d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/components/Logger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Plugin,
} from "chart.js";
import { useStore } from "@/store";
import { ref, defineProps } from "vue";
import { ref, defineProps, watch, toRefs, onUnmounted } from "vue";
ChartJS.register(
Title,
Expand All @@ -36,19 +36,21 @@ const props = defineProps<{
cssClasses?: string;
}>();
const store = useStore();
let i = 1;
setInterval(() => {
chartData.value.datasets[0].data[i] = Math.random() * 50;
i += 1;
}, 50);
const { time } = toRefs(store);
store.registerOutput("protein-mCherry");
onUnmounted(() => {
store.UnregisterOutput("protein-mCherry");
});
watch(time, () => {
chartData.value.datasets[0].data[time.value] =
store.runnerOutputs["protein-mCherry"];
});
const chartData = ref({
datasets: [
{
data: {
[0]: 1,
[1]: 10,
},
data: {},
},
],
});
Expand Down

0 comments on commit 908125d

Please sign in to comment.