我是 Tradingview 图表库的新手,我想创建响应式图表。
问题是,交易视图图表库需要指定宽度和高度。这是代码。
const chart = LightweightCharts.createChart(e, {
width: e.offsetWidth,
height: e.offsetHeight,
layout: {
backgroundColor: 'rgb(17, 17, 39)',
textColor: 'rgba(255, 255, 255, 0.9)',
},
grid: {
vertLines: {
color: 'rgb(41, 44, 58)',
},
horzLines: {
color: 'rgb(41, 44, 58)',
},
},
crosshair: {
mode: LightweightCharts.CrosshairMode.Normal,
},
priceScale: {
borderColor: 'rgba(197, 203, 206, 0.8)',
},
timeScale: {
borderColor: 'rgba(197, 203, 206, 0.8)',
},
});