行情区:当前价增加虚线价格线(与高低点一致)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-02 12:01:52 +08:00
parent 586465e64e
commit cc041a0dc5
2 changed files with 29 additions and 2 deletions
+27
View File
@@ -46,6 +46,7 @@
let priceTick = null;
let priceAutoScale = true;
let rangeMarkers = [];
let currentPriceLine = null;
let lastCandles = [];
let candleByTime = {};
let chartMeta = null;
@@ -159,9 +160,35 @@
function showLatestOhlcv() {
paintOhlcv(latestCandle());
updateCurrentPriceLine();
updatePriceTag();
}
function clearCurrentPriceLine() {
if (currentPriceLine && candleSeries) {
try {
candleSeries.removePriceLine(currentPriceLine);
} catch (e) {}
}
currentPriceLine = null;
}
function updateCurrentPriceLine() {
clearCurrentPriceLine();
if (!candleSeries) return;
const bar = latestCandle();
if (!bar || bar.close == null) return;
const up = Number(bar.close) >= Number(bar.open);
currentPriceLine = candleSeries.createPriceLine({
price: Number(bar.close),
color: up ? "#00ff9d" : "#ff4d6d",
lineWidth: 1,
lineStyle: 2,
axisLabelVisible: true,
title: "现价",
});
}
function tickLiveClock() {
const cd = fmtBarCountdown(barRemainMs(currentTf));
if (elPriceTagTime && elPriceTag && !elPriceTag.classList.contains("hidden")) {
+2 -2
View File
@@ -192,7 +192,7 @@
<div id="toast"></div>
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
<script src="/assets/chart.js?v=20260528-hub-market6"></script>
<script src="/assets/app.js?v=20260528-hub-market6"></script>
<script src="/assets/chart.js?v=20260528-hub-market7"></script>
<script src="/assets/app.js?v=20260528-hub-market7"></script>
</body>
</html>