Esempio n. 1
0
def map_visualmap(sumary) -> Map:
    c = (
        Map(init_opts=InitOpts(width="750px", height='1000px')).add(
            "确诊", sumary, "上海", is_map_symbol_show=False,
            label_opts=None).set_global_opts(
                title_opts=TitleOpts(
                    title="分布统计(不含外地来沪和待确认)",
                    subtitle='    市卫健局每日两次发布信息,如未更新,请尝试刷新页面',
                    pos_left='10%',
                    pos_top='top',
                    title_textstyle_opts=TextStyleOpts(font_size=40),
                    subtitle_textstyle_opts=TextStyleOpts(font_size=20),
                ),
                visualmap_opts=VisualMapOpts(
                    max_=70,
                    range_color=['lightblue', 'yellow', 'red'],
                    pos_top='15%',
                    pos_left='12%',
                    item_height='200px',
                    item_width='30px',
                    textstyle_opts=TextStyleOpts(font_size=15)
                    # split_number=50
                ),
                legend_opts=LegendOpts(is_show=False),
                tooltip_opts=TooltipOpts(textstyle_opts=TextStyleOpts(
                    font_size=30)),
            ))
    return c
Esempio n. 2
0
    "datazoom_opts": [
        DataZoomOpts(is_show=True,
                     type_="slider",
                     range_start=50,
                     range_end=100),
        DataZoomOpts(
            is_show=True,
            type_="slider",
            orient="vertical",
            range_start=50,
            range_end=100,
        ),
    ],
    "tooltip_opts":
    TooltipOpts(is_show=True,
                trigger="axis",
                trigger_on="mousemove",
                axis_pointer_type="cross"),
}

heatmap_opts = {
    "visualmap_opts":
    VisualMapOpts(min_=-1,
                  max_=1,
                  orient="horizontal",
                  pos_right="middle",
                  pos_top="bottom")
}

# pie_opts = {
#     "tooltip_opts": TooltipOpts(),
#     "legend_opts": LegendOpts(orient="vertical", pos_left="left"),
Esempio n. 3
0
def total_trend(day, shdeath, shcured, shsum, shpending) -> Line:
    line = (
        Line(init_opts=InitOpts()).add_xaxis(day)
        # .add_yaxis("全国死亡",y_axis=death,is_connect_nones=True,is_smooth=True)
        .add_yaxis('死亡',
                   shdeath,
                   symbol_size=10,
                   color='black',
                   itemstyle_opts=ItemStyleOpts(color='black'),
                   label_opts=LabelOpts(is_show=False),
                   areastyle_opts=AreaStyleOpts(opacity=0.5, color='black'),
                   stack=1,
                   is_connect_nones=True,
                   is_smooth=True).add_yaxis(
                       '治愈',
                       shcured,
                       symbol_size=10,
                       color='LimeGreen',
                       itemstyle_opts=ItemStyleOpts(color='LimeGreen'),
                       label_opts=LabelOpts(font_size=15, color='ForestGreen'),
                       areastyle_opts=AreaStyleOpts(opacity=0.5,
                                                    color='LimeGreen'),
                       is_connect_nones=True,
                       is_smooth=True).
        add_yaxis(
            '确诊',
            shsum,
            symbol_size=10,
            color='Orange',
            itemstyle_opts=ItemStyleOpts(color='Orange'),
            label_opts=LabelOpts(font_size=15,
                                 color='DarkOrange',
                                 font_weight='bold'),
            areastyle_opts=AreaStyleOpts(opacity=0.5, color='Orange'),
            stack=1,
            is_connect_nones=True,
            is_smooth=True).add_yaxis(
                '疑似',
                shpending,
                symbol_size=10,
                color='LightSkyBlue',
                itemstyle_opts=ItemStyleOpts(color='LightSkyBlue'),
                label_opts=LabelOpts(font_size=15, color='DarkBlue'),
                areastyle_opts=AreaStyleOpts(opacity=0.5,
                                             color='LightSkyBlue'),
                stack=1,
                is_connect_nones=True,
                is_smooth=True).set_global_opts(
                    title_opts=TitleOpts(
                        # title=title,
                        # pos_left='10%',
                        # pos_top='-10%',
                    ),
                    # tooltip_opts=TooltipOpts(formatter="{b} {a}\n {c}人"),
                    datazoom_opts=[
                        DataZoomOpts(
                            range_start=60,
                            range_end=100,
                            xaxis_index=[0, 1],
                        ),
                        DataZoomOpts(range_start=60,
                                     range_end=100,
                                     xaxis_index=[0, 1],
                                     type_='inside'),
                    ],
                    xaxis_opts=AxisOpts(name_gap=50),
                    legend_opts=LegendOpts(
                        pos_top='top',
                        pos_left='10%',
                        textstyle_opts=TextStyleOpts(font_size=30),
                        orient='horizontal',
                        legend_icon='rect'),
                    tooltip_opts=TooltipOpts(textstyle_opts=TextStyleOpts(
                        font_size=30)),
                    graphic_opts=GraphicGroup(
                        graphic_item=GraphicItem(left="12%", top="11%"),
                        children=[
                            GraphicRect(
                                graphic_item=GraphicItem(z=0,
                                                         left="center",
                                                         top="middle"),
                                graphic_shape_opts=GraphicShapeOpts(width=150,
                                                                    height=90),
                                graphic_basicstyle_opts=GraphicBasicStyleOpts(
                                    fill="#fff",
                                    stroke="black",
                                    line_width=3,
                                )),
                            GraphicText(
                                graphic_item=GraphicItem(left="center",
                                                         top="middle",
                                                         z=0),
                                graphic_textstyle_opts=GraphicTextStyleOpts(
                                    text=
                                    f"确诊{shsum[-1]}人\n\n疑似{shpending[-1]}人",
                                    font="bolder 20px sans-serif",
                                    graphic_basicstyle_opts=
                                    GraphicBasicStyleOpts(fill="#333")))
                        ])))
    # line.overlap(bar)
    return line