Switch to useWebSocketStore in RealtimeEnergyChartCard

This commit is contained in:
rafaeldpsilva
2025-09-30 17:58:26 +01:00
parent 83eaa7e121
commit c360fb81cd

View File

@@ -18,7 +18,7 @@ import {
GridComponent, GridComponent,
} from 'echarts/components' } from 'echarts/components'
import { computed } from 'vue' import { computed } from 'vue'
import { useEnergyStore } from '@/stores/energy' import { useWebSocketStore } from '@/stores/websocket'
use([TitleComponent, TooltipComponent, LegendComponent, LineChart, CanvasRenderer, GridComponent]) use([TitleComponent, TooltipComponent, LegendComponent, LineChart, CanvasRenderer, GridComponent])
@@ -26,7 +26,7 @@ defineProps<{
title: string title: string
}>() }>()
const energyStore = useEnergyStore() const websocketStore = useWebSocketStore()
const option = computed(() => ({ const option = computed(() => ({
grid: { grid: {
@@ -48,7 +48,7 @@ const option = computed(() => ({
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: energyStore.timeSeriesData.labels, data: websocketStore.timeSeriesData.labels,
axisLabel: { axisLabel: {
fontFamily: fontFamily:
'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"', 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
@@ -63,16 +63,16 @@ const option = computed(() => ({
}, },
series: [ series: [
{ {
data: energyStore.timeSeriesData.datasets[0].data, data: websocketStore.timeSeriesData.datasets[0].data,
type: 'line', type: 'line',
showSymbol: false, showSymbol: false,
smooth: true, smooth: true,
itemStyle: { itemStyle: {
color: '#3b82f6' color: '#3b82f6',
}, },
lineStyle: { lineStyle: {
color: '#3b82f6' color: '#3b82f6',
} },
}, },
], ],
})) }))