refactor: 修改逻辑分析仪,使其直接使用manager进行管理
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
<button
|
||||
class="group relative px-8 py-3 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-medium rounded-lg shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-200 ease-in-out focus:outline-none focus:ring-4 focus:ring-blue-300 active:scale-95"
|
||||
@click="handleGenerateTestData"
|
||||
@click="analyzer.generateTestData"
|
||||
>
|
||||
<span class="flex items-center gap-2">
|
||||
<RefreshCcw
|
||||
@@ -45,7 +45,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, shallowRef } from "vue";
|
||||
import VChart from "vue-echarts";
|
||||
import { generateTestLogicData } from "./index";
|
||||
import { RefreshCcw } from "lucide-vue-next";
|
||||
|
||||
// Echarts
|
||||
@@ -145,8 +144,8 @@ const option = computed((): EChartsOption => {
|
||||
axisLabel: {
|
||||
formatter: (value: number) => {
|
||||
const channelIndex = Math.round(value / channelSpacing);
|
||||
return channelIndex < channelCount && analyzer.logicData.value
|
||||
? analyzer.logicData.value.channelNames[channelIndex]
|
||||
return channelIndex < channelCount
|
||||
? analyzer.channelNames.value[channelIndex]
|
||||
: "";
|
||||
},
|
||||
},
|
||||
@@ -157,9 +156,7 @@ const option = computed((): EChartsOption => {
|
||||
// 创建系列数据,每个通道有不同的Y偏移
|
||||
const series: LineSeriesOption[] = analyzer.logicData.value.y.map(
|
||||
(channelData: number[], index: number) => ({
|
||||
name:
|
||||
analyzer.logicData.value?.channelNames?.[index] ??
|
||||
`Channel ${index + 1}`,
|
||||
name: analyzer.channelNames.value[index],
|
||||
type: "line",
|
||||
data: channelData.map(
|
||||
(value: number) => value + index * channelSpacing + 0.2,
|
||||
@@ -205,7 +202,7 @@ const option = computed((): EChartsOption => {
|
||||
|
||||
// 显示所有通道在当前时间点的原始数值(0或1)
|
||||
if (analyzer.logicData.value) {
|
||||
analyzer.logicData.value.channelNames.forEach(
|
||||
analyzer.channelNames.value.forEach(
|
||||
(channelName: string, index: number) => {
|
||||
const originalValue =
|
||||
analyzer.logicData.value!.y[index][dataIndex];
|
||||
@@ -247,7 +244,4 @@ const option = computed((): EChartsOption => {
|
||||
};
|
||||
});
|
||||
|
||||
function handleGenerateTestData() {
|
||||
analyzer.logicData.value = generateTestLogicData();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user