echarts icon indicating copy to clipboard operation
echarts copied to clipboard

echarts3 如何在地图上 添加。markPoint ,

Open chm74 opened this issue 10 years ago • 8 comments

问题简述 (One-line summary)

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version):

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)

目前只引入了,echarts.min.js ,加入markPoint之后,会报错,提示 i.getOtherAxis is not a function,是还需要引入其他的js吗,还是需要和它一块在配置什么属性。

ECharts配置项 (ECharts option)

option = {

}

其他信息 (Other comments)

chm74 avatar Apr 21 '16 06:04 chm74

请发下具体的配置项

pissang avatar Apr 22 '16 02:04 pissang

option = {
    title: {
        text: 'World Population (2010)',
        subtext: 'from United Nations, Total population, both sexes combined, as of 1 July (thousands)',
        sublink: 'http://esa.un.org/wpp/Excel-Data/population.htm',
        left: 'center',
        top: 'top'
    },
    tooltip: {
        trigger: 'item',
        formatter: function (params) {
            var value = (params.value + '').split('.');
            value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,')
                    + '.' + value[1];
            return params.seriesName + '<br/>' + params.name + ' : ' + value;
        }
    },
    toolbox: {
        show: true,
        orient: 'vertical',
        left: 'right',
        top: 'center',
        feature: {
            dataView: {readOnly: false},
            restore: {},
            saveAsImage: {}
        }
    },
    visualMap: {
        min: 0,
        max: 1000000,
        text:['High','Low'],
        realtime: false,
        calculable: true,
        color: ['orangered','yellow','lightskyblue']
    },
    series: [
        {
            name: 'World Population (2010)',
            type: 'map',
            mapType: 'world',
            roam: true,
            itemStyle:{
                emphasis:{label:{show:true}}
            },
            data:[
                {name: 'Honduras', value: 7621.204},
                {name: 'China', value: 1644338.027}

            ],
            markPoint : {
                symbol:'emptyCircle',
                symbolSize : function (v){
                    return 10 + v/10
                },
                effect : {
                    show: true,
                    shadowBlur : 0
                },
                itemStyle:{
                    normal:{
                        label:{show:false}
                    }
                },
                data : [
                    {name:'上海',value:95},
                    {name:'广州',value:90},
                    {name:'大连',value:80},
                    {name:'南宁',value:70},
                    {name:'南昌',value:60},
                    {name:'拉萨',value:50},
                    {name:'长春',value:40},
                    {name:'包头',value:30},
                    {name:'重庆',value:20},
                    {name:'常州',value:10}
                ]
            }
        }
    ]
};

chm74 avatar Apr 22 '16 05:04 chm74

你看一你,是我哪里没有配置好吗,3q

chm74 avatar Apr 22 '16 05:04 chm74

3.0 中的 data 不支持 name 指定 markPoint 的位置,需要得到经纬度通过 coord 指定

pissang avatar Apr 22 '16 05:04 pissang

有小Demo吗,3q。

chm74 avatar Apr 22 '16 05:04 chm74

例如:

data: [{
  name: '上海',
  // 上海的经纬度
  coord: [121.48, 31.22]
}]

pissang avatar Apr 22 '16 06:04 pissang

option = {
    title: {
        text: 'World Population (2010)',
        subtext: 'from United Nations, Total population, both sexes combined, as of 1 July (thousands)',
        sublink: 'http://esa.un.org/wpp/Excel-Data/population.htm',
        left: 'center',
        top: 'top'
    },
    tooltip: {
        trigger: 'item',
        formatter: function (params) {
            var value = (params.value + '').split('.');
            value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,')
                    + '.' + value[1];
            return params.seriesName + '<br/>' + params.name + ' : ' + value;
        }
    },
    toolbox: {
        show: true,
        orient: 'vertical',
        left: 'right',
        top: 'center',
        feature: {
            dataView: {readOnly: false},
            restore: {},
            saveAsImage: {}
        }
    },
    visualMap: {
        min: 0,
        max: 1000000,
        text:['High','Low'],
        realtime: false,
        calculable: true,
        color: ['orangered','yellow','lightskyblue']
    },
    series: [
        {
            name: 'World Population (2010)',
            type: 'map',
            mapType: 'world',
            roam: true,
            itemStyle:{
                emphasis:{label:{show:true}}
            },
            data:[
                {name: 'Honduras', value: 7621.204},
                {name: 'China', value: 1644338.027}

            ],
            markPoint : {
                symbol:'emptyCircle',
                symbolSize : function (v){
                    return 10 + v/10
                },
                effect : {
                    show: true,
                    shadowBlur : 0
                },
                itemStyle:{
                    normal:{
                        label:{show:false}
                    }
                },
                data:[
                {name: "上海",coord: [121.48, 31.22]},
                {name: "合肥", coord: [117.27,31.86]},
                {name: "武汉", coord: [114.31,30.52]},
                {name: "大庆", coord: [125.03,46.58]}
            ],
            }
        }
    ]
};

chm74 avatar Apr 22 '16 06:04 chm74

echarts3 可以实现echarts2 的闪动效果么?http://echarts.baidu.com/echarts2/doc/example/map15.html

xwsg avatar Sep 19 '16 02:09 xwsg