applyLine() refactor/fix

This commit is contained in:
Tim
2024-05-03 13:42:37 -04:00
parent 056a4e299d
commit 171d6431ae
3 changed files with 13 additions and 8 deletions

View File

@@ -27,7 +27,6 @@ function changeSymbol(symbol) {
lastSymbolChangedArgs = info
symbolChangedCbs.forEach((cb)=>cb(info))
co.selectedSymbol = info
co.meanRange = chartMeanRange()
}
@@ -36,6 +35,13 @@ function changeInterval(interval, _timeframe) {
}
function dataLoaded() {
const range = chartMeanRange()
console.log('new mean range', range)
co.meanRange = range
}
/* TradingView event keystrings
const subscribeEvents = [
'toggle_sidebar', 'indicators_dialog', 'toggle_header', 'edit_object_dialog', 'chart_load_requested',
@@ -83,6 +89,7 @@ function initChart() {
chart.crossHairMoved().subscribe(null, (point)=>setTimeout(()=>handleCrosshairMovement(point),0) )
chart.onSymbolChanged().subscribe(null, changeSymbol)
chart.onIntervalChanged().subscribe(null, changeInterval)
chart.onDataLoaded().subscribe(null, dataLoaded)
const tzapi = chart.getTimezoneApi();
tzapi.onTimezoneChanged().subscribe(null, (tz)=>{if (tz==='exchange') tz='Etc/UTC'; s.timeZone=tz})
s.timeZone = tzapi.getTimezone().id