예제 #1
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
예제 #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)
예제 #3
0
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
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
예제 #5
0
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")
예제 #6
0
def _gen_image() -> Image:
    image = Image()
    image.add(src=TEST_SRC)
    return image