pyecharts居中自适应

时间:2024-03-15 08:36:59

pyecharts render的html文件,默认图表位于左上角。修改Anaconda3/Lib/site-packages/pyecharts/engine.py文件的第15行如下:

'<div id="{chart_id}" style="width:{width};height:{height};margin:auto;top:30px"></div>'

熟悉html的一看就懂了?,我简要解释下。其中,margin设置左右自适应居中,top为距上面的距离。这样的话,即使原页面大小变化,也居中并距上间距。
pyecharts居中自适应