我正在构建一个带有预设价格数据的烛台图表。默认情况下,它设置为0.01
价格的两位小数。然而,我的价格数据范围从 0.01 到 0.0000002 等。我正在尝试实现priceFormat
属性,但它不起作用。谢谢
这是我的代码和图表数据
const log = console.log;
const chartProperties = {
width:1200,
height:600,
timeScale:{
timeVisible:true,
secondsVisible:false,
},
priceFormat: {
type: 'price',
precision: 6,
minMove: 0.000001,
},
}
const domElement = document.getElementById('chart');
const chart = LightweightCharts.createChart(domElement,chartProperties);
const candleSeries = chart.addCandlestickSeries();
fetch(`http://localhost:8888/chart/dataset.txt`)
.then(res => res.json())
.then(data => {
const cdata = data.map(d => {
return {time:d[0]/1000,open:parseFloat(d[1]),high:parseFloat(d[2]),low:parseFloat(d[3]),close:parseFloat(d[4])}
});
candleSeries.setData(cdata);
})
.catch(err => log(err));
[
[1640060100000,"0.004","0.008","0.002","0.0055",1640060159999],[1640060160000,"0.0055","0.008","0.002","0.005",1640060219999],[1640078220000,"0.005","0.008","0.002","0.0045",1640078279000],[1640078280000,"0.0045","0.0065","0.0043","0.0058",1640078339000]
]