终于找到一个能用的demo,待完善
1 # coding=utf-8 2 from pyecharts.charts import Bar 3 from pyecharts import options as opts 4 from pyecharts import faker 5 # from pyecharts.datasets import 6 7 keys = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] 8 values = [5, 20, 36, 10, 75, 90] 9 10 # bar=(Bar() 11 # .add_xaxis(keys) 12 # .add_yaxis("商家A",values) 13 # .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题")) 14 # ) 15 # bar.render() 16 17 def demo() -> Bar(): 18 c = ( 19 Bar() 20 .add_xaxis(keys) 21 .add_yaxis("商家A", values) 22 .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))) 23 return c.render(); 24 demo()