Browse Source

图表数据修改完成

hongxilin/hotfix-20250625101643-手机输入法弹出输入框上浮
宋杰 1 week ago
parent
commit
f01e6d6134
  1. 43
      src/views/components/emoEnergyConverter.vue
  2. 78
      src/views/components/emotionalBottomRadar.vue
  3. 1
      src/views/components/marketTemperature.vue

43
src/views/components/emoEnergyConverter.vue

@ -244,12 +244,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
show: true,
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#fff',
width: 1,
type: 'solid'
},
type: 'line',
lineStyle: {
color: '#fff',
width: 1,
@ -280,10 +275,10 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
let color = param.color
if (param.seriesType === 'candlestick') {
let openPrice = value[0] //
let closePrice = value[1] //
let lowPrice = value[2] //
let highPrice = value[3] //
let openPrice = value[1] //
let closePrice = value[2] //
let lowPrice = value[3] //
let highPrice = value[4] //
//
if (typeof openPrice !== 'number' || typeof closePrice !== 'number' ||
@ -293,10 +288,10 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
let priceChange = closePrice - openPrice
let changePercent = ((priceChange / openPrice) * 100).toFixed(2)
let changeColor = priceChange >= 0 ? '#ef232a' : '#14b143'
let changeColor = priceChange >= 0 ? '#14b143' : '#ef232a'
result += `<div style="margin-bottom: 6px;">`
result += `<div style="color: #fff; font-weight: bold;">${param.seriesName}</div>`
// result += `<div style="color: #fff; font-weight: bold;">${param.seriesName}</div>`
result += `<div style="color: #fff;">开盘: ${openPrice.toFixed(2)}</div>`
result += `<div style="color: #fff;">收盘: ${closePrice.toFixed(2)}</div>`
result += `<div style="color: #fff;">最低: ${lowPrice.toFixed(2)}</div>`
@ -317,7 +312,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
{
type: 'slider',
xAxisIndex: 0,
start: 40,
start: 0,
end: 100,
show: true,
bottom: 10,
@ -335,7 +330,7 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
{
type: 'inside',
xAxisIndex: 0,
start: 70,
start: 0,
end: 100,
zoomOnMouseWheel: true,
moveOnMouseMove: true,
@ -349,9 +344,21 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
rotate: 45, // 45
color: "white"
},
axisLine: {
// show: false,
lineStyle: {
color: 'white', // x线
}
},
},
yAxis: {
scale: true,
axisLine: {
// show: false,
lineStyle: {
color: 'white', // x线
}
},
splitLine: {
show: false,
},
@ -391,10 +398,10 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
itemStyle: {
normal: {
// 线 >
color: 'transparent', // 线
color0: '#008080', // 线
borderColor: '#ff0783', // 线
borderColor0: '#008080', // 线绿
color: '#14b143', // < 绿
color0: '#ef232a', // >
borderColor: '#14b143', // 线绿
borderColor0: '#ef232a', // 线
}
},
//

78
src/views/components/emotionalBottomRadar.vue

@ -19,8 +19,28 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
// -x
let dateArray = barAndLineData.map(subArray => subArray[0])
// k线
let kLineDataArray = KlineData.map(subArray => subArray.slice(1, 5))
// k线['2025/04/24', 250.5, 259.51, 249.2, 259.54, 274.899, 0.685, 258.354]
// 1=, 2=, 3=, 4=
// ECharts candlestick[, , , ]
let kLineDataArray = KlineData.map(subArray => [
subArray[1], //
subArray[2], //
subArray[3], //
subArray[4] //
])
// K线y
let allKlineValues = []
kLineDataArray.forEach(item => {
if (Array.isArray(item) && item.length >= 4) {
// K线[, , , ]
allKlineValues.push(item[0], item[1], item[2], item[3])
}
})
// 10
let minValue = Math.min(...allKlineValues.filter(val => typeof val === 'number' && !isNaN(val)))
let yAxisMin = Math.floor(minValue / 10) * 10
// 线
let redLineDataArray = barAndLineData.map(subArray => subArray[1])
//
@ -157,24 +177,34 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
if (param.seriesType === 'candlestick') {
// ECharts candlestickvalue[, , , ]
// param.value
let dataIndex = param.dataIndex
let candlestickData = kLineDataArray[dataIndex]
let candlestickData = param.value
//
if (!Array.isArray(candlestickData) || candlestickData.length < 4) {
return ''
}
let openPrice = candlestickData[1] //
let closePrice = candlestickData[2] //
let lowPrice = candlestickData[3] //
let highPrice = candlestickData[4] //
//
if (typeof openPrice !== 'number' || typeof closePrice !== 'number' ||
typeof lowPrice !== 'number' || typeof highPrice !== 'number') {
return ''
}
let openPrice = candlestickData[0] //
let closePrice = candlestickData[1] //
let lowPrice = candlestickData[2] //
let highPrice = candlestickData[3] //
let priceChange = closePrice - openPrice
let changePercent = ((priceChange / openPrice) * 100).toFixed(2)
let changeColor = priceChange >= 0 ? '#14b143' : '#ef232a' // 绿
let changeColor = priceChange >= 0 ? '#14b143' : '#ef232a' // 绿
result += `<div style="margin-bottom: 6px;">`
result += `<div style="color: #fff; font-weight: bold;">${param.seriesName}</div>`
result += `<div style="color: #fff;">开盘: ${openPrice.toFixed(2)}</div>`
result += `<div style="color: #fff;">收盘: ${closePrice.toFixed(2)}</div>`
result += `<div style="color: #fff;">最低: ${lowPrice.toFixed(2)}</div>`
result += `<div style="color: #fff;">最高: ${highPrice.toFixed(2)}</div>`
result += `<div style="color: #fff;">开盘: ${openPrice.toFixed(1)}</div>`
result += `<div style="color: #fff;">收盘: ${closePrice.toFixed(1)}</div>`
result += `<div style="color: #fff;">最低: ${lowPrice.toFixed(1)}</div>`
result += `<div style="color: #fff;">最高: ${highPrice.toFixed(1)}</div>`
result += `<div style="color: ${changeColor};">涨跌: ${priceChange >= 0 ? '+' : ''}${priceChange.toFixed(2)} (${changePercent}%)</div>`
result += `</div>`
} else if (param.seriesName === '红线') {
@ -183,7 +213,6 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
result += `<div style="color: ${color}; margin-bottom: 4px;">${param.seriesName}: ${value}</div>`
}
})
return result
}
},
@ -251,7 +280,7 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
axisPointer: {
link: {
xAxisIndex: 'all'
}
},
}
},
{
@ -319,6 +348,7 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
type: 'value',
gridIndex: 0,
splitNumber: 4,
min: yAxisMin, // y10
axisLine: {
lineStyle: {
color: 'white' // y
@ -331,9 +361,6 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
width: 50, //
color: 'white',
formatter: function (value, index) {
if (index === 0) {
return '0'
}
return value.toFixed(2)
}
},
@ -344,7 +371,6 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
type: 'dotted' // 线 dotted线 solid:线
}
},
// min: 4,
scale: true, // 0k线
},
{
@ -424,7 +450,7 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
{
type: 'slider',
xAxisIndex: [0, 1, 2],
start: 70,
start: 0,
end: 100,
show: true,
bottom: 10,
@ -449,7 +475,7 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
{
type: 'inside',
xAxisIndex: [0, 1, 2],
start: 70,
start: 0,
end: 100,
zoomOnMouseWheel: true,
moveOnMouseMove: true,
@ -464,13 +490,13 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
xAxisIndex: 0,
yAxisIndex: 0,
itemStyle: {
color: '#14b143', // (绿)
color0: '#ef232a', // ()
color: '#14b143', // > 绿
color0: '#ef232a', // <
borderColor: '#14b143',
borderColor0: '#ef232a',
normal: {
color: '#14b143', // (绿)
color0: '#ef232a', // ()
color: '#14b143', // > 绿
color0: '#ef232a', // <
borderColor: '#14b143',
borderColor0: '#ef232a',
opacity: function (params) {

1
src/views/components/marketTemperature.vue

@ -337,6 +337,7 @@ function initChart(raw, klineDataRawValue, WDRLValue) {
data: klineData,
itemStyle: {
normal: {
color: '#00FF00', // 线
color0: '#FF0000', // 线绿
borderColor: '#00FF00', // 线

Loading…
Cancel
Save