diff --git a/js/ui/chart.js b/js/ui/chart.js index b6300bc..348340d 100644 --- a/js/ui/chart.js +++ b/js/ui/chart.js @@ -368,6 +368,28 @@ constructor() { this.initPriceScaleControls(); 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));