本文整理汇总了Python中pygal.Line.render_sparktext方法的典型用法代码示例。如果您正苦于以下问题:Python Line.render_sparktext方法的具体用法?Python Line.render_sparktext怎么用?Python Line.render_sparktext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygal.Line
的用法示例。
在下文中一共展示了Line.render_sparktext方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_data_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_no_data_sparktext():
"""Test no data sparktext"""
chart2 = Line()
chart2.add('_', [])
assert chart2.render_sparktext() == u('')
chart3 = Line()
assert chart3.render_sparktext() == u('')
示例2: test_another_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_another_sparktext():
chart = Line()
chart.add('_', [0, 30, 55, 80, 33, 150])
assert chart.render_sparktext() == u('▁▂▃▄▂█')
assert chart.render_sparktext() == chart.render_sparktext()
chart2 = Bar()
chart2.add('_', [0, 30, 55, 80, 33, 150])
assert chart2.render_sparktext() == chart.render_sparktext()
示例3: test_same_max_and_relative_values_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_same_max_and_relative_values_sparktext():
chart = Line()
chart.add('_', [0, 0, 0, 0, 0])
assert chart.render_sparktext() == u('▁▁▁▁▁')
chart2 = Line()
chart2.add('_', [1, 1, 1, 1, 1])
assert chart2.render_sparktext(relative_to=1) == u('▁▁▁▁▁')
示例4: test_another_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_another_sparktext():
"""Test that same data produces same sparktext"""
chart = Line()
chart.add('_', [0, 30, 55, 80, 33, 150])
assert chart.render_sparktext() == u('▁▂▃▄▂█')
assert chart.render_sparktext() == chart.render_sparktext()
chart2 = Bar()
chart2.add('_', [0, 30, 55, 80, 33, 150])
assert chart2.render_sparktext() == chart.render_sparktext()
示例5: test_negative_and_float_and_no_data_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_negative_and_float_and_no_data_sparktext():
chart = Line()
chart.add('_', [0.1, 0.2, 0.9, -0.5])
assert chart.render_sparktext() == u('▁▂█▁')
chart2 = Line()
chart2.add('_', [])
assert chart2.render_sparktext() == u('')
chart3 = Line()
assert chart3.render_sparktext() == u('')
示例6: test_negative_and_float__sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_negative_and_float__sparktext():
"""Test negative values"""
"""Test negative values"""
chart = Line()
chart.add('_', [0.1, 0.2, 0.9, -0.5])
assert chart.render_sparktext() == u('▁▂█▁')
示例7: test_shifted_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_shifted_sparktext():
"""Test relative_to option in sparktext"""
chart = Line()
chart.add('_', list(map(lambda x: x + 10000, range(8))))
assert chart.render_sparktext() == u('▁▂▃▄▅▆▇█')
assert chart.render_sparktext(relative_to=0) == u('▇▇▇▇▇▇▇█')
示例8: test_all_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_all_sparktext():
"""Test all character sparktext"""
chart = Line()
chart.add('_', range(8))
assert chart.render_sparktext() == u('▁▂▃▄▅▆▇█')
示例9: test_basic_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_basic_sparktext():
"""Test basic sparktext"""
chart = Line()
chart.add('_', [1, 5, 22, 13, 53])
assert chart.render_sparktext() == u('▁▁▃▂█')
示例10: test_all_sparktext
# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_sparktext [as 别名]
def test_all_sparktext():
chart = Line()
chart.add('_', range(8))
assert chart.render_sparktext() == u('▁▂▃▄▅▆▇█')