示例#1
0
def test_map_visualmap_pieces():
    value = [155, 10, 66, 78]
    attr = ["福建", "山东", "北京", "上海"]
    map = Map("全国地图示例", width=1200, height=600)
    map.add("",
            attr,
            value,
            maptype='china',
            is_visualmap=True,
            is_piecewise=True,
            visual_text_color="#000",
            visual_range_text=["", ""],
            pieces=[
                {
                    "max": 160,
                    "min": 70,
                    "label": "高数值"
                },
                {
                    "max": 69,
                    "min": 0,
                    "label": "低数值"
                },
            ])
    content = map._repr_html_()
    assert '"max": 160' in content
    assert '"min": 0' in content
示例#2
0
def test_city_map():
    value = [1]
    attr = ["渝水区"]
    map = Map("新余地图示例", width=1200, height=600)
    map.add("", attr, value, maptype='新余', is_visualmap=True,
            visual_text_color='#000')
    # To avoid potential pinyin crash, all cities have a province prefix
    assert "jiang1_xi1_xin1_yu2" in map._repr_html_()
示例#3
0
def test_city_map():
    value = [1]
    attr = ["渝水区"]
    map = Map("新余地图示例", width=1200, height=600)
    map.add("", attr, value, maptype='新余', is_visualmap=True,
            visual_text_color='#000')
    # To avoid potential pinyin crash, all cities have a province prefix
    assert "jiang1_xi1_xin1_yu2" in map._repr_html_()
def test_city_map():
    map = Map("海淀示例", width=1200, height=600)
    map.add("", [], [], maptype='海淀区',
            visual_text_color='#000')
    # To avoid potential pinyin crash, all cities have a province prefix
    html = map._repr_html_()
    assert "zhi2xia2_bei3jing1_hai3dian4" in html
    print(html)
    assert "nbextensions/echarts-china-counties-js" in html
def test_city_map():
    value = [1, 100]
    attr = ['Gujarat', 'Tamil Nadu']
    map = Map('India', width=800, height=600)
    map.add('',
            attr,
            value,
            maptype='印度',
            is_visualmap=True,
            visual_text_color="#000")
    html = map._repr_html_()
    assert "India" in html
    assert "nbextensions/echarts-countries-js" in html
示例#6
0
def test_map_visualmap_pieces():
    value = [155, 10, 66, 78]
    attr = ["福建", "山东", "北京", "上海"]
    map = Map("全国地图示例", width=1200, height=600)
    map.add(
        "",
        attr,
        value,
        maptype="china",
        is_visualmap=True,
        is_piecewise=True,
        visual_text_color="#000",
        visual_range_text=["", ""],
        pieces=[
            {"max": 160, "min": 70, "label": "高数值"},
            {"max": 69, "min": 0, "label": "低数值"},
        ],
    )
    content = map._repr_html_()
    assert '"max": 160' in content
    assert '"min": 0' in content