コード例 #1
0
def test_echarts_js_dependencies_embed():
    env = EchartsEnvironment(pyecharts_config=PyEchartsConfig(
        jshost=get_resource_dir('templates', 'js', 'echarts')))
    tpl = env.from_string('{{ echarts_js_dependencies_embed("echarts") }}')
    bar = create_demo_bar()
    html = tpl.render(bar=bar)
    assert len(html) > 0
コード例 #2
0
def test_echarts_js_dependencies():
    env = EchartsEnvironment(pyecharts_config=PyEchartsConfig(
        jshost='http://localhost/echarts'))
    tpl = env.from_string('{{ echarts_js_dependencies(bar) }}')
    bar = create_demo_bar()
    html = tpl.render(bar=bar)
    assert '<script type="text/javascript" src="http://localhost/echarts/echarts.min.js"></script>' == html  # flake8: noqa
コード例 #3
0
def test_echarts_js_dependencies_embed():
    env = EchartsEnvironment(
        pyecharts_config=PyEchartsConfig(
            jshost=get_resource_dir("templates", "js", "echarts")
        )
    )
    tpl = env.from_string('{{ echarts_js_dependencies_embed("echarts") }}')
    bar = create_demo_bar()
    html = tpl.render(bar=bar)
    assert len(html) > 0
コード例 #4
0
def test_echarts_js_dependencies():
    env = EchartsEnvironment(
        pyecharts_config=PyEchartsConfig(jshost="http://localhost/echarts")
    )
    tpl = env.from_string("{{ echarts_js_dependencies(bar) }}")
    bar = create_demo_bar()
    html = tpl.render(bar=bar)
    assert (
        '<script type="text/javascript" src="http://localhost/echarts/echarts.min.js"></script>' ==
        html
    )  # flake8: noqa
コード例 #5
0
def test_echarts_js_in_first():
    value = [20, 190, 253, 77, 65]
    attr = ['汕头市', '汕尾市', '揭阳市', '阳江市', '肇庆市']
    map = Map("广东地图示例", width=1200, height=600)
    map.add("",
            attr,
            value,
            maptype='广东',
            is_visualmap=True,
            visual_text_color='#000')
    env = EchartsEnvironment(pyecharts_config=PyEchartsConfig(
        jshost='http://localhost/echarts'))
    tpl = env.from_string('{{ echarts_js_dependencies(m) }}')
    html = tpl.render(m=map)
    echarts_js_pos = html.find('echarts.min.js')
    guangdong_js_pos = html.find('guangdong.js')
    assert echarts_js_pos > -1
    assert guangdong_js_pos > -1
    assert echarts_js_pos < guangdong_js_pos
コード例 #6
0
def test_echarts_js_in_first():
    value = [20, 190, 253, 77, 65]
    attr = ["汕头市", "汕尾市", "揭阳市", "阳江市", "肇庆市"]
    map = Map("广东地图示例", width=1200, height=600)
    map.add(
        "",
        attr,
        value,
        maptype="广东",
        is_visualmap=True,
        visual_text_color="#000",
    )
    env = EchartsEnvironment(pyecharts_config=PyEchartsConfig(
        jshost="http://localhost/echarts"))
    tpl = env.from_string("{{ echarts_js_dependencies(m) }}")
    html = tpl.render(m=map)
    echarts_js_pos = html.find("echarts.min.js")
    guangdong_js_pos = html.find("guangdong.js")
    assert echarts_js_pos > -1
    assert guangdong_js_pos > -1
    assert echarts_js_pos < guangdong_js_pos
コード例 #7
0
def test_echarts_js_in_first():
    value = [20, 190, 253, 77, 65]
    attr = ["汕头市", "汕尾市", "揭阳市", "阳江市", "肇庆市"]
    map = Map("广东地图示例", width=1200, height=600)
    map.add(
        "",
        attr,
        value,
        maptype="广东",
        is_visualmap=True,
        visual_text_color="#000",
    )
    env = EchartsEnvironment(
        pyecharts_config=PyEchartsConfig(jshost="http://localhost/echarts")
    )
    tpl = env.from_string("{{ echarts_js_dependencies(m) }}")
    html = tpl.render(m=map)
    echarts_js_pos = html.find("echarts.min.js")
    guangdong_js_pos = html.find("guangdong.js")
    assert echarts_js_pos > -1
    assert guangdong_js_pos > -1
    assert echarts_js_pos < guangdong_js_pos