Exemple #1
0
def event_temp(request):
    print("query event")
    print(chainIdx)
    chain_keys = list(chains.keys())
    chain = chains[chain_keys[int(chainIdx)]]  #[{event1},{event2},{event3}]
    context = {}
    timelineIndex = 0
    if 'timelineIndex' in request.GET and request.GET[
            'timelineIndex']:  #获得tl的index
        context["timelineIndex"] = request.GET['timelineIndex']
        timelineIndex = int(context["timelineIndex"])
    if 'scrollTop' in request.GET and request.GET['scrollTop']:
        context["scrollTop"] = request.GET['scrollTop']
    line_data, poses, words, frame_ids, table_data = process_chain(chain)
    page = Page()
    print("timelineIdx:{}".format(timelineIndex))
    eventmap = get_eventbmap(poses[timelineIndex])
    eventmap.chart_id = "map_event"
    eventline = get_eventline(line_data)
    eventline.chart_id = "line_event"
    wordcloudline = get_wordcloud_line(words[timelineIndex], frame_ids)
    wordcloudline.chart_id = "wordcloud_line"
    eventtable = get_eventtable(table_data[timelineIndex])
    eventtable.chart_id = "table_event"
    page.add(eventmap)
    page.add(eventline)
    page.add(wordcloudline)
    page.add(eventtable)
    page.render(path="event.html", template_name="simple_page_event.html")
    #记得在以下函数中增加了模板函数
    Page.save_resize_html("event.html",
                          cfg_file="./demo/chart_config_event.json",
                          dest="./demo/templates/my_event_charts.html")
    #page.render("bmap.html",template="simple_page_event.html")
    return render(request, "my_event_charts.html", context)  #可以向模板中填充数据来显示矩形框
def multi_follower_counts(c1, c2, c3, c4, c5):
    # 不同赞数区间内的粉丝数分布统计
    _, y1 = data_sort(list(c1.index), list(c1))
    _, y2 = data_sort(list(c2.index), list(c2))
    _, y3 = data_sort(list(c3.index), list(c3))
    _, y4 = data_sort(list(c4.index), list(c4))
    _, y5 = data_sort(list(c5.index), list(c5))
    x = [
        '<50', '50-100', '100-500', '0.5k-1k', '1k-5k', '5k-10k', '1w-5w',
        '5w-10w', '10w-50w', '50w-100w', '>100w'
    ]

    line = (Line().add_xaxis(x).add_yaxis('赞同数为1k-4k', y1).add_yaxis(
        '赞同数为4k-10k', y2).add_yaxis('赞同数为10k-20k', y3).add_yaxis(
            '赞同数为20k-40k',
            y4).add_yaxis('赞同数为40k以上', y5).extend_axis(yaxis=opts.AxisOpts(
                axislabel_opts=opts.LabelOpts())).set_series_opts(
                    label_opts=opts.LabelOpts(is_show=False),
                    linestyle_opts=opts.LineStyleOpts(
                        width=2)).set_global_opts(
                            title_opts=opts.TitleOpts(title='赞数-粉丝数统计'),
                            xaxis_opts=opts.AxisOpts(
                                axislabel_opts=opts.LabelOpts(rotate=30),
                                name='粉丝数'),
                            yaxis_opts=opts.AxisOpts(
                                axislabel_opts=opts.LabelOpts()),
                            tooltip_opts=opts.TooltipOpts(
                                trigger="axis", axis_pointer_type="cross"),
                            legend_opts=opts.LegendOpts(pos_left="right")))

    filename = '赞数-粉丝数统计-line.html'
    line.render(filename)
    print('图表创建成功')

    bar = (Bar().add_xaxis(x).add_yaxis('赞同数为1k-4k', y1).add_yaxis(
        '赞同数为4k-10k', y2).add_yaxis('赞同数为10k-20k', y3).add_yaxis(
            '赞同数为20k-40k',
            y4).add_yaxis('赞同数为40k以上', y5).extend_axis(yaxis=opts.AxisOpts(
                axislabel_opts=opts.LabelOpts())).set_series_opts(
                    label_opts=opts.LabelOpts(is_show=False),
                    linestyle_opts=opts.LineStyleOpts(
                        width=2)).set_global_opts(
                            title_opts=opts.TitleOpts(title='赞数-粉丝数统计'),
                            xaxis_opts=opts.AxisOpts(
                                axislabel_opts=opts.LabelOpts(rotate=30),
                                name='粉丝数'),
                            yaxis_opts=opts.AxisOpts(
                                axislabel_opts=opts.LabelOpts()),
                            tooltip_opts=opts.TooltipOpts(
                                trigger="axis", axis_pointer_type="cross"),
                            legend_opts=opts.LegendOpts(pos_left="right")))

    filename = '赞数-粉丝数统计-bar.html'
    bar.render(filename)
    print('图表创建成功')

    page = Page(layout=Page.SimplePageLayout)
    page.add(line, bar)
    page.render("赞数-粉丝数统计.html")
    print('图表创建成功')
