我会尽力解释这一点。我已经将图表绘制成HTML格式,一切看起来都很好。我已经使用js正确设置了autosize: true
的布局自动调整大小。但是,在页面加载时,图表仅占用<div>
的一半。当我将屏幕最小化为移动视图然后再次最大化时,图表将正确显示,占据了div的整个宽度。我不知道为什么,显然我希望图表显示全宽。前后请参见以下内容:
刚加载页面时div的屏幕截图。
最小化然后最大化屏幕后-您可以看到它占据了所需的全宽度
当前配置:
var layout= {
xaxis: {
title: {
text: 'X Axis Title',
},
automargin: true
},
yaxis: {
title: {
text: 'Y Axis Title',
},
automargin: true
},
autosize: true,
paper_bgcolor: "#00000000",
plot_bgcolor: "#00000000"
}
Plotly.newPlot('chart_div', data, layout, {responsive: true});