本文整理汇总了Python中pygal.Line类的典型用法代码示例。如果您正苦于以下问题:Python Line类的具体用法?Python Line怎么用?Python Line使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Line类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_value_formatter
def test_value_formatter():
line = Line(value_formatter=lambda x: str(x) + u('‰'))
line.add('_', [10 ** 4, 10 ** 5, 23 * 10 ** 4])
q = line.render_pyquery()
assert len(q(".y.axis .guides")) == 11
assert q(".axis.y text").map(texts) == list(map(
lambda x: str(x) + u('‰'), map(float, range(20000, 240000, 20000))))
开发者ID:AllanDaemon,项目名称:pygal,代码行数:7,代码来源:test_config.py
示例2: test_no_data
def test_no_data():
line = Line()
q = line.render_pyquery()
assert q(".text-overlay text").text() == "No data"
line.no_data_text = u("þæ®þ怀&ij¿’€")
q = line.render_pyquery()
assert q(".text-overlay text").text() == u("þæ®þ怀&ij¿’€")
开发者ID:AllanDaemon,项目名称:pygal,代码行数:7,代码来源:test_config.py
示例3: test_only_major_dots_every
def test_only_major_dots_every():
"""Test major dots"""
line = Line(show_only_major_dots=True, x_labels_major_every=3)
line.add('test', range(12))
line.x_labels = map(str, range(12))
q = line.render_pyquery()
assert len(q(".dots")) == 4
开发者ID:aroraumang,项目名称:pygal,代码行数:7,代码来源:test_line.py
示例4: test_parametric_styles_with_parameters
def test_parametric_styles_with_parameters():
"""Test a parametric style with parameters"""
line = Line(style=RotateStyle(
'#de3804', step=12, max_=180, base_style=LightStyle))
line.add('_', [1, 2, 3])
line.x_labels = 'abc'
assert line.render()
开发者ID:ConnorMooreLUC,项目名称:pygal,代码行数:7,代码来源:test_style.py
示例5: test_one_dot
def test_one_dot():
line = Line()
line.add('one dot', [12])
line.x_labels = ['one']
q = line.render_pyquery()
assert len(q(".axis.x")) == 1
assert len(q(".axis.y")) == 1
assert len(q(".y.axis .guides")) == 1
开发者ID:andreasnuesslein,项目名称:pygal,代码行数:8,代码来源:test_line.py
示例6: test_major_dots
def test_major_dots():
line = Line(x_labels_major_count=2, show_only_major_dots=True)
line.add('test', range(12))
line.x_labels = [
'lol', 'lol1', 'lol2', 'lol3', 'lol4', 'lol5',
'lol6', 'lol7', 'lol8', 'lol9', 'lol10', 'lol11']
# line.x_labels_major = ['lol3']
return line.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:8,代码来源:tests.py
示例7: test_parametric_styles
def test_parametric_styles():
chart = None
for style in STYLES:
line = Line(style=style('#f4e83a'))
line.add('_', [1, 2, 3])
line.x_labels = 'abc'
new_chart = line.render()
assert chart != new_chart
chart = new_chart
开发者ID:AlexSnet,项目名称:pygal,代码行数:9,代码来源:test_style.py
示例8: test_human_readable
def test_human_readable():
line = Line()
line.add("_", [10 ** 4, 10 ** 5, 23 * 10 ** 4])
# q = line.render_pyquery()
# assert q(".axis.y text").map(texts) == map(
# str, range(20000, 240000, 20000))
line.human_readable = True
q = line.render_pyquery()
assert q(".axis.y text").map(texts) == map(lambda x: "%dk" % x, range(20, 240, 20))
开发者ID:Zanarh,项目名称:pygal,代码行数:9,代码来源:test_config.py
示例9: test_not_equal_x_labels
def test_not_equal_x_labels():
line = Line()
line.add('test1', range(100))
line.x_labels = map(str, range(11))
q = line.render_pyquery()
assert len(q(".dots")) == 100
assert len(q(".axis.x")) == 1
assert q(".axis.x text").map(texts) == ['0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', '10']
开发者ID:AlanRun,项目名称:UiAutoTest,代码行数:9,代码来源:test_line.py
示例10: test_logarithmic_bad_interpolation
def test_logarithmic_bad_interpolation():
try:
import scipy
except ImportError:
return
line = Line(logarithmic=True, interpolate='cubic')
line.add('_', [.001, .00000001, 1])
q = line.render_pyquery()
assert len(q(".y.axis .guides")) == 40
开发者ID:NicholasShatokhin,项目名称:spindl,代码行数:9,代码来源:test_config.py
示例11: test_global_config
def test_global_config():
"""Test global configuration"""
chart = Line(stroke=False)
chart.add('1', s1)
chart.add('2', s2)
q = chart.render_pyquery()
assert len(q('.serie-0 .line')) == 0
assert len(q('.serie-1 .line')) == 0
assert len(q('.serie-0 .dot')) == 5
assert len(q('.serie-1 .dot')) == 6
开发者ID:Kozea,项目名称:pygal,代码行数:10,代码来源:test_serie_config.py
示例12: test_no_serie_config
def test_no_serie_config():
"""Test per serie no configuration"""
chart = Line()
chart.add('1', s1)
chart.add('2', s2)
q = chart.render_pyquery()
assert len(q('.serie-0 .line')) == 1
assert len(q('.serie-1 .line')) == 1
assert len(q('.serie-0 .dot')) == 5
assert len(q('.serie-1 .dot')) == 6
开发者ID:Kozea,项目名称:pygal,代码行数:10,代码来源:test_serie_config.py
示例13: test_parametric_styles
def test_parametric_styles():
"""Test that no parametric produce the same result"""
chart = None
for style in STYLES:
line = Line(style=style('#f4e83a'))
line.add('_', [1, 2, 3])
line.x_labels = 'abc'
new_chart = line.render()
assert chart != new_chart
chart = new_chart
开发者ID:Kozea,项目名称:pygal,代码行数:10,代码来源:test_style.py
示例14: test_line
def test_line():
line = Line()
rng = [8, 12, 23, 73, 39, 57]
line.add('Single serie', rng)
line.title = "One serie"
q = line.render_pyquery()
assert len(q(".axis.x")) == 0
assert len(q(".axis.y")) == 1
assert len(q(".plot .series path")) == 1
assert len(q(".x.axis .guides")) == 0
assert len(q(".y.axis .guides")) == 7
开发者ID:andreasnuesslein,项目名称:pygal,代码行数:11,代码来源:test_line.py
示例15: test_negative_and_float_and_no_data_sparktext
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('')
开发者ID:Bouska,项目名称:pygal,代码行数:11,代码来源:test_sparktext.py
示例16: test_logarithmic
def test_logarithmic():
line = Line(logarithmic=True)
line.add('_', [1, 10 ** 10, 1])
q = line.render_pyquery()
assert len(q(".axis.x")) == 0
assert len(q(".axis.y")) == 1
assert len(q(".plot .series path")) == 1
assert len(q(".legend")) == 1
assert len(q(".x.axis .guides")) == 0
assert len(q(".y.axis .guides")) == 51
assert len(q(".dots")) == 3
开发者ID:AllanDaemon,项目名称:pygal,代码行数:11,代码来源:test_config.py
示例17: monthly_total_precip_line
def monthly_total_precip_line(monthlies, append_title=""):
"""
Given `monthlies` data as returned by `aggregate_monthly_data()`,
returns a Pygal line graph of precipitation totals for each month.
"""
graph = Line(title="Precipitation" + append_title,
x_labels=MONTH_NAMES, x_label_rotation=90)
graph.add("Precip(mm)", [monthly['precipitation_total'] / 10.
for monthly in monthlies])
return graph
开发者ID:globus,项目名称:globus-sample-data-portal,代码行数:13,代码来源:processing.py
示例18: test_simple_line
def test_simple_line():
"""Simple line test"""
line = Line()
rng = range(-30, 31, 5)
line.add('test1', [cos(x / 10) for x in rng])
line.add('test2', [sin(x / 10) for x in rng])
line.add('test3', [cos(x / 10) - sin(x / 10) for x in rng])
line.x_labels = map(str, rng)
line.title = "cos sin and cos - sin"
q = line.render_pyquery()
assert len(q(".axis.x")) == 1
assert len(q(".axis.y")) == 1
assert len(q(".plot .series path")) == 3
assert len(q(".legend")) == 3
assert len(q(".x.axis .guides")) == 13
assert len(q(".y.axis .guides")) == 13
assert len(q(".dots")) == 3 * 13
assert q(".axis.x text").map(texts) == [
'-30', '-25', '-20', '-15', '-10', '-5',
'0', '5', '10', '15', '20', '25', '30']
assert q(".axis.y text").map(texts) == [
'-1.2', '-1', '-0.8', '-0.6', '-0.4', '-0.2',
'0', '0.2', '0.4', '0.6', '0.8', '1', '1.2']
assert q(".title").text() == 'cos sin and cos - sin'
assert q(".legend text").map(texts) == ['test1', 'test2', 'test3']
开发者ID:aroraumang,项目名称:pygal,代码行数:25,代码来源:test_line.py
示例19: test_interpolate_secondary
def test_interpolate_secondary():
chart = Line(title=u'Some different points', interpolate='cubic')
chart.add('line', [1000, 2000, 7000])
chart.add('other line', [100, 500, 500], secondary=True)
chart.range = 0, 10000
chart.secondary_range = 0, 1000
return chart.render_response()
开发者ID:fredtantini,项目名称:pygal,代码行数:7,代码来源:tests.py
示例20: test_same_max_and_relative_values_sparktext
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('▁▁▁▁▁')
开发者ID:AlanRun,项目名称:UiAutoTest,代码行数:8,代码来源:test_sparktext.py
注:本文中的pygal.Line类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论