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


Python Line.render_pyquery方法代码示例

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


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

示例1: test_no_data

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:9,代码来源:test_config.py

示例2: test_show_legend

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
def test_show_legend():
    line = Line()
    line.add('_', [1, 2, 3])
    q = line.render_pyquery()
    assert len(q(".legend")) == 1
    line.show_legend = False
    q = line.render_pyquery()
    assert len(q(".legend")) == 0
开发者ID:AllanDaemon,项目名称:pygal,代码行数:10,代码来源:test_config.py

示例3: test_show_dots

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
def test_show_dots():
    line = Line()
    line.add('_', [1, 2, 3])
    q = line.render_pyquery()
    assert len(q(".dots")) == 3
    line.show_dots = False
    q = line.render_pyquery()
    assert len(q(".dots")) == 0
开发者ID:AllanDaemon,项目名称:pygal,代码行数:10,代码来源:test_config.py

示例4: test_human_readable

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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) == list(map(str, map(float, range(20000, 240000, 20000))))
    line.human_readable = True
    q = line.render_pyquery()
    assert q(".axis.y text").map(texts) == list(map(lambda x: "%dk" % x, range(20, 240, 20)))
开发者ID:Cortana-,项目名称:pygal,代码行数:10,代码来源:test_config.py

示例5: test_human_readable

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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) == list(map(
        str, list(map(float, list(range(20000, 240000, 20000))))))
    line.human_readable = True
    q = line.render_pyquery()
    assert q(".axis.y text").map(texts) == ['%dk' % x for x in range(20, 240, 20)]
开发者ID:andreasnuesslein,项目名称:pygal,代码行数:11,代码来源:test_config.py

示例6: test_human_readable

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
def test_human_readable():
    """Test human readable option"""
    line = Line()
    line.add('_', [10 ** 4, 10 ** 5, 23 * 10 ** 4])
    q = line.render_pyquery()
    assert q(".axis.y text").map(texts) == list(map(
        str, map(float, range(20000, 240000, 20000))))
    line.human_readable = True
    q = line.render_pyquery()
    assert q(".axis.y text").map(texts) == list(map(
        lambda x: '%dk' % x, range(20, 240, 20)))
开发者ID:regzhuce,项目名称:pygal,代码行数:13,代码来源:test_config.py

示例7: test_value_formatter

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:9,代码来源:test_config.py

示例8: test_only_major_dots_every

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:9,代码来源:test_line.py

示例9: test_only_major_dots

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
def test_only_major_dots():
    line = Line(show_only_major_dots=True,)
    line.add('test', range(12))
    line.x_labels = map(str, range(12))
    line.x_labels_major = ['1', '5', '11']
    q = line.render_pyquery()
    assert len(q(".dots")) == 3
开发者ID:AlanRun,项目名称:UiAutoTest,代码行数:9,代码来源:test_line.py

示例10: test_only_major_dots_count

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
def test_only_major_dots_count():
    line = Line(show_only_major_dots=True)
    line.add('test', range(12))
    line.x_labels = map(str, range(12))
    line.x_labels_major_count = 2
    q = line.render_pyquery()
    assert len(q(".dots")) == 2
开发者ID:AlanRun,项目名称:UiAutoTest,代码行数:9,代码来源:test_line.py

示例11: test_simple_line

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:27,代码来源:test_line.py

示例12: test_config_behaviours

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
def test_config_behaviours():
    """Test that all different way to set config produce same results"""
    line1 = Line()
    line1.show_legend = False
    line1.fill = True
    line1.pretty_print = True
    line1.no_prefix = True
    line1.x_labels = ['a', 'b', 'c']
    line1.add('_', [1, 2, 3])
    l1 = line1.render()

    q = line1.render_pyquery()
    assert len(q(".axis.x")) == 1
    assert len(q(".axis.y")) == 1
    assert len(q(".plot .series path")) == 1
    assert len(q(".legend")) == 0
    assert len(q(".x.axis .guides")) == 3
    assert len(q(".y.axis .guides")) == 11
    assert len(q(".dots")) == 3
    assert q(".axis.x text").map(texts) == ['a', 'b', 'c']

    line2 = Line(
        show_legend=False,
        fill=True,
        pretty_print=True,
        no_prefix=True,
        x_labels=['a', 'b', 'c'])
    line2.add('_', [1, 2, 3])
    l2 = line2.render()
    assert l1 == l2

    class LineConfig(Config):
        show_legend = False
        fill = True
        pretty_print = True
        no_prefix = True
        x_labels = ['a', 'b', 'c']

    line3 = Line(LineConfig)
    line3.add('_', [1, 2, 3])
    l3 = line3.render()
    assert l1 == l3

    line4 = Line(LineConfig())
    line4.add('_', [1, 2, 3])
    l4 = line4.render()
    assert l1 == l4

    line_config = Config()
    line_config.show_legend = False
    line_config.fill = True
    line_config.pretty_print = True
    line_config.no_prefix = True
    line_config.x_labels = ['a', 'b', 'c']

    line5 = Line(line_config)
    line5.add('_', [1, 2, 3])
    l5 = line5.render()
    assert l1 == l5
开发者ID:Frankie-666,项目名称:pygal,代码行数:61,代码来源:test_config.py

示例13: test_one_dot

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:10,代码来源:test_line.py

示例14: test_not_equal_x_labels

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:11,代码来源:test_line.py

示例15: test_logarithmic_bad_interpolation

# 需要导入模块: from pygal import Line [as 别名]
# 或者: from pygal.Line import render_pyquery [as 别名]
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,代码行数:11,代码来源:test_config.py


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