Exemple #3
0
def hu_run_select() -> 'html':
    try:
        df = pd.read_csv("GDP per person.csv")
        the_region = request.form["the_region_selected"]  # 年份勾选
        log.info("勾选年份为{0}".format(the_region))
        fig5 = bar_gdp([country_ls, data3[the_region]])
        fig6 = grid_mutil_yaxis(
            [country_ls, data3[the_region], data4[the_region]],
            ["GDP增长率(%)", "生育率(%)"])
        fig7 = map_data([countries, data2[the_region]], "识字率",
                        "1990-2017女性识字率世界地图")
        fig8 = map_data([countries, data1[the_region]], "生育率",
                        "1990-2017青春期女性生育率世界地图")

        page = Page(layout=Page.SimplePageLayout)
        page.add(fig5, fig6, fig7, fig8)
        page.render("task2.html")
        with open("task2.html", encoding="utf8", mode="r") as f:
            plot_all = "".join(f.readlines())

        data_str = df.to_html()
        return render_template(
            'results2.html',
            the_plot_all=plot_all,
            the_res=data_str,
            the_select_region=regions_available,
        )
    except Exception as ex:
        log.error("页面数据请求失败: {0}".format(str(ex)))
        return None
Exemple #4
0
def draw_multiple_pie_02(month, day):
    max_width, max_height = 1400, 3000

    page = Page(layout=Page.SimplePageLayout)
    h_center, v_center = 10, 40
    horizontal_step, vertical_step = 350, 320
    pies = []
    for p in get_province_data(month, day):
        title = '%s-%d例' % (p['provinceShortName'], p['confirmedCount'])
        labels = [city['cityName'] for city in p['cities']]
        counts = [city['confirmedCount'] for city in p['cities']]
        if len(labels) == 0:
            continue
        pie = Pie(init_opts=opts.InitOpts(width='{}px'.format(horizontal_step),
                                          height='{}px'.format(vertical_step)))
        pie.set_global_opts(legend_opts=opts.LegendOpts(is_show=False),
                            title_opts=opts.TitleOpts(title))
        pie.add(
            title,
            [list(z) for z in zip(labels, counts)],
            radius=[5, 80],
            # center=[h_center + 150, v_center + 110]
        ).set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"),
                          tooltip_opts=opts.TooltipOpts())

        h_center += horizontal_step
        if h_center + 200 > max_width:
            h_center = 10
            v_center += vertical_step
        page.add(pie)

    root = 'html-charts/%d%d' % (month, day)
    create_dir(root)
    page.render('%s/省份信息2.html' % root)
    page.render('provinces.html')
