如上效果图:

以下未代码:

<!doctype html>
<html lang="en">
 
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="format-detection" content="telephone=no">
<title>ECharts地图选择器</title>
<script src="../../static/awareness_day/js/jquery.min.js"></script>
</head>
 
<body>
 
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="height:26rem"></div>
<script src="../../static/awareness_day/js/echarts.js"></script>
 
<script type="text/javascript">
// 路径配置
require.config({
paths: {
echarts: 'http://echarts.baidu.com/build/dist'
}
});
// 使用
require(
[
'echarts',
'echarts/chart/map' // 使用柱状图就加载bar模块,按需加载
],
function(ec) {
var myChart = ec.init(document.getElementById('main'));
// 过渡---------------------
// myChart.showLoading({
// text: '正在努力的读取数据中...',
// effect: 'whirling'
// });
 
// ajax getting data...............
 
 
var colorbg;
var selected;
 
var option = {
backgroundColor: '#000',
borderWidth: 10,
borderColor: '#ffffff',
dataRange: {
min: 0,
max: 1000,
color: ['rgba(255,222,0,1)', 'rgba(110,0,0,1)'],
text: ['高', '低'],
splitNumber: 0,
calculable: false,
show: false,
},
series: [{
 
name: 'Map',
type: 'map',
mapLocation: {
x: '4%',
y: '8%',
height: 400
},
selectedMode: 'multiple',
itemStyle: {
normal: {
borderWidth: 1,
borderColor: '#9c1a1a',
color: '#6e0000',
label: {
show: false
 
}
},
emphasis: { // 也是选中样式
borderWidth: 1,
borderColor: '#a95901',
color: colorbg,
label: {
show: false,
textStyle: {
color: '#fff'
}
}
},
},
 
data: [{
name: '海南',
value: Math.round(Math.random() * 1000)
},
{
name: '广东',
value: Math.round(Math.random() * 1000)
},
{
name: '广西',
value: Math.round(Math.random() * 1000)
},
{
name: '福建',
value: Math.round(Math.random() * 1000)
},
// {
// name: '甘肃',
// selected: false
// },
{
name: '江西',
value: Math.round(Math.random() * 1000)
},
{
name: '湖南',
value: Math.round(Math.random() * 1000)
},
{
name: '浙江',
value: Math.round(Math.random() * 1000)
},
{
name: '贵州',
value: Math.round(Math.random() * 1000)
},
{
name: '云南',
value: Math.round(Math.random() * 1000)
},
{
name: '上海',
value: Math.round(Math.random() * 1000)
},
{
name: '江苏',
value: Math.round(Math.random() * 1000)
},
{
name: '安徽',
value: Math.round(Math.random() * 1000)
},
{
name: '湖北',
value: Math.round(Math.random() * 1000)
},
{
name: '重庆',
value: Math.round(Math.random() * 1000)
},
{
name: '四川',
value: Math.round(Math.random() * 1000)
},
{
name: '河南',
value: Math.round(Math.random() * 1000)
},
{
name: '山东',
value: Math.round(Math.random() * 1000)
},
{
name: '天津',
value: Math.round(Math.random() * 1000)
},
{
name: '河北',
value: Math.round(Math.random() * 1000)
},
{
name: '山西',
value: Math.round(Math.random() * 1000)
},
{
name: '北京',
value: Math.round(Math.random() * 1000)
},
{
name: '辽宁',
value: Math.round(Math.random() * 1000)
},
{
name: '吉林',
value: Math.round(Math.random() * 1000)
},
{
name: '黑龙江',
value: Math.round(Math.random() * 1000)
},
{
name: '内蒙古',
value: Math.round(Math.random() * 1000)
},
{
name: '陕西',
value: Math.round(Math.random() * 1000)
},
{
name: '宁夏',
value: Math.round(Math.random() * 1000)
},
{
name: '青海',
value: Math.round(Math.random() * 1000)
},
{
name: '甘肃',
value: Math.round(Math.random() * 1000)
},
{
name: '新疆',
value: Math.round(Math.random() * 1000)
},
{
name: '西藏',
value: Math.round(Math.random() * 1000)
},
{
name: '香港',
value: Math.round(Math.random() * 1000)
},
{
name: '澳门',
value: Math.round(Math.random() * 1000)
},
{
name: '台湾',
value: Math.round(Math.random() * 1000)
},
{
name: '南海诸岛',
value: Math.round(Math.random() * 1000)
},
],
},
 
]
};
// 为echarts对象加载数据
myChart.setOption(option);
}
);
</script>
 
</body>
 
</html>

最新文章

  1. [LeetCode] Customers Who Never Order 从未下单订购的顾客
  2. YII2学习第一天
  3. Linux/Unix里,ln -s
  4. SqlServer——阻止保存要求重新创建表的更改
  5. [分词] C#SegList分词辅助类,帮助类 (转载)
  6. Catharanthus roseus(长春花碱)的生物合成
  7. Object-c中@private、@protected、@public解析
  8. 网页插入QQ 无需加好友
  9. Spring写第一个应用程序
  10. 扩展 lua require 的行为
  11. mysql2 - 基础
  12. Java两种方法实现循环报数
  13. 两道面试题,带你解析Java类加载机制
  14. Xeon Phi 《协处理器高性能编程指南》随书代码整理 part 2
  15. springboot + @KafkaListener 手动提交及消费能力优化
  16. IBM研究院找到度量安全性方法:容器与虚拟机,谁更安全?
  17. CentOS6.4挂载读写NTFS分区 (重要)
  18. 51nod1693
  19. Java学习笔记XML(3)
  20. QT学习之窗口部件

热门文章

  1. 洛谷 P3235 [HNOI2014]江南乐 解题报告
  2. P3320 [SDOI2015]寻宝游戏 解题报告
  3. linux内核分析 第七周读书笔记
  4. java多线程 --ConcurrentLinkedQueue 非阻塞 线程安全队列
  5. 解题:POI 2012 Well
  6. IDA error of &quot; positive sp value has been found&quot;
  7. CentOS 6.6下配置本地yum源与网络yum源
  8. centos install python3 pip3
  9. 利用ansible来做tomcat应用的持续交付
  10. Azure 上SQL Database(PaaS)Time Zone时区问题处理(进阶篇)