本文整理汇总了Python中pygal.Bar.title方法的典型用法代码示例。如果您正苦于以下问题:Python Bar.title方法的具体用法?Python Bar.title怎么用?Python Bar.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygal.Bar
的用法示例。
在下文中一共展示了Bar.title方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiline_title
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_multiline_title():
bar = Bar()
bar.add('Looooooooooooooooooooooooooooooooooong', [2, None, 12])
bar.title = (
'First line \n Second line \n Third line'
)
return bar.render_response()
示例2: test_long_labels
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_long_labels():
bar = Bar()
bar.add("Long", [2, None, 12])
bar.title = "1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890"
bar.x_labels = "a" * 100, "b " * 50, "cc ! " * 20
bar.x_label_rotation = 45
return bar.render_response()
示例3: test_long_labels
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_long_labels():
bar = Bar()
bar.add('Long', [2, None, 12])
bar.title = (
'1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890')
bar.x_labels = 'a' * 100, 'b ' * 50, 'cc ! ' * 20
bar.x_label_rotation = 45
return bar.render_response()
示例4: test_chart_renders
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_chart_renders():
line_chart = Bar(print_values=True, percent_values=True, print_values_position='top')
line_chart.title = 'Browser usage evolution (in %)'
line_chart.x_labels = map(str, range(2002, 2013))
line_chart.add('Firefox', [None, None, 0, 16.6, 25, 31, 36.4, 45.5, 46.3, 42.8, 37.1])
line_chart.add('Chrome', [None, None, None, None, None, None, 0, 3.9, 10.8, 23.8, 35.3])
line_chart.add('IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6, 54.7, 44.8, 36.2, 26.6, 20.1])
line_chart.add('Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4, 8.9, 5.8, 6.7, 6.8, 7.5])
assert line_chart.render()
示例5: test_long_title
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_long_title():
bar = Bar()
bar.add('Looooooooooooooooooooooooooooooooooong', [2, None, 12])
bar.title = (
'1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 '
'12345678901 123456789012 1234567890123 12345678901234 '
'123456789012345 1234567890123456 12345678901234567 '
'123456789012345678 1234567890123456789 12345678901234567890 '
'123456789012345 1234567890123456 12345678901234567 '
'12345678901 123456789012 1234567890123 12345678901234 '
'1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890')
return bar.render_response()
示例6: test_simple_bar
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_simple_bar():
bar = Bar()
rng = [-3, -32, -39]
bar.add("test1", rng)
bar.add("test2", map(abs, rng))
bar.x_labels = map(str, rng)
bar.title = "Bar test"
q = bar.render_pyquery()
assert len(q(".axis.x")) == 1
assert len(q(".axis.y")) == 1
assert len(q(".legend")) == 2
assert len(q(".plot .series rect")) == 2 * 3
示例7: test_long_title
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_long_title():
bar = Bar()
bar.add("Looooooooooooooooooooooooooooooooooong", [2, None, 12])
bar.title = (
"1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 "
"12345678901 123456789012 1234567890123 12345678901234 "
"123456789012345 1234567890123456 12345678901234567 "
"123456789012345678 1234567890123456789 12345678901234567890 "
"123456789012345 1234567890123456 12345678901234567 "
"12345678901 123456789012 1234567890123 12345678901234 "
"1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890"
)
return bar.render_response()
示例8: test_long_title
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_long_title():
bar = Bar()
bar.add('Lol', [2, None, 12])
bar.title = '123456789 ' * 30
return bar.render_response()
示例9: test_multiline_title
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def test_multiline_title():
bar = Bar()
bar.add("Looooooooooooooooooooooooooooooooooong", [2, None, 12])
bar.title = "First line \n Second line \n Third line"
return bar.render_response()
示例10: dessiner_graph_course
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
def dessiner_graph_course(self):
graph = Bar(style=style.BlueStyle)
graph.title = "Course du %s/%s/%s" % (course.date.day, course.date.month, course.date.year)
graph.add ([ (str(x), _get_vitesse(x)) for x in range (0, length(tours)) ])
return graph
示例11: int
# 需要导入模块: from pygal import Bar [as 别名]
# 或者: from pygal.Bar import title [as 别名]
"""Determine a value based on its percentage."""
p_index = int(p * len(x))
return str(sorted(x)[p_index])
##############
# Dispersion #
##############
def data_range(x):
return str(max(x) - min(x))
# Execute tests and save the results.
with open('data.txt', 'w') as f:
f.write('Two D6 Analysis')
f.write('\nMean result: ' + mean(results))
f.write('\nMedian result: ' + median(results))
f.write('\nQuantile result: ' + quantile(results, .90))
f.write('\nData Range: ' + data_range(results))
# Visualize the results.
hist = Bar()
hist.title = 'Results of rolling 2d6 1,000,000 times.'
hist.x_labels = [i for i in range(2, die1.num_sides * 2 + 1)]
hist.x_title = 'Result'
hist.y_title = 'Frequency of Result'
hist.add('2d6', frequencies)
hist.render_to_file('test.svg')