Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map改变图例后选择不了省份 #364

Closed
hkb1990 opened this issue Jun 10, 2014 · 2 comments
Closed

Map改变图例后选择不了省份 #364

hkb1990 opened this issue Jun 10, 2014 · 2 comments

Comments

@hkb1990
Copy link

hkb1990 commented Jun 10, 2014

问题描述:
将下面代码保存成html,打开页面,随便选中一个省,然后改变图例(legend) ,之后可以发现无论怎么点都选择不了省份了。
TypeError: self.shapeList[i].style is undefined echarts-plain-original-map.js:35516

第一次使用echarts,感觉很好很强大,新人希望有人可以帮忙看下,谢谢!

代码是从例子里面拷的,只改了一点点。
http://echarts.baidu.com/doc/example/map1.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body onload="showMap()">
<div id="map" style="width:800px;height:400px;margin-left:auto;margin-right:auto;"></div>
<script src='http://echarts.baidu.com/build/echarts-plain-original-map.js'></script>
<script type="text/javascript">
myChart = echarts.init(document.getElementById('map'));
option = {
    title : {
        text: 'iphone销量',
        subtext: '纯属虚构',
        x:'center'
    },
    tooltip : {
        trigger: 'item'
    },
    legend: {
        orient: 'vertical',
        x:'left',
        data:['iphone3','iphone4','iphone5']
    },
    dataRange: {
        min: 0,
        max: 2500,
        text:['高','低'],           // 文本,默认为数值文本
        calculable : true
    },
    toolbox: {
        show : true,
        orient : 'vertical',
        x: 'right',
        y: 'center',
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    series : [
        {
            name: 'iphone3',
            type: 'map',
            mapType: 'china',
            itemStyle:{
                normal:{label:{show:true}},
                emphasis:{label:{show:true}}
            },
            selectedMode: 'single',      // 我新加的
            data:[
                {name: '北京',value: Math.round(Math.random()*1000)},
                {name: '天津',value: Math.round(Math.random()*1000)},
                {name: '上海',value: Math.round(Math.random()*1000)},
            ]
        },
        {
            name: 'iphone4',
            type: 'map',
            mapType: 'china',
            itemStyle:{
                normal:{label:{show:true}},
                emphasis:{label:{show:true}}
            },
            selectedMode: 'single',     // 我新加的
            data:[
                {name: '宁夏',value: Math.round(Math.random()*1000)},
                {name: '香港',value: Math.round(Math.random()*1000)},
                {name: '澳门',value: Math.round(Math.random()*1000)}
            ]
        },
        {
            name: 'iphone5',
            type: 'map',
            mapType: 'china',
            itemStyle:{
                normal:{label:{show:true}},
                emphasis:{label:{show:true}}
            },
            selectedMode: 'single',     // 我新加的
            data:[
                {name: '北京',value: Math.round(Math.random()*1000)},
                {name: '香港',value: Math.round(Math.random()*1000)},
                {name: '澳门',value: Math.round(Math.random()*1000)}
            ]
        }
    ]
};

function showMap(){
    myChart.setOption(option);
}
</script>
</body>
</html>
@kener
Copy link
Contributor

kener commented Jun 10, 2014

bug confirm

kener added a commit that referenced this issue Jun 10, 2014
@hkb1990
Copy link
Author

hkb1990 commented Jun 11, 2014

@kener , fixed, thanks a lot.

@hkb1990 hkb1990 closed this as completed Jun 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants