コード例 #1
0
ファイル: test_xml_filters.py プロジェクト: langelee/pygal
def test_xml_filters_round_trip():
    plot = Bar()
    plot.add("A", [60, 75, 80, 78, 83, 90])
    plot.add("B", [92, 87, 81, 73, 68, 55])
    before = plot.render()
    plot.add_xml_filter(lambda T: T)
    after = plot.render()
    assert before == after
コード例 #2
0
ファイル: test_xml_filters.py プロジェクト: young-0/pygal
def test_xml_filters_round_trip():
    plot = Bar()
    plot.add("A", [60, 75, 80, 78, 83, 90])
    plot.add("B", [92, 87, 81, 73, 68, 55])
    before = plot.render()
    plot.add_xml_filter(lambda T: T)
    after = plot.render()
    assert before == after
コード例 #3
0
ファイル: test_xml_filters.py プロジェクト: AlexSnet/pygal
def test_xml_filters_change_bars():
    plot = Bar(legend_at_bottom=True, explicit_size=True, width=800, height=600)
    A = [60, 75, 80, 78, 83, 90]
    B = [92, 87, 81, 73, 68, 55]
    plot.add("A", A)
    plot.add("B", B)
    plot.add_xml_filter(ChangeBarsXMLFilter(A,B))
    q = plot.render_tree()
    assert len(q.xpath("g")) == 2
    assert q.xpath("g")[1].attrib["transform"] == "translate(0,150), scale(1,0.75)"
コード例 #4
0
ファイル: test_xml_filters.py プロジェクト: young-0/pygal
def test_xml_filters_change_bars():
    plot = Bar(legend_at_bottom=True, explicit_size=True,
               width=800, height=600)
    A = [60, 75, 80, 78, 83, 90]
    B = [92, 87, 81, 73, 68, 55]
    plot.add("A", A)
    plot.add("B", B)
    plot.add_xml_filter(ChangeBarsXMLFilter(A, B))
    q = plot.render_tree()
    assert len(q.findall("g")) == 2
    assert q.findall("g")[1].attrib[
        "transform"] == "translate(0,150), scale(1,0.75)"