当前位置: 首页>>代码示例>>Python>>正文


Python pygal.Bar方法代码示例

本文整理汇总了Python中pygal.Bar方法的典型用法代码示例。如果您正苦于以下问题:Python pygal.Bar方法的具体用法?Python pygal.Bar怎么用?Python pygal.Bar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygal的用法示例。


在下文中一共展示了pygal.Bar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: graph_passwords

# 需要导入模块: import pygal [as 别名]
# 或者: from pygal import Bar [as 别名]
def graph_passwords():
    clio = Clio()
    
    bar_chart = pygal.Bar(style=LightColorizedStyle, show_x_labels=True, config=PYGAL_CONFIG)
    bar_chart.title = "Kippo/Cowrie Top Passwords"
    clio = Clio()
    top_passwords = clio.hpfeed.count_passwords(get_credentials_payloads(clio))
    for password_data in top_passwords:
        password,count = password_data
        password = remove_control_characters(password)
        bar_chart.add(password, [{'label': password, 'xlink': '', 'value':count}])

    return bar_chart.render_response() 
开发者ID:CommunityHoneyNetwork,项目名称:CHN-Server,代码行数:15,代码来源:views.py

示例2: graph_users

# 需要导入模块: import pygal [as 别名]
# 或者: from pygal import Bar [as 别名]
def graph_users():
    clio = Clio()
    
    bar_chart = pygal.Bar(style=LightColorizedStyle, show_x_labels=True, config=PYGAL_CONFIG)
    bar_chart.title = "Kippo/Cowrie Top Users"
    clio = Clio()
    top_users = clio.hpfeed.count_users(get_credentials_payloads(clio))
    for user_list in top_users:
        user,password = user_list
        user = remove_control_characters(user)
        bar_chart.add(user, [{'label':user, 'xlink':'', 'value':password}])

    return bar_chart.render_response() 
开发者ID:CommunityHoneyNetwork,项目名称:CHN-Server,代码行数:15,代码来源:views.py

示例3: graph_combos

# 需要导入模块: import pygal [as 别名]
# 或者: from pygal import Bar [as 别名]
def graph_combos():
    clio = Clio()
    
    bar_chart = pygal.Bar(style=LightColorizedStyle, show_x_labels=True, config=PYGAL_CONFIG)
    bar_chart.title = "Kippo/Cowrie Top User/Passwords"
    clio = Clio()
    top_combos = clio.hpfeed.count_combos(get_credentials_payloads(clio))
    for combo_list in top_combos:
        user,password = combo_list
        user = remove_control_characters(user)
        bar_chart.add(user,[{'label':user,'xlink': '', 'value':password}])

    return bar_chart.render_response() 
开发者ID:CommunityHoneyNetwork,项目名称:CHN-Server,代码行数:15,代码来源:views.py

示例4: graph_top_attackers

# 需要导入模块: import pygal [as 别名]
# 或者: from pygal import Bar [as 别名]
def graph_top_attackers():
    clio = Clio()
    
    bar_chart = pygal.Bar(style=LightColorizedStyle, show_x_labels=True, config=PYGAL_CONFIG)
    bar_chart.title = "Kippo/Cowrie Top Attackers"
    clio = Clio()
    top_attackers = top_kippo_cowrie_attackers(clio)
    print(top_attackers)
    for attacker in top_attackers:
        bar_chart.add(str(attacker['source_ip']), attacker['count'])

    return bar_chart.render_response() 
开发者ID:CommunityHoneyNetwork,项目名称:CHN-Server,代码行数:14,代码来源:views.py

示例5: graph_teams_stat_bars

# 需要导入模块: import pygal [as 别名]
# 或者: from pygal import Bar [as 别名]
def graph_teams_stat_bars(team_stats, stat):
    sorted_team_stats = team_stats.sort(stat)
    graph = pygal.Bar(show_legend=False,
                      title='Teams by ' + stat,
                      x_title='team',
                      y_title=stat,
                      print_values=False)
    graph.x_labels = list(sorted_team_stats.index)
    graph.add(stat, sorted_team_stats[stat])

    return graph 
开发者ID:fisadev,项目名称:world_cup_learning,代码行数:13,代码来源:utils.py

示例6: view_scores

# 需要导入模块: import pygal [as 别名]
# 或者: from pygal import Bar [as 别名]
def view_scores(cid, aid):
    courses, current_course = get_courses(cid)
    assign = Assignment.query.filter_by(id=aid, course_id=cid).one_or_none()
    if not Assignment.can(assign, current_user, 'export'):
        flash('Insufficient permissions', 'error')
        return abort(401)

    include_all = request.args.get('all', False, type=bool)
    query = (Score.query.options(db.joinedload('backup'), db.joinedload(Score.grader))
                        .filter_by(assignment=assign))

    if not include_all:
        query = query.filter_by(archived=False)

    # sort scores by submission time in descending order, to match front end display
    query = query.order_by(Score.created.desc())

    all_scores = query.all()

    score_distribution = collections.defaultdict(list)
    for score in all_scores:
        score_distribution[score.kind].append(score.score)

    bar_charts = collections.OrderedDict()
    sorted_kinds = sorted(score_distribution, reverse=True,
                          key=lambda x: len(score_distribution[x]))
    for kind in sorted_kinds:
        score_values = score_distribution[kind]
        score_counts = collections.Counter(score_values)
        bar_chart = pygal.Bar(show_legend=False, x_labels_major_count=6, margin=0,
                              height=400, show_minor_x_labels=False, truncate_label=5)
        bar_chart.fill = True
        bar_chart.title = '{} distribution ({} items)'.format(kind, len(score_values))
        bar_chart.add(kind, [score_counts.get(x) for x in sorted(score_counts)])
        bar_chart.x_labels = [x for x in sorted(score_counts)]

        bar_charts[kind] = bar_chart.render().decode("utf-8")

    return render_template('staff/course/assignment/assignment.scores.html',
                           autograder_url=current_course.autograder_url,
                           assignment=assign, current_course=current_course,
                           courses=courses, scores=all_scores,
                           score_plots=bar_charts) 
开发者ID:okpy,项目名称:ok,代码行数:45,代码来源:admin.py


注:本文中的pygal.Bar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。