Fix line width slider to respect user settings

Changed line width priority from plot.width (metadata default) to indicator.params._lineWidth
(user setting). Now when user changes line width via slider, the chart properly updates
to use the user's specified width instead of the hardcoded plot.width=1 from metadata.
Also added immediate visual feedback to slider with nextElementSibling.textContent update.
This commit is contained in:
DiTus
2026-02-25 23:21:26 +01:00
parent 8f6725a700
commit c6a6f1cfb9

View File

@ -290,7 +290,7 @@ return `
<div class="config-row">
<label>Line Width</label>
<input type="range" min="1" max="5" value="${indicator.params._lineWidth || 2}" onchange="window.updateIndicatorSetting && window.updateIndicatorSetting('${indicator.id}', '_lineWidth', parseInt(this.value))">
<input type="range" min="1" max="5" value="${indicator.params._lineWidth || 2}" onchange="this.nextElementSibling.textContent = this.value; window.updateIndicatorSetting && window.updateIndicatorSetting('${indicator.id}', '_lineWidth', parseInt(this.value))">
<span class="range-value">${indicator.params._lineWidth || 2}</span>
</div>
</div>
@ -695,7 +695,7 @@ function renderIndicatorOnPane(indicator, meta, instance, candles, paneIndex, li
topFillColor2: '#00000000',
bottomFillColor1: '#00000000',
bottomColor: plot.bottomColor || '#00000000',
lineWidth: plot.width !== undefined ? plot.width : lineWidth,
lineWidth: indicator.params._lineWidth || plot.width || lineWidth,
lineStyle: plotLineStyle,
title: plot.title || '',
priceLineVisible: false,
@ -704,7 +704,7 @@ function renderIndicatorOnPane(indicator, meta, instance, candles, paneIndex, li
} else {
series = window.dashboard.chart.addSeries(LightweightCharts.LineSeries, {
color: plotColor,
lineWidth: plot.width !== undefined ? plot.width : lineWidth,
lineWidth: indicator.params._lineWidth || plot.width || lineWidth,
lineStyle: plotLineStyle,
title: plot.title || '',
priceLineVisible: false,