|
|
@@ -22,7 +22,7 @@
|
|
|
<template v-if="showIndicator">
|
|
|
<div class="app-echats-kline__container indicator">
|
|
|
<!-- MACD -->
|
|
|
- <section class="section" v-if="activeSeriesType === EChartsSeriesType.MACD">
|
|
|
+ <section class="section" v-if="activeSeriesType === ChartSeriesType.MACD">
|
|
|
<ul class="legend">
|
|
|
<li class="legend-item">MACD: {{ selectedItem.macd }}</li>
|
|
|
<li class="legend-item">DIF: {{ selectedItem.dif }}</li>
|
|
|
@@ -31,14 +31,14 @@
|
|
|
<app-echarts :option="options.macd" v-model:dataIndex="dataIndex" @ready="indicatorReady" />
|
|
|
</section>
|
|
|
<!-- VOL -->
|
|
|
- <section class="section" v-if="activeSeriesType === EChartsSeriesType.VOL">
|
|
|
+ <section class="section" v-if="activeSeriesType === ChartSeriesType.VOL">
|
|
|
<ul class="legend">
|
|
|
<li class="legend-item">VOL: {{ selectedItem.vol }}</li>
|
|
|
</ul>
|
|
|
<app-echarts :option="options.vol" v-model:dataIndex="dataIndex" @ready="indicatorReady" />
|
|
|
</section>
|
|
|
<!-- KDJ -->
|
|
|
- <section class="section" v-if="activeSeriesType === EChartsSeriesType.KDJ">
|
|
|
+ <section class="section" v-if="activeSeriesType === ChartSeriesType.KDJ">
|
|
|
<ul class="legend">
|
|
|
<li class="legend-item">K: {{ selectedItem.k }}</li>
|
|
|
<li class="legend-item">D: {{ selectedItem.d }}</li>
|
|
|
@@ -47,14 +47,14 @@
|
|
|
<app-echarts :option="options.kdj" v-model:dataIndex="dataIndex" @ready="indicatorReady" />
|
|
|
</section>
|
|
|
<!-- CCI -->
|
|
|
- <section class="section" v-if="activeSeriesType === EChartsSeriesType.CCI">
|
|
|
+ <section class="section" v-if="activeSeriesType === ChartSeriesType.CCI">
|
|
|
<ul class="legend">
|
|
|
<li class="legend-item">CCI: {{ selectedItem.cci }}</li>
|
|
|
</ul>
|
|
|
<app-echarts :option="options.cci" v-model:dataIndex="dataIndex" @ready="indicatorReady" />
|
|
|
</section>
|
|
|
</div>
|
|
|
- <app-tab theme="menu" :data-source="tabs" @change="tabChange" />
|
|
|
+ <app-tab theme="menu" :data-source="chartSeriesTypeList" @change="tabChange" />
|
|
|
</template>
|
|
|
</template>
|
|
|
</div>
|
|
|
@@ -63,7 +63,7 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, PropType, watch } from 'vue'
|
|
|
import { echarts } from '@/components/base/echarts/core'
|
|
|
-import { EChartsCycleType, EChartsSeriesType } from '@/constants/enum'
|
|
|
+import { ChartCycleType, ChartSeriesType, chartSeriesTypeList } from '@/constants/enum/chart'
|
|
|
import { useCandlestickChart } from '@/hooks/echarts/candlestick'
|
|
|
import AppEcharts from '@/components/base/echarts/index.vue'
|
|
|
import AppTab from '@/components/base/tab/index.vue'
|
|
|
@@ -75,8 +75,8 @@ const props = defineProps({
|
|
|
},
|
|
|
// 周期类型
|
|
|
cycleType: {
|
|
|
- type: Number as PropType<EChartsCycleType>,
|
|
|
- default: EChartsCycleType.minutes,
|
|
|
+ type: Number as PropType<ChartCycleType>,
|
|
|
+ default: ChartCycleType.minutes,
|
|
|
},
|
|
|
// 是否显示指标
|
|
|
showIndicator: {
|
|
|
@@ -86,19 +86,12 @@ const props = defineProps({
|
|
|
})
|
|
|
|
|
|
const { loading, dataIndex, isEmpty, options, selectedItem, initData, initOptions } = useCandlestickChart(props.goodscode);
|
|
|
-const activeSeriesType = ref(EChartsSeriesType.MACD); // 当前选中的指标
|
|
|
+const activeSeriesType = ref(ChartSeriesType.MACD); // 当前选中的指标
|
|
|
const chartGroup = new Map<string, echarts.ECharts>(); // 图表联动实例组
|
|
|
|
|
|
-const tabs = [
|
|
|
- { label: 'MACD', value: EChartsSeriesType.MACD },
|
|
|
- { label: 'VOL', value: EChartsSeriesType.VOL },
|
|
|
- { label: 'KDJ', value: EChartsSeriesType.KDJ },
|
|
|
- { label: 'CCI', value: EChartsSeriesType.CCI },
|
|
|
-]
|
|
|
-
|
|
|
// 指标切换
|
|
|
const tabChange = (index: number) => {
|
|
|
- activeSeriesType.value = tabs[index].value;
|
|
|
+ activeSeriesType.value = chartSeriesTypeList[index].value;
|
|
|
setTimeout(() => {
|
|
|
initOptions();
|
|
|
}, 0);
|