Add price format configuration to settings popup and apply to chart
This commit is contained in:
@ -1444,6 +1444,14 @@
|
||||
<option value="Australia/Sydney">Sydney (AEST/AEDT)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="settings-group">
|
||||
<label class="settings-label">Price format</label>
|
||||
<select class="settings-select" id="priceFormatSelect">
|
||||
<option value="0">Integer (no decimals)</option>
|
||||
<option value="2">Decimal (2 dp)</option>
|
||||
<option value="4">Decimal (4 dp)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-controls" id="navControls">
|
||||
|
||||
@ -319,6 +319,16 @@ constructor() {
|
||||
},
|
||||
},
|
||||
handleScroll: {
|
||||
// Setup price format selector change handler
|
||||
const priceSelect = document.getElementById("priceFormatSelect");
|
||||
if (priceSelect) {
|
||||
priceSelect.addEventListener("change", (e) => {
|
||||
const precision = parseInt(e.target.value);
|
||||
this.chart.priceScale().applyOptions({
|
||||
priceFormat: { type: "price", precision: precision, minMove: precision===0 ? 1 : 0.0001 }
|
||||
});
|
||||
});
|
||||
}
|
||||
vertTouchDrag: false,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user