示例#1
0
def title(fea_data, style_data) -> Image:
    image = Image()
    sub_data = ""
    for i in range(len(fea_data)):
        if i == 0: sub_data += "关于面向用例:\n"
        if i == 3: sub_data += "\n关于提交次数:\n"
        if i == 4: sub_data += "\n关于时间偏好:\n"
        if i == 9: sub_data += "\n面对难题:\n"
        sub_data = sub_data + fea_data[i] + "\n"

    for i in range(len(style_data)):
        if i == 0: sub_data += "\n\n代码风格评估:\n"

        sub_data = sub_data + style_data[i]
        if i == 2: sub_data += "\n"
        if i == 3: sub_data += "\n"
        if i == 5: sub_data += "\n"

    # img_src = (
    #     "/Users/amanda/Data_Science/src/可视化/title.png"
    # )
    # image.add(
    #     src=img_src,
    #     style_opts={"width": "200px", "height": "200px", "style": "margin-top: 20px"},
    # )

    image.set_global_opts(title_opts=ComponentTitleOpts(title="PYTHON 用户数据分析",
                                                        subtitle=sub_data))

    return image
示例#2
0
 def image(self):
     image = Image()
     image.add(
         src = (self.obj.imgsrc),
         style_opts={"width": "100px", "height": "100px", "style": "margin-top: 20px;border-radius:50%;"}
     )
     self.page.add(image)
def image_base() -> Image:
    image = Image()

    img_src = (
        "https://user-images.githubusercontent.com/19553554/396123"
        "58-499eb2ae-4f91-11e8-8f56-179c4f0bf2df.png"
    )
    image.add(
        src=img_src,
        style_opts={"width": "200px", "height": "200px", "style": "margin-top: 20px"},
    ).set_global_opts(
        title_opts=ComponentTitleOpts(title="Image-基本示例", subtitle="我是副标题支持换行哦")
    )
    return image
示例#4
0
def pic_wordcloud_user_jov_base():
    """
    It is used to respond to requests for chart parameters.

    Returns
    -------
    image : TYPE-IMAGE Component parameters
        DESCRIPTION:IMAGE html parameters.

    """
    
    # get picture
    from wordcloud import WordCloud
    
    data_pair = user_job_wordcloud_freq_query()
    wc = WordCloud(width=1200,height=800,min_font_size=10,max_font_size=100,font_step=2,max_words=10000,background_color="white")
    wc.generate_from_frequencies(dict(data_pair))
    wc.to_file(os.path.join(config.image_dir,"wordcloud_user_job.png"))
    # render picture
    from pyecharts.components import Image
    from pyecharts.options import ComponentTitleOpts
    
    image = Image()
    img_src = (os.path.join(config.image_dir,"wordcloud_user_job.png"))
    image.add(src=img_src,
              style_opts={"width": "1200px", "height": "800px", "style": "margin-top: 20px"},
              )
    image.set_global_opts(title_opts=ComponentTitleOpts(title="User Occupation Analysis"))
    return image
def draw_cloud(url,user_id,title = "用户词云"):
    image = Image()

    image.add(
        src=url,
        style_opts={"width": "800px", "height": "500px", "style": "margin-left: 200px"},
    )
    image.set_global_opts(
        title_opts=ComponentTitleOpts(title=title, subtitle="用户:"+str(user_id))
    )

    return image
示例#6
0
def image_base(img_src, title, subtitle):
    image = (Image()
             .add(src=img_src)
             .set_global_opts(title_opts=opts.ComponentTitleOpts(title=title, subtitle=subtitle)))
    return image
from pyecharts.components import Image
from pyecharts.options import ComponentTitleOpts

image = Image()

img_src = ("https://user-images.githubusercontent.com/19553554/"
           "71825144-2d568180-30d6-11ea-8ee0-63c849cfd934.png")
image.add(
    src=img_src,
    style_opts={
        "width": "200px",
        "height": "200px",
        "style": "margin-top: 20px"
    },
)
image.set_global_opts(
    title_opts=ComponentTitleOpts(title="Image-基本示例", subtitle="我是副标题支持换行哦"))
image.render("image_base.html")
def efforts_map_img():
    efforts_map_img = (Image()
                   .add(src=(longest_mapping_map_image),style_opts={"width": "320px", "height": "100px", "style": "margin-left: 10px"})
                   .set_global_opts(title_opts=ComponentTitleOpts(title="Efforts Mapping Map",
                                                                  subtitle=str(longest_mapping_map)+'\n'+'Spend time : '+parse_date(longest_mapping_len),)))
    return efforts_map_img
def first_rank_img():
    first_rank_img = (Image()
                 .add(src=(first_rank_image),style_opts={"width": "320px", "height": "100px", "style": "margin-left: 10px"})
                 .set_global_opts(title_opts=ComponentTitleOpts(title="First Rank Map",
                                                                subtitle=str(first_rank_title)+'\n'+first_rank_date_str),))
    return first_rank_img
def mapper_table():
    mapper_image = (Image().add(src=(user_profile_image),style_opts={"width": "100px", "height": "100px"}))
    return mapper_image
def test_table_base(fake_writer):
    test_src = "http://test-src.com/test.png"
    Image().add(src=test_src).render()
    _, content = fake_writer.call_args[0]
    assert_in(test_src, content)
示例#12
0
def _gen_image() -> Image:
    image = Image()
    image.add(src=TEST_SRC)
    return image
示例#13
0
def image_base(img_src, title, subtitle, width, height):
    image = (Image()
             .add(src=img_src, style_opts={"width": width, "height": height, "style": "margin-top: 20px"})
             .set_global_opts(title_opts=opts.ComponentTitleOpts(title=title, subtitle=subtitle))
            )
    return image