{"action":"opened","issue":{"url":"https://api.github.com/repos/ecomfe/echarts/issues/3249","repository_url":"https://api.github.com/repos/ecomfe/echarts","labels_url":"https://api.github.com/repos/ecomfe/echarts/issues/3249/labels{/name}","comments_url":"https://api.github.com/repos/ecomfe/echarts/issues/3249/comments","events_url":"https://api.github.com/repos/ecomfe/echarts/issues/3249/events","html_url":"https://github.com/ecomfe/echarts/issues/3249","id":155875217,"number":3249,"title":"geo和map如何共用地图，以及tooltip的取值问题。","user":{"login":"rainryu","id":13014742,"avatar_url":"https://avatars.githubusercontent.com/u/13014742?v=3","gravatar_id":"","url":"https://api.github.com/users/rainryu","html_url":"https://github.com/rainryu","followers_url":"https://api.github.com/users/rainryu/followers","following_url":"https://api.github.com/users/rainryu/following{/other_user}","gists_url":"https://api.github.com/users/rainryu/gists{/gist_id}","starred_url":"https://api.github.com/users/rainryu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rainryu/subscriptions","organizations_url":"https://api.github.com/users/rainryu/orgs","repos_url":"https://api.github.com/users/rainryu/repos","events_url":"https://api.github.com/users/rainryu/events{/privacy}","received_events_url":"https://api.github.com/users/rainryu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-20T02:30:21Z","updated_at":"2016-05-20T02:30:21Z","closed_at":null,"body":"<!--\r\n为了方便我们能够复现和修复 bug，请遵从下面的规范描述您的问题。\r\n-->\r\n#### 问题简述 (One-line summary)\r\n\r\ngeo 的散点图，想用地图的区域显示区域维度的数据，试了一下map和geo没法共享地图，只能加载两次地图；\r\n\r\nmap图，当数据是多series的时候，tooltip也设置成item模式，但formatte函数里无法取到全部series的数据，只能取到第一个series的，api中也未说明如何取，设置成axis时也则啥也取不到了；\r\n\r\n#### 版本及环境 (Version & Environment)\r\n+ ECharts 版本 (ECharts version):3.1.7\r\n+ 浏览器类型和版本 (Browser version):chrome\r\n+ 操作系统类型和版本 (OS Version):win7\r\n\r\n\r\n#### 重现步骤 (Steps to reproduce)\r\n1.\r\n2.\r\n\r\n\r\n#### 期望结果 (Expected behaviour)\r\ngeo和map能共享一个地图；\r\n\r\nmap时的tooltip能按维度取的落在该区域的全部；\r\n\r\n\r\n#### 可能哪里有问题 (What went wrong)\r\n\r\ntooltip处理有问题。\r\n\r\n#### ECharts配置项 (ECharts option)\r\n<!-- 下方贴你的option，注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。\r\n最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing\r\n-->\r\n```javascript\r\n    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->\r\n    <div id=\"main\" style=\"width: 700px;height:500px;\"></div>\r\n    <script type=\"text/javascript\">\r\n        // 基于准备好的dom，初始化echarts实例\r\n        var myChart = echarts.init(document.getElementById('main'));\r\n        function randomData() {\r\n            //return Math.round(Math.random() * 1000);\r\n            return 555;\r\n        }\r\n        var geoCoordMap = {         \r\n            //广州\r\n            \"中山大学附属第一医院\": [113.290040, 23.125670]\r\n            , \"中山大学肿瘤防治中心\": [113.290880, 23.131590]\r\n            //西安\r\n            , \"西安交大一附院\": [108.936868, 34.219006]\r\n            //昆明\r\n             , \"昆华医院\": [102.713357,25.038616]\r\n            //沈阳\r\n            , \"辽宁省肿瘤医院\": [123.472930, 41.793840]\r\n            , \"中国医科大学附属盛京医院\": [123.426630, 41.773370]\r\n        };\r\n\r\n        var convertData = function (data) {\r\n            var res = [];\r\n            for (var i = 0; i < data.length; i++) {\r\n                var geoCoord = geoCoordMap[data[i].name];\r\n                if (geoCoord) {\r\n                    res.push({\r\n                        name: data[i].name,\r\n                        value: geoCoord.concat(data[i].value)\r\n                    });\r\n                }\r\n            }\r\n            return res;\r\n        };\r\n\r\n        var option = {\r\n           // backgroundColor: '#404a59',\r\n            title: {\r\n                text: '签约医院分布图',\r\n                //subtext: 'data from PM25.in',\r\n                //sublink: 'http://www.pm25.in',\r\n                x: 'center',\r\n                textStyle: {\r\n                    //color: '#fff'\r\n                }\r\n            },\r\n            tooltip: {\r\n                trigger: 'axis',\r\n                trigger: 'item',\r\n                formatter: function (params) {\r\n                    return  'componentType : ' + params.componentType + ' |seriesType: ' + params.seriesType + '|seriesIndex : ' + params.seriesIndex + '<br/>'\r\n                    + ' seriesName : ' + params.seriesName + ' |name : ' + params.name + ' : ' + ' |dataIndex: ' + params.dataIndex + ' : ' + '|data : ' + params.data + '<br/>'\r\n                    +params.value + ' : ' + params.color ;\r\n                    //if (params.seriesName === '接入商数量') {\r\n                    //    // {a}（系列名称），{b}（区域名称），{c}（合并数值）, {d}（无）\r\n                    //    //componentType: 'series',\r\n\r\n                    //    //// 系列类型\r\n                    //    //seriesType: string,\r\n\r\n                    //    //// 系列在传入的 option.series 中的 index\r\n                    //    //seriesIndex: number,\r\n\r\n                    //    //// 系列名称\r\n                    //    //seriesName: string,\r\n\r\n                    //    //// 数据名，类目名\r\n                    //    //name: string,\r\n\r\n                    //    //// 数据在传入的 data 数组中的 index\r\n                    //    //dataIndex: number,\r\n\r\n                    //    //// 传入的原始数据项\r\n                    //    //data: Object,\r\n\r\n                    //    //// 传入的数据值\r\n                    //    //value: number|Array,\r\n\r\n                    //    //// 数据图形的颜色\r\n                    //    //color: string,\r\n\r\n                    //    //// 饼图的百分比\r\n                    //    //percent: number,\r\n                    //    return params.name + ' : ' + params.value[2] + '<br/>'\r\n                    //   + '接入商：30家<br/>'\r\n                    //   + '接入产品数：50个<br/>'\r\n                    //   + '使用终端：app，网站，公众号，自助机<br/>'\r\n                    //   + '硬件资源：cpu、内存、网络io、硬盘io<br/>'\r\n                    //   + params + ' : ' + params.componentType + ' : ' + params.seriesType + ' : ' + params.seriesIndex  + '<br/>'\r\n                    //    + params.seriesName + ' : ' + params.name + ' : ' + ' : ' + params.dataIndex + ' : ' + ' : ' + params.data + '<br/>'\r\n                    //+ params.value + ' : ' + params.color\r\n                    //    ;\r\n                    //}\r\n\r\n                    //if (params.seriesName === '三甲' || params.seriesName === '二甲' || params.seriesName === '其他') {\r\n                    //    return params.name + ' : ' + params.value + '<br/>'\r\n                    //      + params + ' : ' + params.componentType + ' : ' + params.seriesType + ' : ' + params.seriesIndex  + '<br/>'\r\n                    //    + params.seriesName + ' : ' + params.name + ' : ' + ' : ' + params.dataIndex + ' : ' + ' : ' + params.data + '<br/>'\r\n                    //+ params.value + ' : ' + params.color\r\n                    //    ;\r\n                    //    ;\r\n                    //}\r\n                }\r\n            },\r\n            legend: [\r\n                {\r\n                    orient: 'vertical',\r\n                    y: 'top',\r\n                    x: 'right',\r\n                    data: ['接入商数量'],\r\n                    textStyle: {\r\n                    //color: '#fff'\r\n                }\r\n            },\r\n            \r\n                 {\r\n                     orient: 'vertical',\r\n                     top: 'middle',\r\n                     left:'right',\r\n                     data: ['三甲', '二甲', '其他']\r\n                 }\r\n            ],\r\n            visualMap: [{\r\n                min: 0,\r\n                max: 3,\r\n                left: 'left',\r\n                top: 'top',\r\n                text: ['多', '少'],           // 文本，默认为数值文本\r\n                seriesIndex:1,\r\n                dimension:2,\r\n                calculable: true,\r\n                color: ['#d94e5d', '#eac736', '#50a3ba'],\r\n                textStyle: {\r\n                   // color: '#fff'\r\n                }\r\n            },\r\n            {\r\n                min: 0,\r\n                max: 2500,\r\n                left: 'left',\r\n                top: 'bottom',\r\n                text: ['高', '低'],           // 文本，默认为数值文本\r\n                seriesIndex: 1,\r\n                dimension: 0,\r\n                calculable: true\r\n            }\r\n            \r\n            ],\r\n            geo: {\r\n                //show:false,\r\n                map: 'china',\r\n                roam: true,\r\n                label: {\r\n                    normal: {\r\n                        show: false\r\n                    },\r\n                    emphasis: {\r\n                        show: false\r\n                    }\r\n                },\r\n                itemStyle: {\r\n                    normal: {\r\n                        //areaColor: '#323c48',\r\n                        //borderColor: '#111'\r\n                    },\r\n                    emphasis: {\r\n\r\n                        //areaColor: '#2a333d'\r\n                    }\r\n                }\r\n            },\r\n            series: [\r\n                {\r\n                    name: '三甲',\r\n                    type: 'map',\r\n                    mapType: 'china',\r\n                    roam: true,\r\n                    // showLegendSymbol:false,\r\n                    label: {\r\n                        normal: {\r\n                            show: true\r\n                        },\r\n                        emphasis: {\r\n                            show: true\r\n                        }\r\n                    }\r\n                    ,\r\n                    data: [\r\n                         { name: '北京', value: randomData() },\r\n                        { name: '天津', value: randomData() },\r\n                        { name: '上海', value: randomData() },\r\n                        { name: '重庆', value: randomData() },\r\n                        { name: '河北', value: randomData() },\r\n                        { name: '河南', value: randomData() },\r\n                        { name: '云南', value: randomData() },\r\n                        { name: '辽宁', value: randomData() },\r\n                        { name: '黑龙江', value: randomData() },\r\n                        { name: '湖南', value: randomData() },\r\n                        { name: '安徽', value: randomData() },\r\n                        { name: '山东', value: randomData() },\r\n                        { name: '新疆', value: randomData() },\r\n                        { name: '江苏', value: randomData() },\r\n                        { name: '浙江', value: randomData() },\r\n                        { name: '江西', value: randomData() },\r\n                        { name: '湖北', value: randomData() },\r\n                        { name: '广西', value: randomData() },\r\n                        { name: '甘肃', value: randomData() },\r\n                        { name: '山西', value: randomData() },\r\n                        { name: '内蒙古', value: randomData() },\r\n                        { name: '陕西', value: randomData() },\r\n                        { name: '吉林', value: randomData() },\r\n                        { name: '福建', value: randomData() },\r\n                        { name: '贵州', value: randomData() },\r\n                        { name: '广东', value: randomData() },\r\n                        { name: '青海', value: randomData() },\r\n                        { name: '西藏', value: randomData() },\r\n                        { name: '四川', value: randomData() },\r\n                        { name: '宁夏', value: randomData() },\r\n                        { name: '海南', value: randomData() },\r\n                        { name: '台湾', value: randomData() },\r\n                        { name: '香港', value: randomData() },\r\n                        { name: '澳门', value: randomData() }\r\n                    ]\r\n                }              \r\n                ,\r\n                {\r\n                    name: '其他',\r\n                    type: 'map',\r\n                    mapType: 'china',\r\n                    roam: true,\r\n                    // showLegendSymbol:false,\r\n                    label: {\r\n                        normal: {\r\n                            show: true\r\n                        },\r\n                        emphasis: {\r\n                            show: true\r\n                        }\r\n                    }\r\n                    ,\r\n                    data: [\r\n                         { name: '北京', value: randomData() },\r\n                        { name: '天津', value: randomData() },\r\n                        { name: '上海', value: randomData() },\r\n                        { name: '重庆', value: randomData() },\r\n                        { name: '河北', value: randomData() },\r\n                        { name: '河南', value: randomData() },\r\n                        { name: '云南', value: randomData() },\r\n                        { name: '辽宁', value: randomData() },\r\n                        { name: '黑龙江', value: randomData() },\r\n                        { name: '湖南', value: randomData() },\r\n                        { name: '安徽', value: randomData() },\r\n                        { name: '山东', value: randomData() },\r\n                        { name: '新疆', value: randomData() },\r\n                        { name: '江苏', value: randomData() },\r\n                        { name: '浙江', value: randomData() },\r\n                        { name: '江西', value: randomData() },\r\n                        { name: '湖北', value: randomData() },\r\n                        { name: '广西', value: randomData() },\r\n                        { name: '甘肃', value: randomData() },\r\n                        { name: '山西', value: randomData() },\r\n                        { name: '内蒙古', value: randomData() },\r\n                        { name: '陕西', value: randomData() },\r\n                        { name: '吉林', value: randomData() },\r\n                        { name: '福建', value: randomData() },\r\n                        { name: '贵州', value: randomData() },\r\n                        { name: '广东', value: randomData() },\r\n                        { name: '青海', value: randomData() },\r\n                        { name: '西藏', value: randomData() },\r\n                        { name: '四川', value: randomData() },\r\n                        { name: '宁夏', value: randomData() },\r\n                        { name: '海南', value: randomData() },\r\n                        { name: '台湾', value: randomData() },\r\n                        { name: '香港', value: randomData() },\r\n                        { name: '澳门', value: randomData() }\r\n                    ]\r\n                }\r\n                ,\r\n                {\r\n                    name: '二甲',\r\n                    type: 'map',\r\n                    mapType: 'china',\r\n                    roam: true,\r\n                    // showLegendSymbol:false,\r\n                    label: {\r\n                        normal: {\r\n                            show: true\r\n                        },\r\n                        emphasis: {\r\n                            show: true\r\n                        }\r\n                    }\r\n                    ,\r\n                    data: [\r\n                         { name: '北京', value: randomData() },\r\n                        { name: '天津', value: randomData() },\r\n                        { name: '上海', value: randomData() },\r\n                        { name: '重庆', value: randomData() },\r\n                        { name: '河北', value: randomData() },\r\n                        { name: '河南', value: randomData() },\r\n                        { name: '云南', value: randomData() },\r\n                        { name: '辽宁', value: randomData() },\r\n                        { name: '黑龙江', value: randomData() },\r\n                        { name: '湖南', value: randomData() },\r\n                        { name: '安徽', value: randomData() },\r\n                        { name: '山东', value: randomData() },\r\n                        { name: '新疆', value: randomData() },\r\n                        { name: '江苏', value: randomData() },\r\n                        { name: '浙江', value: randomData() },\r\n                        { name: '江西', value: randomData() },\r\n                        { name: '湖北', value: randomData() },\r\n                        { name: '广西', value: randomData() },\r\n                        { name: '甘肃', value: randomData() },\r\n                        { name: '山西', value: randomData() },\r\n                        { name: '内蒙古', value: randomData() },\r\n                        { name: '陕西', value: randomData() },\r\n                        { name: '吉林', value: randomData() },\r\n                        { name: '福建', value: randomData() },\r\n                        { name: '贵州', value: randomData() },\r\n                        { name: '广东', value: randomData() },\r\n                        { name: '青海', value: randomData() },\r\n                        { name: '西藏', value: randomData() },\r\n                        { name: '四川', value: randomData() },\r\n                        { name: '宁夏', value: randomData() },\r\n                        { name: '海南', value: randomData() },\r\n                        { name: '台湾', value: randomData() },\r\n                        { name: '香港', value: randomData() },\r\n                        { name: '澳门', value: randomData() }\r\n                    ]\r\n                }\r\n                ,\r\n                {\r\n                    name: '接入商数量',\r\n                    type: 'effectScatter',\r\n                    coordinateSystem: 'geo',\r\n                    data: convertData([\r\n                       \r\n                         { name: \"中山大学附属第一医院\", value: 1 }\r\n                        ,\r\n                        { name: \"中山大学肿瘤防治中心\", value: 1 }\r\n                        ,\r\n                        { name: \"西安交大一附院\", value: 2 }\r\n                         ,\r\n                        { name: \"辽宁省肿瘤医院\", value: 1 }\r\n                         ,\r\n                        { name: \"中国医科大学附属盛京医院\", value: 1 }\r\n                           ,\r\n                        { name: \"昆华医院\", value: 1 }\r\n          \r\n                    ]),\r\n                    symbolSize: function (val) {\r\n                        //return val[2] / 10;\r\n                        return val[2]*15 ;\r\n                    },\r\n                    showEffectOn: 'render',\r\n                    rippleEffect: {\r\n                        brushType: 'stroke'\r\n                    },\r\n                    label: {\r\n                        normal: {\r\n                            formatter: '{b}',\r\n                            position: 'right',\r\n                            show: false\r\n                        },\r\n                        emphasis: {\r\n                            show: true\r\n                        }\r\n                    },\r\n                \r\n                    itemStyle: {\r\n                        emphasis: {\r\n                           // borderColor: '#fff',\r\n                            borderWidth: 1\r\n                        }\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n        // 使用刚指定的配置项和数据显示图表。\r\n        myChart.setOption(option);\r\n    </script>\r\n\r\n```\r\n\r\n\r\n#### 其他信息 (Other comments)\r\n<!-- 例如，截图或线上实例 (JSFiddle/JSBin/Codepen) (For example: Screenshot or Online demo) -->\r\n\r\n"}}
{"actor":{"display_login":"rainryu"}}