update switching fr logic for expected alpha

This commit is contained in:
2026-05-07 20:59:47 +00:00
parent 1bbb4797ce
commit e4bdb3f6a0
6 changed files with 122 additions and 60 deletions

View File

@@ -36,10 +36,12 @@ async function update_tv(data_list, lookback_max_points) {
async function create_tv(charts_list, create_chart_options) {
const container = document.getElementById('tv');
if (create_chart_options.crosshair == 'NORMAL') {
create_chart_options.crosshair = { mode: LightweightCharts.CrosshairMode.Normal }
};
window.chart = LightweightCharts.createChart(document.getElementById('tv'), create_chart_options);
window.chart = LightweightCharts.createChart(container, create_chart_options);
window.charts_arr = [];
charts_list.forEach(function (item, index) {
@@ -64,7 +66,18 @@ async function create_tv(charts_list, create_chart_options) {
});
window.chart.timeScale().fitContent();
// Handle responsiveness: Resize chart when container size changes
const resizeObserver = new ResizeObserver(entries => {{
for (let entry of entries) {{
window.chart.applyOptions({
width: entry.contentRect.width,
height: entry.contentRect.height
});
}}
}});
resizeObserver.observe(container);
console.log("TV Created!")
// window.midPriceLine_Config = {