Exemple #5
0
def page_simple_layout(redmineObj, project_name, query_id, tracker_name):
    myIssue = MyIssue(redmine)
    myTracker = MyTracker(redmine)
    # 数据获取
    if query_id is not None:
        issues = myIssue.get_issues_by_query_id(project_name, query_id)
        all_issues = issues
    else:
        all_issues = myIssue.get_issues(project_name, None,
                                        None)  # 根据项目获取所有issue
        tracker_id = myTracker.get_trackerId_by_name(
            tracker_name)  # 跟踪标签需要手动填,不同项目跟踪标签不同
        issues = myIssue.get_issues(project_name, tracker_id,
                                    None)  # 根据tacker_id获取项目内或者自定义查询内的issue
    issues_time = myIssue.stat_issue_by_createOrClose_time(
        issues)  # 获取issues中的创建时间和关闭时间
    priority_data = myIssue.get_issues_by_priority(issues)
    assign_to_data = myIssue.stat_issue_by_assignTo(issues)
    tracker_bug_data = myIssue.get_issues_by_tracker(all_issues)

    # 制作统计图
    priority_pie = draw_pie_bug_priority(priority_data)  # 按优先级统计BUG
    assign_to_pie = draw_pie_bug_agent(assign_to_data)  # 按指派人统计BUG
    time_line = draw_line_bug_time(issues_time)  # 按创建时间/关闭时间统计BUG
    tracker_pie = draw_pie_bug_tracker(tracker_bug_data)  # 按跟踪标签统计Issue
    page = Page(layout=Page.SimplePageLayout)
    page.add(tracker_pie, priority_pie, assign_to_pie, time_line)
    page.render("./reports/redmine.html")
def DrawIng():
    page = Page(
        page_title = "coding4.county"
    )
    page.add(timeline_map())
    page.add(timeline_bar())
    page.render("4.county.html")
Exemple #7
0
def draw_order_signals(trader_name, render='html'):
    df_account = get_account(trader_name=trader_name)
    start_timestamp = df_account['timestamp'][0]
    end_timestamp = df_account['timestamp'][-1]

    df_orders = get_orders(trader_name=trader_name)
    grouped = df_orders.groupby('security_id')

    page = Page()

    for security_id, order_df in grouped:
        kdata = get_kdata(security_id=security_id,
                          provider='netease',
                          start_timestamp=start_timestamp,
                          end_timestamp=end_timestamp)
        mark_points = order_df
        kline = draw_kline(df_list=[kdata],
                           markpoints_list=[mark_points],
                           render=None)

        page.add(kline)

    if render == 'html':
        file_name = '{}_signals'.format(trader_name)
        page.render(get_ui_path(file_name))
    elif render == 'notebook':
        page.render_notebook()

    return page
Exemple #8
0
def page_draggable_layout():
    page = Page(layout=Page.DraggablePageLayout)
    page.add(
        chinamap(),
        bar_sale(),
    )
    page.render("面板图.html")
    def show_dlt(self):
        red_balls = []
        blue_balls = []
        with open(self.input_file, 'r') as f:
            for i in range(Config.PAGES * Config.ITEMS_PER_PAGE):
                one_line_data = f.readline().strip()
                # print(one_line_data)
                red_balls.extend([
                    int(one_line_data[15 + (2 * i):15 + (2 * (i + 1))])
                    for i in range(5)
                ])
                blue_balls.append(int(one_line_data[-4:-2]))
                blue_balls.append(int(one_line_data[-2:]))

        red_counter = Counter(red_balls)
        blue_counter = Counter(blue_balls)
        # print(red_balls)
        # print(blue_balls)
        # print(red_counter)
        # print(blue_counter)
        # print(red_counter.most_common())
        # print(blue_counter.most_common())
        red_dict = {}
        blue_dict = {}
        for i in red_counter.most_common():
            red_dict['{}'.format(i[0])] = i[1]

        for j in blue_counter.most_common():
            blue_dict['{}'.format(j[0])] = j[1]

        print(red_dict)
        print(blue_dict)

        red_list = sorted(red_counter.most_common(),
                          key=lambda number: number[0])
        blue_list = sorted(blue_counter.most_common(),
                           key=lambda number: number[0])
        print(blue_list)
        print(red_list)

        # 红球图表添加
        red_bar = Bar()
        red_x = ['{}'.format(str(x[0])) for x in red_list]
        red_y = ['{}'.format(str(x[1])) for x in red_list]
        red_bar.add_xaxis(red_x)
        red_bar.add_yaxis('红色球出现的次数', red_y)
        # 篮球图表添加
        blue_bar = Bar()
        blue_x = ['{}'.format(str(x[0])) for x in blue_list]
        blue_y = ['{}'.format(str(x[1])) for x in blue_list]
        blue_bar.add_xaxis(blue_x)
        blue_bar.add_yaxis('蓝色球出现的次数',
                           blue_y,
                           itemstyle_opts=opts.ItemStyleOpts(color='blue'))

        page = Page(page_title='大乐透数据分析', interval=3)
        page.add(red_bar)
        page.add(blue_bar)

        page.render(self.output_file)
