You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from pyecharts import options as opts
from pyecharts.charts import Pie, Timeline
from pyecharts.faker import Faker
attr = Faker.choose()
tl = Timeline()
for i in range(2015, 2020):
pie = (
Pie()
.add(
"商家A",
[list(z) for z in zip(attr, Faker.values())],
rosetype="radius",
radius=["30%", "55%"],
)
.set_global_opts(title_opts=opts.TitleOpts("某商店{}年营业额".format(i)))
)
tl.add(pie, "{}年".format(i))
tl.render_notebook()
运行结果如下,饼图没问题
接着是Bar图
from pyecharts import options as opts
from pyecharts.charts import Bar, Timeline
from pyecharts.faker import Faker
x = Faker.choose()
tl = Timeline()
for i in range(2015, 2020):
bar = (
Bar()
.add_xaxis(x)
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(title_opts=opts.TitleOpts("某商店{}年营业额".format(i)))
)
tl.add(bar, "{}年".format(i))
tl.render_notebook()
问题
您好,想请问为何在Timeline中画饼图时,能够随着时间节点持续维持选定的legend,但在画Bar图时,已选定的legend在每个时间节点都会被重置?在Gallery中的Demo中是可以维持已选定的legend的,不知道为何我用Demo的代码却不行。运行环境及代码如下:
运行环境(系统环境及 pyecharts 版本)
Windows10 python-3.8.5 pyecharts-2.0.2
代码及截图
首先是饼图:
运行结果如下,饼图没问题
接着是Bar图
运行结果如下,每个时间节点的legend都被重置了
Scatter图也是一样的情况,我希望能在Bar图或Scatter图中每一个时间节点都维持被选中的legend,不知是哪里出了问题,恳请相助,万分感谢
The text was updated successfully, but these errors were encountered: