请在下列代码中给整体加入一个黑色背景色 page = Page(layout=Page.DraggablePageLayout) page.add( bar_film(), line_ranking(), pie_circletype(), WordCloud_wc(), Map_worldmap(), ) page.render("page_draggable_layout.html")
时间: 2023-06-15 21:05:58 浏览: 94
![RAR](https://csdnimg.cn/release/download/static_files/pc/images/minetype/RAR.png)
改变页面背景颜色
可以使用 pyecharts 中的 `Page` 类的 `page_theme` 属性来设置整体主题色。具体实现如下:
```python
from pyecharts.charts import Bar, Line, Pie, WordCloud, Map
from pyecharts import options as opts
from pyecharts.globals import ThemeType
from pyecharts.components import Page
# 创建各个图表
def bar_film() -> Bar:
pass
def line_ranking() -> Line:
pass
def pie_circletype() -> Pie:
pass
def WordCloud_wc() -> WordCloud:
pass
def Map_worldmap() -> Map:
pass
# 将图表添加到页面中,并设置页面主题色
page = Page(layout=Page.DraggablePageLayout, page_theme=ThemeType.DARK)
page.add(
bar_film(),
line_ranking(),
pie_circletype(),
WordCloud_wc(),
Map_worldmap(),
)
# 渲染页面
page.render("page_draggable_layout.html")
```
在上面的代码中,我使用了 `ThemeType.DARK` 来设置页面为黑色主题,你也可以根据需要选择其他主题。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![js](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)