添加连续跳空和分立跳空图

This commit is contained in:
jackyu66git
2025-09-05 00:04:57 +08:00
parent 164db4ab51
commit 09cfa56e1d
4 changed files with 81 additions and 5 deletions
+43 -2
View File
@@ -3053,8 +3053,47 @@
cross0_down_list: cm.cross0_down_list || []
}
);
// 从 ChanMACD 的 klu_list 提取 continue_div / separate_div 标记,供主K线图显示
try {
const kluList = Array.isArray(cm.klu_list) ? cm.klu_list : [];
const kluDivMarkers = [];
kluList.forEach((item) => {
if (!item || !item.time) return;
const ts = Math.floor(new Date(item.time).getTime() / 1000);
if (isNaN(ts)) return;
// separate_div 为 true:上方蓝色箭头
if (item.separate_div === true) {
kluDivMarkers.push({
time: ts,
position: 'aboveBar',
color: '#03a9f4',
shape: 'arrowUp',
text: 'SD',
size: 0.6
});
}
// continue_div 为 true:下方橙色箭头
if (item.continue_div === true) {
kluDivMarkers.push({
time: ts,
position: 'belowBar',
color: '#ff9800',
shape: 'arrowDown',
text: 'CD',
size: 0.6
});
}
});
window.kluDivMarkers = kluDivMarkers;
} catch (e) {
console.warn('处理 KLU 背驰标记出错:', e);
window.kluDivMarkers = [];
}
} else {
console.log('⚠️ 没有ChanMACD分析数据');
// 无数据时清空本次的 KLU 背驰标记
window.kluDivMarkers = [];
}
} else {
console.log('⚠️ ChanMACD图表创建条件不满足');
@@ -5330,7 +5369,8 @@
const combinedMarkers = [
...(window.mainFxMarkers || []),
...allElementFxMarkers,
...((typeof window.showUOnMain === 'undefined' || window.showUOnMain) ? (window.unittfMarkers || []) : [])
...((typeof window.showUOnMain === 'undefined' || window.showUOnMain) ? (window.unittfMarkers || []) : []),
...(window.kluDivMarkers || [])
];
if (combinedMarkers.length > 0) {
console.log('合并设置', combinedMarkers.length, '个标记(主周期分型:', (window.mainFxMarkers || []).length, '个,小周期分型:', allElementFxMarkers.length, '个,UnitTF:', (window.unittfMarkers || []).length, '个)');
@@ -5353,7 +5393,8 @@
// 只设置主周期分型 + UnitTF 标记
const onlyMainAndU = [
...(window.mainFxMarkers || []),
...((typeof window.showUOnMain === 'undefined' || window.showUOnMain) ? (window.unittfMarkers || []) : [])
...((typeof window.showUOnMain === 'undefined' || window.showUOnMain) ? (window.unittfMarkers || []) : []),
...(window.kluDivMarkers || [])
];
if (onlyMainAndU.length > 0) {
console.log('仅设置', onlyMainAndU.length, '个主周期/UnitTF标记(主周期分型:', (window.mainFxMarkers || []).length, 'UnitTF:', (window.unittfMarkers || []).length, '');