當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。