def hu_run_select() -> 'html':
    the_region = request.form["the_region_selected"]
    print(the_region)  # 检查用户输入
    dfs = df1.query("CountryName=='{}'".format(the_region))

    gdp_df = getCsvData('GDP.csv')  # 读取GDP.csv 数据内容
    select_df = getCsvData('select_nation.csv')  # 读取select_nation.csv 数据内容
    fig1 = map_world_gdp(gdp_df)
    fig2 = pie_base(select_df)
    fig3 = bar_datazoom_select(select_df)
    fig4 = line_markpoint(select_df)

    page = Page(layout=Page.SimplePageLayout)
    page.add(fig1, fig2, fig3, fig4)
    page.render("child2.html")

    with open("templates/child2.html", encoding="utf8", mode="r") as f:
        plot_all = "".join(f.readlines())

    data_str = dfs.to_html()
    return render_template('results2.html',
                           the_plot_all=plot_all,
                           the_res=data_str,
                           the_select_region=regions_available,
                           )
Exemple #11
0
def page(filename="info"):
    '''
    页面
    '''
    # test data

    y_data = [{
        'name': '安卓',
        'values': [0.34, 0.76, 0.88, 0.99, 0.242, 0.42, 0.22]
    }, {
        'name': 'ios',
        'values': [0.50, 0.90, 0.72, 0.34, 0.76, 0.88, 0.99]
    }]
    x_data = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']

    page = Page()
    page.add(
        # timeline_bar_reversal(title='渠道留存'),
        liquid_data_precision("111"),
        bar_datazoom_slider("222",
                            y_data=y_data,
                            x_data=x_data,
                            datazoom_opts=None,
                            toolbox_opts=None),
        table_base("333"),
        line_markpoint("555"),
        pie_rosetype("444"),
        grid_mutil_yaxis("777"),
    )
    page.render('{}.html'.format(filename))
def page_simple_layout():
    page = Page()
    page.add(
        line2(),
        bar1(),
        gauge1(),
    )
    page.render("C:/Users/suqi/Desktop/allcode/page_simple_layoutnew.html")
Exemple #13
0
def page_layout():
    page = Page(layout=Page.DraggablePageLayout)
    page.add(
        map_world(),
        timeline_suicides(),
        bar_suicides_no(),
        bar_suicides_100k(),
    )
    page.render("page.html")
Exemple #14
0
def Gather_in_Page():
    Data_List = [['项目2',25.02]]
    bg= BG()
    page = Page(layout=Page.DraggablePageLayout)
    page.add(bg)
    for NPS_List in Data_List:
        gauge = NPS(NPS_List)
        page.add(gauge)
    page.render('NPS.html')
