ECharts 散点图 (微博签到点亮中国)本地实现,求教!!!
echarts吧
全部回复
仅看楼主
level 1
zwx81110572 楼主
想实现这样的效果,但是本地制作的时候,一直loading
这个是为什么呢,二楼贴程序
2016年10月31日 03点10分 1
level 1
zwx81110572 楼主
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--自适应device-width设备宽度-->
<meta http-equiv="viewport" content="width=device-width";>
<script type="text/javascript" src="js/china.js"></script>
<script type="text/javascript" src="js/echarts.min.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<title>ECharts</title>
<style>
</style>
</head>
<body>
<div id="center" style="width:2200px;height:1200px">
<script >
//初始化
var myChart = echarts.init(document.getElementById('center'));
myChart.showLoading();//加载数据前显示的动画效果
//读取微博JSON数据
$.getJSON('/json/weibo.json', function (weiboData) {
myChart.hideLoading();//加载数据完成后隐藏动画
//定义一个Data方法将读取的微博数据根据经纬度组合成新的JSON,用于显示
Data = function (index) {
data = weiboData[index];
var px = data[0] / 1000;
var py = data[1] / 1000;
var res = [[px, py]];
for (var i = 2; i < data.length; i += 2) {
var dx = data[i] / 1000;
var dy = data[i + 1] / 1000;
var x = px + dx;
var y = py + dy;
res.push([x, y, 1]);
px = x;
py = y;
}
return res;
};
//设置参数
myChart.setOption(
option = {
backgroundColor: '#404a59',
title: { //标题组件
text: '微博签到数据点亮中国',
subtext: 'From ThinkGIS',
sublink: 'http://www.thinkgis.cn/public/sina',
left: 'center',
top: 'top',
textStyle: {
color: '#fff'
}
},
legend: { //图例组件
left: 'left',
data: ['强', '中', '弱'],
textStyle: {
color: '#ccc'
}
},
geo: { //地理坐标系组件
name: '强',
type: 'scatter',
map: 'china',
label: {
emphasis: {
show: false
}
},
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#111'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: [{ //系列列表
name: '弱',
type: 'scatter',
coordinateSystem: 'geo',
symbolSize: 1,
large: true,
itemStyle: {
normal: {
shadowBlur: 2,
shadowColor: 'rgba(37, 140, 249, 0.8)',
color: 'rgba(37, 140, 249, 0.8)'
}
},
data: Data(0)
}, {
name: '中',
type: 'scatter',
coordinateSystem: 'geo',
symbolSize: 1,
large: true,
itemStyle: {
normal: {
shadowBlur: 2,
shadowColor: 'rgba(14, 241, 242, 0.8)',
color: 'rgba(14, 241, 242, 0.8)'
}
},
data: Data(1)
}, {
name: '强',
type: 'scatter',
coordinateSystem: 'geo',
symbolSize: 1,
large: true,
itemStyle: {
normal: {
shadowBlur: 2,
shadowColor: 'rgba(255, 255, 255, 0.8)',
color: 'rgba(255, 255, 255, 0.8)'
}
},
data: Data(2)
}]
});
myChart.setOption(option);
});
</script>
</div>
</body>
</html>
2016年10月31日 03点10分 2
level 1
zwx81110572 楼主
这程序就是ECharts上的一样的,就是本地显示却一直卡在loading
2016年10月31日 06点10分 3
level 1
zwx81110572 楼主
求求大神看一下
2016年11月03日 01点11分 4
level 1
jquery.js和china.js有没有引用进来?
2017年01月09日 02点01分 6
level 1
我是地图能显示 但是那个亮点不行 求指教
2017年02月07日 02点02分 7
大哥 能发我一下 地图吗感激不尽 [email protected]
2017年11月04日 09点11分
level 1
这个本地显示不了,它会报错说你跨域了。。。
2017年02月07日 08点02分 8
level 1
楼主,求教,和你一样的问题,我也是一直卡在loading,请问是怎么解决的
2017年05月18日 00点05分 10
还需要引入 bmap 插件
2017年06月24日 03点06分
level 1
myChart.hideLoading();
2017年06月26日 02点06分 12
level 1
F12 查看报错,还有你导入的js顺序有问题,"js/jquery.js"要导入在依赖这个js的前面。
2017年07月27日 16点07分 13
level 1
因为第三十行
$.getJSON('/json/weibo.json', function(weiboData) {}
是在weibo.json中获取数据 但是你并没有这个json文件 所以不能点亮图标 (并且你不知道这个json格式)
可以采取下面的方式自己手动添加亮点
2017年08月01日 01点08分 14
请问怎么手动添加亮点?
2017年10月10日 08点10分
level 1
把myChart.showLoading();和myChart.hideLoading();注释掉即可
2017年08月01日 01点08分 15
level 1
你好~~问题解决了吗?我现在也碰到这个问题,还想请教一下,谢谢
2017年08月30日 07点08分 16
level 1
获取不到微博的json数据
2017年12月19日 08点12分 17
1