Add DOMContentLoaded listener for price format selector to apply precision changes

This commit is contained in:
DiTus
2026-03-18 23:28:14 +01:00
parent e47b9cd5c3
commit b9d3add00d

View File

@ -368,6 +368,28 @@ constructor() {
this.initPriceScaleControls(); this.initPriceScaleControls();
this.initNavigationControls(); this.initNavigationControls();
// Setup price format selector change handler
document.addEventListener("DOMContentLoaded", () => {
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 }
});
});
}
});
// 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 }
});
});
}
this.chart.timeScale().subscribeVisibleLogicalRangeChange(this.onVisibleRangeChange.bind(this)); this.chart.timeScale().subscribeVisibleLogicalRangeChange(this.onVisibleRangeChange.bind(this));