Exemple #15
0
class Flight(object):
    def __init__(self):
        self.page = Page(page_title="全国航班数据可视化图表")
        self.drawer = Drawing()
        self.cleaner = Cleaning()

    def exec(self):
        today_data = self.cleaner.todayData()  # 生成当天的基础数据
        geo_airport_data = self.cleaner.geoAirport(
            today_data)  # 全国机场及出港航班数量分布地理图数据
        map_airport_data = self.cleaner.mapProvince(
            today_data)  # 省级机场数量分布地理图数据
        bar_out_port_data = self.cleaner.barOutPort(
            today_data)  # 机场出港航班数量柱状图数据
        bar_in_port_data = self.cleaner.barInPort(today_data)  # 机场进港航班数量柱状图数据
        line_week_out_data = self.cleaner.lineWeekOut()  # 根据周数据生成周内每天出港航班数据--
        bar_company_data = self.cleaner.barCompanyOut()  # 本周航空公司出港航班数据

        bar_out_time_data = self.cleaner.barTime(
            today_data, 'start_airport')  # 根据当天的基础数据生成出港航班时间数据
        bar_in_time_data = self.cleaner.barTime(
            today_data, 'end_airport')  # 根据当天的基础数据生成进港航班时间数据
        bar_out_part_data = self.cleaner.pieTimePart(
            bar_out_time_data)  # 根据出港数据生成出港时段数据
        bar_in_part_data = self.cleaner.pieTimePart(
            bar_in_time_data)  # 根据进港数据生成进港时段数据
        pie_part_data = [
            bar_out_part_data, bar_in_part_data, bar_out_time_data[1],
            bar_in_time_data[1]
        ]  # 将进、出港和总数添加到列表

        heat_out_time_data = self.cleaner.heatOutPortTime(
            today_data)  # 根据周数据生成每天出港航班时间热力图数据--
        heat_line_city_data = self.cleaner.geoLineCity()  # 生成城市出港航班热力线图数据

        # ------------------------------------------------------
        self.page.add(self.drawer.geoAirport(geo_airport_data))  # 画全国机场分布与数量图
        self.page.add(self.drawer.mapProvince(map_airport_data))  # 画全国机场省级分布图
        self.page.add(self.drawer.barAirPort(bar_in_port_data))  # 画机场进港航班柱状图
        self.page.add(self.drawer.barAirPort(bar_out_port_data))  # 画机场出港航班柱状图

        self.page.add(
            self.drawer.lineWeekOut(line_week_out_data))  # 画本周出港航班数量柱状图
        self.page.add(
            self.drawer.barCompanyOut(bar_company_data))  # 画本周航空公司出港航班柱状图

        self.page.add(self.drawer.barTime(bar_in_time_data))  # 画进港时间的柱状图
        self.page.add(self.drawer.barTime(bar_out_time_data))  # 画出港时间的柱状图

        self.page.add(self.drawer.pieTime(pie_part_data))  # 同时画进、出港时段的玫瑰饼图
        self.page.add(
            self.drawer.heatOutPortTime(heat_out_time_data))  # 画周每天出港航班时间热力图
        self.page.add(
            self.drawer.geoLineCity(heat_line_city_data))  # 画城市出港航班热力线图

        self.page.render('flights.html')
        print('数据地图生成完毕,请打开浏览器查看,多谢。')
Exemple #16
0
def page_layout(list, title, name):
    page = Page(layout=Page.SimplePageLayout)
    page.add(
        death_histogram(list, title, name),
        CumulativeDeaths_histogram(list, title, name),
        Confirmed_histogram(list, title, name),
        CumulativeConfirmed_histogram(list, title, name),
        timeline(list, title, name),
    )
    page.render("templates/COVID/" + name + '.html')
def page_simple_layout():
    page = Page(layout=Page.SimplePageLayout)
    page.add(
        course_selection_ranking(),
        class_sum_by_subject(),
        subject_pie(),
        word_cloud(),
    )
    page.page_title = "MOOC当前开放课程可视化"
    page.render("当前全部开放课程可视化.html")
