Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 770 Bytes

timeline_bar_reversal.md

File metadata and controls

26 lines (21 loc) · 770 Bytes

pyecharts 代码 / 效果

from pyecharts import options as opts
from pyecharts.charts import Bar, Timeline
from pyecharts.faker import Faker

tl = Timeline()
for i in range(2015, 2020):
    bar = (
        Bar()
        .add_xaxis(Faker.choose())
        .add_yaxis("商家A", Faker.values(), label_opts=opts.LabelOpts(position="right"))
        .add_yaxis("商家B", Faker.values(), label_opts=opts.LabelOpts(position="right"))
        .reversal_axis()
        .set_global_opts(
            title_opts=opts.TitleOpts("Timeline-Bar-Reversal (时间: {} 年)".format(i))
        )
    )
    tl.add(bar, "{}年".format(i))
tl.render("timeline_bar_reversal.html")
<iframe width="100%" height="800px" src="Timeline/timeline_bar_reversal.html"></iframe>