Ejemplo n.º 1
0
def coincedence(place) -> Bar:
    place = np.array(place)
    foo = place[:, 1].astype(np.float)
    order = np.argsort(foo)
    k = 0
    place1 = np.copy(place)
    for i in order:
        place1[k] = place[i, :]
        k = k + 1
    place = place1
    bar = Bar()
    bar.add_xaxis(list(place[:, 0]))
    bar.add_yaxis("热度", list(place[:, 1]))
    bar.set_global_opts(title_opts=opts.TitleOpts(title="外来旅游人口相关度"))
    bar.set_global_opts(xaxis_opts=opts.AxisOpts(boundary_gap=1,
                                                 interval=0,
                                                 axislabel_opts={"rotate":
                                                                 45}),
                        toolbox_opts=opts.ToolboxOpts(is_show=True),
                        datazoom_opts=[
                            opts.DataZoomOpts(range_start=0,
                                              range_end=100,
                                              is_zoom_lock=False)
                        ])
    #bar.set_global_opts(xaxis_opts=opts.AxisTickOpts(is_align_with_label=0))
    bar.set_series_opts(label_opts=opts.LabelOpts(font_size=9))
    bar.width = 1200
    bar.render(path="外来旅游人口相关度.html")
    return True
Ejemplo n.º 2
0
def Top5():
    bar = Bar()
    bar.set_global_opts(xaxis_opts=opts.AxisOpts(name='国家'),yaxis_opts=opts.AxisOpts(name='人数'),legend_opts=opts.LegendOpts(pos_top='0%',pos_left='right')
                        ,title_opts=opts.TitleOpts(title='严重程度前5名国家疫情数据显示',subtitle='\n数据来源:腾讯',subtitle_link='https://xw.qq.com/act/qgfeiyan?pgv_ref=3gqtb&ADTAG=3gqtb',pos_left='center'))
    bar.page_title = '严重程度前5名国家疫情数据显示'
    bar.height = '600px'
    bar.width = '100%'
    bar.add_xaxis(get_data()[0][0:5])
    bar.add_yaxis("确诊", get_data()[1][0:5])
    bar.add_yaxis("治愈", get_data()[7][0:5])
    bar.add_yaxis("死亡", get_data()[5][0:5])
    bar.add_yaxis("现存确诊", get_data()[9][0:5])
    bar.add_yaxis("新增确诊", get_data()[2][0:5])
    # render 会生成本地 HTML 文件,默认会在当前目录生成 render.html 文件
    # 也可以传入路径参数,如 bar.render("mycharts.html")
    bar.render('Top5.html')
Ejemplo n.º 3
0
def globalStatis():
    bar1 = Bar()
    bar1.set_global_opts(xaxis_opts=opts.AxisOpts(name='日期'), yaxis_opts=opts.AxisOpts(name='人数'),
                        legend_opts=opts.LegendOpts(pos_top='0%', pos_left='right')
                        , title_opts=opts.TitleOpts(title='全球疫情数据显示', subtitle='\n数据来源:腾讯',
                                                    pos_left='center'))
    bar1.page_title = '全球疫情数据显示'
    bar1.height = '600px'
    bar1.width = '100%'
    bar1.add_xaxis([get_globalStatis_data()['lastUpdateTime']])
    bar1.add_yaxis('确诊',[get_globalStatis_data()['confirm']])
    bar1.add_yaxis('治愈',[get_globalStatis_data()['heal']])
    bar1.add_yaxis("死亡",[get_globalStatis_data()['dead']])
    bar1.add_yaxis("现存确诊",[get_globalStatis_data()['nowConfirm']])
    bar1.add_yaxis("新增确诊",[get_globalStatis_data()['confirmAdd']])
    # render 会生成本地 HTML 文件,默认会在当前目录生成 render.html 文件
    # 也可以传入路径参数,如 bar.render("mycharts.html")
    bar1.render('globalStatis.html')