|
|
@@ -3,6 +3,7 @@ import { formatDecimal } from '@/utils/number';
|
|
|
import * as echarts from 'echarts';
|
|
|
import { State, Colors } from './type'
|
|
|
import { getTheme, ThemeEnum } from '@/common/config/theme';
|
|
|
+import { throttle } from '@/utils/time'
|
|
|
|
|
|
export function useOptions(state: State) {
|
|
|
const theme = getTheme(),
|
|
|
@@ -192,7 +193,7 @@ export function useOptions(state: State) {
|
|
|
}
|
|
|
|
|
|
// 动态更新数据
|
|
|
- const updateOptions = () => {
|
|
|
+ const updateOptions = throttle(() => {
|
|
|
const { seriesMarkLineColor } = getColors();
|
|
|
const { dataset, yestClose } = state;
|
|
|
|
|
|
@@ -219,7 +220,7 @@ export function useOptions(state: State) {
|
|
|
},
|
|
|
],
|
|
|
}
|
|
|
- }
|
|
|
+ }, 1000)
|
|
|
|
|
|
// 计算涨跌幅百分比,涨跌幅=(今日收盘价-昨日收盘价)/昨日收盘价*100%
|
|
|
const calcRatio = (val: number) => {
|