Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeLine中legend选定问题 #2144

Closed
fatdanny77 opened this issue Mar 15, 2023 · 1 comment
Closed

TimeLine中legend选定问题 #2144

fatdanny77 opened this issue Mar 15, 2023 · 1 comment
Assignees
Labels

Comments

@fatdanny77
Copy link

问题
您好,想请问为何在Timeline中画饼图时,能够随着时间节点持续维持选定的legend,但在画Bar图时,已选定的legend在每个时间节点都会被重置?在Gallery中的Demo中是可以维持已选定的legend的,不知道为何我用Demo的代码却不行。运行环境及代码如下:

运行环境(系统环境及 pyecharts 版本)
Windows10 python-3.8.5 pyecharts-2.0.2

代码及截图

首先是饼图:

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()

运行结果如下,饼图没问题

Question_gif1

接着是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()

运行结果如下,每个时间节点的legend都被重置了

Question_gif2

Scatter图也是一样的情况,我希望能在Bar图或Scatter图中每一个时间节点都维持被选中的legend,不知是哪里出了问题,恳请相助,万分感谢

@sunhailin-Leo sunhailin-Leo self-assigned this Mar 16, 2023
@sunhailin-Leo
Copy link
Member

@fatdanny77

  • 这个逻辑 bug 跟原来的某个逻辑存在一定的冲突,等我看几天,看看怎么解决这个问题哈~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants