Fix syntax error and add price format selector listener
This commit is contained in:
@ -313,27 +313,28 @@ constructor() {
|
|||||||
return TimezoneConfig.formatTickMark(time);
|
return TimezoneConfig.formatTickMark(time);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
localization: {
|
localization: {
|
||||||
timeFormatter: (timestamp) => {
|
timeFormatter: (timestamp) => {
|
||||||
return TimezoneConfig.formatDate(timestamp * 1000);
|
return TimezoneConfig.formatDate(timestamp * 1000);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
handleScroll: {
|
handleScroll: {
|
||||||
// Setup price format selector change handler
|
vertTouchDrag: false,
|
||||||
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,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
this.candleSeries = this.chart.addSeries(LightweightCharts.CandlestickSeries, {
|
// 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.candleSeries = this.chart.addSeries(LightweightCharts.CandlestickSeries, {
|
||||||
upColor: '#ff9800',
|
upColor: '#ff9800',
|
||||||
downColor: '#ff9800',
|
downColor: '#ff9800',
|
||||||
borderUpColor: '#ff9800',
|
borderUpColor: '#ff9800',
|
||||||
|
|||||||
Reference in New Issue
Block a user