pyecharts一次选择多个label
时间: 2023-07-02 16:19:01 浏览: 58
你可以通过使用 `echarts` 中的 `toolbox` 组件来实现一次选择多个 `label`。具体来说,你需要将 `toolbox` 的 `feature` 中的 `magicType` 设置为 `['stack', 'tiled']`,这样就可以在图表中一次选择多个 `label`。以下是一个示例代码:
```python
from pyecharts import options as opts
from pyecharts.charts import Bar
x_data = ['A', 'B', 'C', 'D', 'E']
y_data = [10, 20, 30, 40, 50]
bar = Bar()
bar.add_xaxis(x_data)
bar.add_yaxis('Series A', y_data)
bar.set_global_opts(
toolbox_opts=opts.ToolboxFeatureOpts(
magic_type_opts=opts.ToolboxMagicTypeOpts(
is_show=True,
type_=['stack', 'tiled']
)
)
)
bar.render()
```
在上述代码中,我们创建了一个 `Bar` 图表,并将 `magicType` 设置为 `['stack', 'tiled']`,这样就可以在图表中一次选择多个 `label`。同时,我们还可以通过其他配置选项来调整 `toolbox` 的样式和行为。