Exemple #18
0
def draw_multiple_map(month, day):
    page = Page(layout=Page.SimplePageLayout)
    size = ('1000px', '1000px')

    # 全国疫情地图
    labels, counts = get_province_status(month, day)
    country_map = get_map(labels=labels, counts=counts,
                          title='全国-%s例' % get_total_statistic(month, day)['confirmedCount'], size=size, where='china',
                          pieces=get_default_pieces())
    page.add(country_map)
    page.render('全国新冠数据地理分布展示.html')
Exemple #19
0
def page_draggable_layout():
    page = Page(layout=Page.DraggablePageLayout)
    page.add(
        bar_datazoom_slider(),
        line_markpoint(),
        pie_rosetype(),
        grid_mutil_yaxis(),
        liquid_data_precision(),
        table_base(),
    )
    page.render()
Exemple #20
0
def get_all_chart():
    page = Page()
    page.add(get_language_proportion())
    page.add(get_salary_proportion())
    page.add(get_map())
    #
    page.add(get_education_background())
    page.render("temp/all.html")
    # get_education_background()

    pass
def page_default_layout():
    page = Page()
    page.add(
        bar_datazoom_slider(),
        line_markpoint(),
        pie_rosetype(),
        grid_mutil_yaxis(),
        liquid_data_precision(),
        table_base(),
    )
    page.render("page_default_layout.html")
Exemple #22
0
def plot_all():
    chart1 = valuation_report()
    chart2 = tail_northup()
    chart3 = tail_zxqh()


    page = Page()
    page.add(chart1, chart2, chart3)
    output_path = os.path.join(PROJECT_DIR, "utils/output/统计指标.html")
    page.render(output_path)
    return "utils/output/统计指标.html"
Exemple #23
0
def page_draggable_layout():
    page = Page(layout=Page.DraggablePageLayout)
    page.add(
        bar_reverse(),
        gauge(),
        liquid(),
        rose(),
        wordcloud(),
        bar(),
    )
    page.render("page.html")
    Page.save_resize_html("page.html", cfg_file="chart_config.json", dest="my_charts.html")
Exemple #24
0
def draw_multiple_map(month, day):
    page = Page(layout=Page.SimplePageLayout)
    size = ('350px', '380px')

    # 全国疫情地图
    labels, counts = get_province_status(month, day)
    country_map = get_map(labels=labels,
                          counts=counts,
                          title='全国-%s例' %
                          get_total_statistic(month, day)['confirmedCount'],
                          size=size,
                          where='china',
                          pieces=get_default_pieces())
    page.add(country_map)

    # 已知城市名称
    defined_cities = [
        line.strip() for line in open(
            'py_echarts_city_names.txt', 'r', encoding='UTF-8').readlines()
    ]

    # 省份疫情地图
    for p in get_province_data(month, day):
        title = '%s-%d例' % (p['provinceShortName'], p['confirmedCount'])

        # 城市映射
        labels = []
        for city in p['cities']:
            name = city['cityName']
            map_name = get_city_map(name, defined_cities)
            if not map_name:
                map_name = get_city_map(name[:-1], defined_cities)
            labels.append(name if not map_name else map_name)

        # 数量
        counts = [city['confirmedCount'] for city in p['cities']]
        if len(labels) == 0:
            continue

        pieces = get_pieces(min(counts), max(counts))
        province_map = get_map(labels=labels,
                               counts=counts,
                               title=title,
                               size=size,
                               where=p['provinceShortName'],
                               pieces=pieces)
        page.add(province_map)

    root = 'html-charts/%d%d' % (month, day)
    create_dir(root)
    page.render('%s/省份地图.html' % root)
