小编dta*_*anp的帖子

当图表很小时,无法在轻量级图表上显示所有数据,这是预期的吗?

不确定这是否是一个限制,但我无法让图表显示所有数据(我有 1500 条记录)。fitContent() 或 setVisibleRange() 没有帮助。

演示

var chart = LightweightCharts.createChart(document.body, {
    width: 600,
    height: 300,
    rightPriceScale: {
        scaleMargins: {
            top: 0.1,
            bottom: 0.1,
        },
    },
});

var areaSeries = chart.addAreaSeries({
    topColor: 'rgba(76, 175, 80, 0.56)',
    bottomColor: 'rgba(76, 175, 80, 0.04)',
    lineColor: 'rgba(76, 175, 80, 1)',
    lineWidth: 2,
    title: 'AAPL',
});

areaSeries.setData([{
    "time": 1629353327,
    "value": 19.97
}, {
    "time": 1629439727,
    "value": 19.67
},
....
}]);
chart.timeScale().fitContent();
Run Code Online (Sandbox Code Playgroud)

这是预期的吗?如果图表宽度设置为 800px,它将起作用。

lightweight-charts

2
推荐指数
1
解决办法
1650
查看次数

标签 统计

lightweight-charts ×1