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

《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")
)

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

 折线就显示了

    原文作者:Y0730Y
    原文地址: https://blog.csdn.net/Y0730Y/article/details/121217541
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