Exemple #25
0
def all_map():
    """
    china_total_map:   中国累计确诊地图
    global_total_map:  全球累计确诊地图
    china_daily_map:   中国每日数据折线图
    foreign_daily_map: 境外每日数据折线图
    全球包含中国,境外不包含中国!
    """

    page = Page(layout=Page.SimplePageLayout, page_title="TRHX丨疫情实时大数据")
    page.add(china_total_map(), global_total_map(), china_daily_map(),
             foreign_daily_map())
    page.render('COVID-19.html')
    print('国内以及境外疫情可视化图表绘制完毕!')
def charts_display(driver, movie_name):
    df = preprocess_data(movie_name)
    pie = rating_distribution(df)
    bar, geo = city_distribution(df)
    line = comment_heat_analysis(df)
    word = wordcloud_analysis(df)

    # 页面顺序渲染多图
    title = movie_name + '影评分析-data_from_douban.html'
    page = Page(page_title=title)
    page.add(pie, bar, geo, line, word)
    page.render(title)

    # 打开生成的网页
    webbrowser.open(title)
Exemple #27
0
def fund_reports(request, *args, **kwargs):
    bar = Bar()
    bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
    bar.add_yaxis("商家A", [randrange(0, 100) for _ in range(6)])
    bar.add_yaxis("商家B", [randrange(0, 100) for _ in range(6)])
    bar1 = Bar()
    bar1.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
    bar1.add_yaxis("商家A", [randrange(0, 100) for _ in range(6)])
    bar1.add_yaxis("商家B", [randrange(0, 100) for _ in range(6)])

    page = Page()
    page.add(bar)
    page.add(bar1)
    page.render('templates/test.html')
    return render(request, 'test.html')
def image_info(root, path='image_info.html', show_original=False):
    """Show image visualize.
    
    Args:
        root: An image file root.
        path: result save a html file.
        show_original: whether show original image shape.
    Returns:
        A pyecharts polt object.
    """
    shape = read_image(root).shape
    info = PIL.Image.open(root).info
    width = '' if show_original else str(360)+'px'
    height = '' if show_original else str(int(360/shape[1]*shape[0]))+'px'
    image_charts = image_base(root, '', '', width, height)
    headers = ["Attribute", "Info"]
    rows = [['path', root],
            ['size', str(round(os.stat(root).st_size/1024/1024, 2))+'M'],
            ['shape', str(read_image(root).shape)],
            ['jfif', info['jfif']],
            ['jfif_version', info['jfif_version']],
            ['dpi', info['dpi']],
            ['jfif_unit', info['jfif_unit']],
            ['jfif_density', info['jfif_density']]
    ]
    table_charts = Table().add(headers, rows)
    page = Page(layout=Page.SimplePageLayout).add(*[image_charts, table_charts])
    return page.render(path)
           
           
Exemple #29
0
def draw_account_details(trader_name, render='html'):
    page = Page()

    account_summary = draw_account_list([trader_name], render=None)
    # klines = draw_order_signals(trader_name=trader_name, render=None)
    positions = draw_positions(trader_name=trader_name, render=None)

    page.add(account_summary, positions)

    if render == 'html':
        file_name = '{}_details'.format(trader_name)
        page.render(get_ui_path(file_name))
    elif render == 'notebook':
        page.render_notebook()

    return page
Exemple #30
0
def draw_multiple_pie(month, day):
    page = Page(layout=Page.SimplePageLayout)
    labels, counts = get_province_status(month, day)
    page.add(
        get_pie(labels, counts, '全国-%s例' % get_total_statistic(month, day)['confirmedCount'], size=('360px', '330px')))
    for p in get_province_data(month, day):
        title = '%s-%d例' % (p['provinceShortName'], p['confirmedCount'])
        labels = [city['cityName'] for city in p['cities']]
        counts = [city['confirmedCount'] for city in p['cities']]
        if len(labels) == 0:
            continue
        page.add(get_pie(labels, counts, title, size=('350px', '320px')))

    root = 'html-charts/%d%d' % (month, day)
    create_dir(root)
    page.render('%s/省份信息.html' % root)