Fix settings controls and prevent auto-expand
1. Removed configuringId setting from addIndicator so indicators are NOT expanded by default 2. Added window.updateIndicatorColor function to handle color picker changes 3. Added onchange handler to color picker input to call updateIndicatorColor 4. Added window.updateIndicatorSetting function to update indicator parameters Users can now: - Not have indicators auto-expanded when added (default collapsed) - Click indicator name to manually expand settings - Change colors and settings and they will update on the chart
This commit is contained in:
@ -274,11 +274,11 @@ function renderIndicatorConfig(indicator, meta) {
|
||||
<div class="config-row">
|
||||
<label>${group.name} Color</label>
|
||||
<div class="color-picker">
|
||||
<input type="color" id="color_${indicator.id}_${firstIdx}" value="${color}">
|
||||
<input type="color" id="color_${indicator.id}_${firstIdx}" value="${color}" onchange="window.updateIndicatorColor && window.updateIndicatorColor('${indicator.id}', ${firstIdx}, this.value)">
|
||||
<span class="color-preview" style="background: ${color};"></span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
`.trim() + '';
|
||||
}).join('')}
|
||||
|
||||
<div class="config-row">
|
||||
@ -453,6 +453,22 @@ window.clearSearch = function() {
|
||||
renderIndicatorPanel();
|
||||
};
|
||||
|
||||
window.updateIndicatorColor = function(id, index, color) {
|
||||
const indicator = activeIndicators.find(a => a.id === id);
|
||||
if (!indicator) return;
|
||||
|
||||
indicator.params[`_color_${index}`] = color;
|
||||
drawIndicatorsOnChart();
|
||||
};
|
||||
|
||||
window.updateIndicatorSetting = function(id, key, value) {
|
||||
const indicator = activeIndicators.find(a => a.id === id);
|
||||
if (!indicator) return;
|
||||
|
||||
indicator.params[key] = value;
|
||||
drawIndicatorsOnChart();
|
||||
};
|
||||
|
||||
window.clearAllIndicators = function() {
|
||||
activeIndicators.forEach(ind => {
|
||||
ind.series?.forEach(s => {
|
||||
@ -607,8 +623,7 @@ function addIndicator(type) {
|
||||
series: [],
|
||||
visible: true
|
||||
});
|
||||
|
||||
configuringId = id;
|
||||
// Don't set configuringId so indicators are NOT expanded by default
|
||||
renderIndicatorPanel();
|
||||
drawIndicatorsOnChart();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user