pyecharts折线图,只有坐标轴没有折线数据

 


x = [1896, 1900, 1904, 1906, 1908, 1912, 1920, 1924, 1928, 1932, 1936, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976,
     1980, 1984, 1988, 1992, 1994, 1996, 1998, 2000, 2002, 2004, 2006, 2008, 2010, 2012, 2014, 2016]
summer_enventsCounts = [43, 114, 171, 206, 250, 298, 342, 352, 374, 386, 403, 413, 428, 433, 439, 454, 471, 488, 503, 508, 524, 540, 559, None, 582, None, 617, None, 624, None, 632, None, 646, None, 651]
winter_enventsCounts = [None, None, None, None, None, None, None, 17, 18, 20, 23, 27, 30, 33, 38, 43, 44, 44, 47, 48, 49, 54, 68, 73, None, 79, None, 92, None, 103, None, 107, None, 119, None]

#####################x = np.array(x).astype("str")##############################
#####################设置x转化成str类型就能显示数据了##############################
c = (
    Line()
    .add_xaxis(x)
    .add_yaxis("夏季奥运会", summer_enventsCounts, is_smooth=True, label_opts=opts.LabelOpts(is_show=False), is_connect_nones=True)
    .add_yaxis("冬季奥运会", winter_enventsCounts, is_smooth=True, label_opts=opts.LabelOpts(is_show=False), is_connect_nones=True)
    .set_global_opts(title_opts=opts.TitleOpts(title="Line-基本示例"),
                     xaxis_opts=opts.AxisOpts(name="举办年份", type_="category", boundary_gap=False),
                    yaxis_opts=opts.AxisOpts(name="比赛项目数",),
                    tooltip_opts=opts.TooltipOpts(trigger="axis"),  # 竖线
# datazoom_opts=opts.DataZoomOpts()
                     )
    .render("line_TEST.html")
)

 折线就显示了

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值