|  | @@ -2,7 +2,7 @@ |  | @@ -2,7 +2,7 @@ | 
| 2 | import { computed, onMounted, onUnmounted, ref, unref } from 'vue' | 2 | import { computed, onMounted, onUnmounted, ref, unref } from 'vue' | 
| 3 | import type { ECharts, EChartsOption } from 'echarts' | 3 | import type { ECharts, EChartsOption } from 'echarts' | 
| 4 | import { init } from 'echarts' | 4 | import { init } from 'echarts' | 
| 5 | -import { defaultOption, getShowValue } from './index.config' | 5 | +import { getDefaultOption, getShowValue } from './index.config' | 
| 6 | import type { CreateComponentType, RenderComponentExposeType } from '@/core/Library/types' | 6 | import type { CreateComponentType, RenderComponentExposeType } from '@/core/Library/types' | 
| 7 | import type { NodeDataDataSourceJsonType } from '@/api/node/model' | 7 | import type { NodeDataDataSourceJsonType } from '@/api/node/model' | 
| 8 | import { useLatestMessageValue } from '@/core/Library/hook/useLatestMessageValue' | 8 | import { useLatestMessageValue } from '@/core/Library/hook/useLatestMessageValue' | 
|  | @@ -20,13 +20,13 @@ const chartInstance = ref<Nullable<ECharts>>() |  | @@ -20,13 +20,13 @@ const chartInstance = ref<Nullable<ECharts>>() | 
| 20 |  | 20 |  | 
| 21 | function initChartInstance() { | 21 | function initChartInstance() { | 
| 22 | chartInstance.value = init(unref(chartElRef)) | 22 | chartInstance.value = init(unref(chartElRef)) | 
| 23 | -  chartInstance.value.setOption(defaultOption) | 23 | +  chartInstance.value.setOption(getDefaultOption) | 
| 24 | } | 24 | } | 
| 25 |  | 25 |  | 
| 26 | const { onMessage } = useOnMessage({ | 26 | const { onMessage } = useOnMessage({ | 
| 27 | onReceiveDataSourceMessage(commandSource, message) { | 27 | onReceiveDataSourceMessage(commandSource, message) { | 
| 28 | const { data } = commandSource | 28 | const { data } = commandSource | 
| 29 | -    const { deviceInfo, attrInfo } = data || {} | 29 | +    const { deviceInfo, attrInfo } = (data || {}) as NodeDataDataSourceJsonType | 
| 30 | const { deviceName } = deviceInfo || {} | 30 | const { deviceName } = deviceInfo || {} | 
| 31 | const { attr } = data as NodeDataDataSourceJsonType | 31 | const { attr } = data as NodeDataDataSourceJsonType | 
| 32 | const { latestValue } = useLatestMessageValue(message.data, attr) | 32 | const { latestValue } = useLatestMessageValue(message.data, attr) | 
|  | @@ -34,7 +34,26 @@ const { onMessage } = useOnMessage({ |  | @@ -34,7 +34,26 @@ const { onMessage } = useOnMessage({ | 
| 34 | title: { | 34 | title: { | 
| 35 | text: `${deviceName || ''}-${attrInfo.name || ''}`, | 35 | text: `${deviceName || ''}-${attrInfo.name || ''}`, | 
| 36 | }, | 36 | }, | 
| 37 | -      series: [{ data: [{ value: getShowValue(Number(latestValue)) }] }], | 37 | +      series: [{ | 
|  |  | 38 | +        data: [{ | 
|  |  | 39 | +          value: getShowValue(Number(latestValue)), | 
|  |  | 40 | +          label: { | 
|  |  | 41 | +            show: true, | 
|  |  | 42 | +            position: [20, '40%'], | 
|  |  | 43 | +            width: 100, | 
|  |  | 44 | +            height: 30, | 
|  |  | 45 | +            color: '#000', | 
|  |  | 46 | +            padding: 5, | 
|  |  | 47 | +            fontSize: 20, | 
|  |  | 48 | +            formatter: `${Number(latestValue)} {unit|℃}`, | 
|  |  | 49 | +            rich: { | 
|  |  | 50 | +              unit: { | 
|  |  | 51 | +                fontSize: 14, | 
|  |  | 52 | +              }, | 
|  |  | 53 | +            }, | 
|  |  | 54 | +          }, | 
|  |  | 55 | +        }], | 
|  |  | 56 | +      }], | 
| 38 | } as EChartsOption) | 57 | } as EChartsOption) | 
| 39 | }, | 58 | }, | 
| 40 | }) | 59 | }) |