|
@@ -9,7 +9,7 @@
|
|
|
import { shallowRef, shallowReactive, watch, computed } from 'vue'
|
|
import { shallowRef, shallowReactive, watch, computed } from 'vue'
|
|
|
import { Chart } from 'hqchart'
|
|
import { Chart } from 'hqchart'
|
|
|
import { timerInterceptor } from '@/utils/timer'
|
|
import { timerInterceptor } from '@/utils/timer'
|
|
|
-import { changeUnit, handleNumberValue, handlePriceColor } from '@/filters'
|
|
|
|
|
|
|
+import { changeUnit, handleNumberValue, handlePriceColor, parsePercent } from '@/filters'
|
|
|
import { ChartCycleType } from '@/constants/chart'
|
|
import { ChartCycleType } from '@/constants/chart'
|
|
|
import { useFuturesStore } from '@/stores'
|
|
import { useFuturesStore } from '@/stores'
|
|
|
import { useDataset } from '@/hooks/hqchart/candlestick/dataset'
|
|
import { useDataset } from '@/hooks/hqchart/candlestick/dataset'
|
|
@@ -139,7 +139,8 @@ const chartOption = {
|
|
|
const decimalplace = goods.value?.decimalplace
|
|
const decimalplace = goods.value?.decimalplace
|
|
|
// 自定义标题栏,参考源码 DynamicKLineTitlePainting.GetFormatTitle
|
|
// 自定义标题栏,参考源码 DynamicKLineTitlePainting.GetFormatTitle
|
|
|
paint.GetFormatTitle = (data) => {
|
|
paint.GetFormatTitle = (data) => {
|
|
|
- const { Date, Time, Open, High, Low, Close, Vol, Amount, YClose } = data.Data
|
|
|
|
|
|
|
+ const { Date, Time, Open, High, Low, Close, Vol, Amount, YClose, YFClose } = data.Data
|
|
|
|
|
+ const yclose = YFClose ?? YClose
|
|
|
const AryText = [
|
|
const AryText = [
|
|
|
{ Text: FormatDateString(Date), Color: paint.DateTimeColor },
|
|
{ Text: FormatDateString(Date), Color: paint.DateTimeColor },
|
|
|
]
|
|
]
|
|
@@ -147,10 +148,10 @@ const chartOption = {
|
|
|
AryText.push({ Text: FormatTimeString(Time), Color: paint.DateTimeColor })
|
|
AryText.push({ Text: FormatTimeString(Time), Color: paint.DateTimeColor })
|
|
|
}
|
|
}
|
|
|
AryText.push(
|
|
AryText.push(
|
|
|
- { Text: '开:' + handleNumberValue(Open.toFixed(decimalplace)), Color: paint.GetColor(Open, YClose) },
|
|
|
|
|
- { Text: '高:' + handleNumberValue(High.toFixed(decimalplace)), Color: paint.GetColor(High, YClose) },
|
|
|
|
|
- { Text: '低:' + handleNumberValue(Low.toFixed(decimalplace)), Color: paint.GetColor(Low, YClose) },
|
|
|
|
|
- { Text: '收:' + handleNumberValue(Close.toFixed(decimalplace)), Color: paint.GetColor(Close, YClose) }
|
|
|
|
|
|
|
+ { Text: '开:' + handleNumberValue(Open.toFixed(decimalplace)), Color: paint.GetColor(Open, yclose) },
|
|
|
|
|
+ { Text: '高:' + handleNumberValue(High.toFixed(decimalplace)), Color: paint.GetColor(High, yclose) },
|
|
|
|
|
+ { Text: '低:' + handleNumberValue(Low.toFixed(decimalplace)), Color: paint.GetColor(Low, yclose) },
|
|
|
|
|
+ { Text: '收:' + handleNumberValue(Close.toFixed(decimalplace)), Color: paint.GetColor(Close, yclose) }
|
|
|
)
|
|
)
|
|
|
if (goods.value?.trademode !== 99) {
|
|
if (goods.value?.trademode !== 99) {
|
|
|
AryText.push(
|
|
AryText.push(
|
|
@@ -186,21 +187,28 @@ const customHistoryDataStringFormat = () => {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
Width: 140,
|
|
Width: 140,
|
|
|
|
|
+ Height: 0,
|
|
|
Text: '',
|
|
Text: '',
|
|
|
Operator: function () {
|
|
Operator: function () {
|
|
|
const { FormatDateString, FormatTimeString } = Chart.IFrameSplitOperator
|
|
const { FormatDateString, FormatTimeString } = Chart.IFrameSplitOperator
|
|
|
const { Data } = this.Value
|
|
const { Data } = this.Value
|
|
|
- const preValue = Data.YFClose ?? Data.YClose
|
|
|
|
|
|
|
+ const yclose = Data.YFClose ?? Data.YClose
|
|
|
|
|
+ const rise = yclose ? Data.Close - yclose : 0 // 涨跌
|
|
|
|
|
+ const increase = rise ? rise / yclose : 0 // 幅度
|
|
|
|
|
|
|
|
|
|
+ this.Height = 165
|
|
|
this.Text = `<dl class="app-hqchart-tooltip">`
|
|
this.Text = `<dl class="app-hqchart-tooltip">`
|
|
|
this.Text += `<dt><span>${FormatDateString(Data.Date)}</span>${Data.Time ? '<span>' + FormatTimeString(Data.Time) + '</span>' : ''}</dt>`
|
|
this.Text += `<dt><span>${FormatDateString(Data.Date)}</span>${Data.Time ? '<span>' + FormatTimeString(Data.Time) + '</span>' : ''}</dt>`
|
|
|
- this.Text += `<dd><span>开盘:</span><span class="${handlePriceColor(Data.Open, preValue)}">${handleNumberValue(Data.Open.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
- this.Text += `<dd><span>最高:</span><span class="${handlePriceColor(Data.High, preValue)}">${handleNumberValue(Data.High.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
- this.Text += `<dd><span>最低:</span><span class="${handlePriceColor(Data.Low, preValue)}">${handleNumberValue(Data.Low.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
- this.Text += `<dd><span>收盘:</span><span class="${handlePriceColor(Data.Close, preValue)}">${handleNumberValue(Data.Close.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
|
|
+ this.Text += `<dd><span>开盘:</span><span class="${handlePriceColor(Data.Open, yclose)}">${handleNumberValue(Data.Open.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
+ this.Text += `<dd><span>最高:</span><span class="${handlePriceColor(Data.High, yclose)}">${handleNumberValue(Data.High.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
+ this.Text += `<dd><span>最低:</span><span class="${handlePriceColor(Data.Low, yclose)}">${handleNumberValue(Data.Low.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
+ this.Text += `<dd><span>收盘:</span><span class="${handlePriceColor(Data.Close, yclose)}">${handleNumberValue(Data.Close.toFixed(decimalplace))}</span></dd>`
|
|
|
|
|
+ this.Text += `<dd><span>涨跌:</span><span class="${handlePriceColor(rise)}">${rise.toFixed(decimalplace)}</span></dd>`
|
|
|
|
|
+ this.Text += `<dd><span>幅度:</span><span class="${handlePriceColor(increase)}">${parsePercent(increase)}</span></dd>`
|
|
|
if (goods.value?.trademode !== 99) {
|
|
if (goods.value?.trademode !== 99) {
|
|
|
this.Text += `<dd><span>数量:</span><span>${changeUnit(Data.Vol)}</span></dd>`
|
|
this.Text += `<dd><span>数量:</span><span>${changeUnit(Data.Vol)}</span></dd>`
|
|
|
this.Text += `<dd><span>金额:</span><span>${changeUnit(Data.Amount)}</span></dd>`
|
|
this.Text += `<dd><span>金额:</span><span>${changeUnit(Data.Amount)}</span></dd>`
|
|
|
|
|
+ this.Height = 210
|
|
|
}
|
|
}
|
|
|
this.Text += `</dd>`
|
|
this.Text += `</dd>`
|
|
|
this.Text += `</dl>`
|
|
this.Text += `</dl>`
|