11.26 修改K线图样式

This commit is contained in:
尚政杰
2025-11-26 17:19:38 +08:00
parent 48f49c6cf0
commit 4e64455b9b
4803 changed files with 146408 additions and 648 deletions

View File

@@ -18,6 +18,8 @@ const _sfc_main = {
//股票code
categoryList: ["分时图", "日K线"],
selectCategory: 0,
tradeData: null,
//成交数据
option: {
title: {
show: false
@@ -33,7 +35,7 @@ const _sfc_main = {
type: "cross"
},
formatter: function(params) {
common_vendor.index.__f__("log", "at pages/index/stockDetails/stockDetails.vue:66", params);
common_vendor.index.__f__("log", "at pages/index/stockDetails/stockDetails.vue:74", params);
let res = "日期:" + params[0].name + "\n开盘价" + params[0].data[1] + "\n收盘价" + params[0].data[2] + "\n最低价" + params[0].data[3] + "\n最高价" + params[0].data[4];
return res;
}
@@ -54,7 +56,7 @@ const _sfc_main = {
axisLine: { onZero: false },
splitLine: { show: false },
min: "dataMin",
max: "dataMax"
max: ""
},
yAxis: {
scale: true,
@@ -82,10 +84,10 @@ const _sfc_main = {
type: "candlestick",
data: [],
itemStyle: {
color: "#ec0000",
color0: "#00da3c",
borderColor: "#ec0000",
borderColor0: "#00da3c"
color: "#ffffff",
color0: "#355422",
borderColor: "#c00000",
borderColor0: "#355422"
}
}
]
@@ -96,14 +98,13 @@ const _sfc_main = {
},
tooltip: {
position: function(pos, params, dom, rect, size) {
var obj = { top: "10%" };
var obj = { top: "5%" };
obj[["left", "right"][+(pos[0] < size.viewSize[0] / 2)]] = 5;
return obj;
},
trigger: "axis",
formatter: function(params) {
common_vendor.index.__f__("log", "at pages/index/stockDetails/stockDetails.vue:137", params);
let res = "时间:" + params[0].name + "\n高" + params[0].data[2] + "\n开" + params[0].data[3] + "\n低" + params[0].data[4] + "\n收" + params[0].data[1] + "\n涨幅" + params[0].data[5] + "%";
let res = "时间:" + params[0].name + "\n高" + params[0].data[2] + "\n开" + params[0].data[3] + "\n低" + params[0].data[4] + "\n收" + params[0].data[1] + "\n涨幅" + params[0].data[5] + "%\n量" + params[0].data[6] + "\n金额" + params[0].data[7];
return res;
}
},
@@ -115,7 +116,10 @@ const _sfc_main = {
},
xAxis: {
type: "category",
scale: true
scale: true,
axisLabel: {
customValues: ["09:30", "10:00", "10:30", "11:00", "11:30", "13:00", "13:30", "14:00", "14:30", "15:00"]
}
},
yAxis: {
show: false,
@@ -197,13 +201,22 @@ const _sfc_main = {
if (res.code == 200) {
this.navTitle = res.data.basic_info.stock_name + "(" + res.data.basic_info.stock_code + ")";
let data = res.data.minute_chart_data;
this.tradeData = res.data.latest_trade;
let categoryData = [];
let valueData = [];
let open = data[0].open;
for (let item of data) {
categoryData.push(item.time);
let rate = utils_util.accMul(utils_util.accDiv(utils_util.accSub(item.close, open), open).toFixed(4), 100);
valueData.push([item.time, item.close, item.high, item.open, item.low, rate]);
let volume = item.volume;
if (volume > 1e4) {
volume = (volume / 1e4).toFixed(0) + "万";
}
let amount = item.amount;
if (amount > 1e4) {
amount = (amount / 1e4).toFixed(0) + "万";
}
valueData.push([item.time, item.close, item.high, item.open, item.low, rate, volume, amount]);
}
let min = open;
let max = 0;
@@ -239,7 +252,8 @@ const _sfc_main = {
this.option1.yAxis.max = intervalList[intervalList.length - 1].toFixed(2);
this.option1.series.data = valueData;
let markData = [];
let time = res.data.event_info;
let time = res.data.event_info.event_start_time.split("T")[1];
time = time.substring(0, 5);
for (let item of intervalList) {
markData.push(
{