Skip to content

Commit

Permalink
标准geoJson
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Dec 18, 2013
1 parent c2f771f commit 160c20c
Show file tree
Hide file tree
Showing 44 changed files with 438 additions and 68 deletions.
File renamed without changes.
File renamed without changes.
54 changes: 54 additions & 0 deletions doc/example/geoJson/USA.geo.json

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions doc/example/map4.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,34 @@
y:'bottom'
},
tooltip : {
trigger: 'item'
trigger: 'item',
formatter : function(a) {
var sName = a[0];
var pName = a[1];
var value = (a[2] + '').split('.');
value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,')
+ '.' + value[1];
return sName + '<br/>' + pName + ' : ' + value;
}
},
toolbox: {
show : true,
orient : 'vertical',
x: 'right',
y: 'center',
feature : {
mark : true,
dataView : {readOnly: false},
restore : true,
saveAsImage : true
}
},
dataRange: {
min: 0,
max: 1000000,
text:['High','Low'],
calculable : true,
color: ['red', 'yellow', 'lightgreen']
color: ['orangered','yellow','lightskyblue']
},
series : [
{
Expand Down
54 changes: 46 additions & 8 deletions doc/example/map6.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,67 @@
// 自定义扩展图表类型:mapType = HK
require('echarts/util/mapData/params').params.HK = {
getGeoJson: function(callback) {
$.getJSON('HK.geo.json',callback);
$.getJSON('geoJson/HK.geo.json',callback);
}
}
option = {
title : {
text : '香港地图',
subtext: '标准GeoJson地图类型扩展'
text : '香港18区人口密度 (2011)',
subtext: '人口密度数据来自Wikipedia',
sublink: 'http://zh.wikipedia.org/wiki/%E9%A6%99%E6%B8%AF%E8%A1%8C%E6%94%BF%E5%8D%80%E5%8A%83#cite_note-12'
},
tooltip : {
trigger: 'item',
formatter: '{b}'
formatter: '{b}<br/>{c} (p / km2)'
},
toolbox: {
show : true,
orient : 'vertical',
x: 'right',
y: 'center',
feature : {
mark : true,
dataView : {readOnly: false},
restore : true,
saveAsImage : true
}
},
dataRange: {
min: 800,
max: 50000,
text:['High','Low'],
calculable : true,
color: ['orangered','yellow','lightskyblue']
},
series : [
{
name: 'Hong Kong',
name: '香港18区人口密度',
type: 'map',
mapType: 'HK', // 自定义扩展图表类型
selectedMode : 'single',
itemStyle:{
normal:{label:{show:true}},
emphasis:{label:{show:true}}
},
data:[
{name: '中西区', value: 20057.34},
{name: '湾仔', value: 15477.48},
{name: '东区', value: 31686.1},
{name: '南区', value: 6992.6},
{name: '油尖旺', value: 44045.49},
{name: '深水埗', value: 40689.64},
{name: '九龙城', value: 37659.78},
{name: '黄大仙', value: 45180.97},
{name: '观塘', value: 55204.26},
{name: '葵青', value: 21900.9},
{name: '荃湾', value: 4918.26},
{name: '屯门', value: 5881.84},
{name: '元朗', value: 4178.01},
{name: '北区', value: 2227.92},
{name: '大埔', value: 2180.98},
{name: '沙田', value: 9172.94},
{name: '西贡', value: 3368},
{name: '离岛', value: 806.98}
],
// 自定义名称映射
nameMap: {
'Central and Western':'中西区',
Expand Down Expand Up @@ -124,8 +163,7 @@
// 文本直接经纬度定位
geoCoord : {
'Islands' : [113.95, 22.26]
},
data:[]
}
}
]
};
Expand Down
243 changes: 243 additions & 0 deletions doc/example/map7.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ECharts</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="[email protected]">

<script src="../asset/js/esl/esl.js"></script>
<script src="../asset/js/codemirror.js"></script>
<script src="../asset/js/javascript.js"></script>
<link href="../asset/css/bootstrap.css" rel="stylesheet">
<link href="../asset/css/bootstrap-responsive.css" rel="stylesheet">
<link href="../asset/css/codemirror.css" rel="stylesheet">
<link href="../asset/css/monokai.css" rel="stylesheet">
<link href="../asset/css/echartsHome.css" rel="stylesheet">
<link rel="shortcut icon" href="../asset/ico/favicon.png">
<style type="text/css">
.CodeMirror {
height: 550px;
}
</style>
</head>

<body>
<!-- NAVBAR
================================================== -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="../../index.html">ECharts</a>
<div class="nav-collapse collapse">
<a id="forkme_banner" href="https://github.com/ecomfe/echarts">View on GitHub</a>
<ul class="nav">
<li><a href="../../index.html"><i class="icon-home icon-white"></i> Home</a></li>
<li class="active"><a href="../example.html" class="active">Example</a></li>
<li><a href="../doc.html" >API &amp; Doc</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-download-alt icon-white"></i>Download <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a id="last-release-link" href=""> </a></li>
<li><a href="https://github.com/ecomfe/echarts/archive/master.zip">ZIP (Latest)</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/ecomfe" target="_blank">Ecom-FE</a></li>
<li><a href="http://fe.baidu.com/doc/ecom/tech/topic/dv/index.html" target="_blank">Data Visualization</a></li>
<li class="divider"></li>
<!--li class="nav-header">Library</li-->
<li><a href="http://ecomfe.github.io/zrender/index.html" target="_blank">ZRender</a></li>

</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar-inner -->
</div><!-- /.navbar-wrapper -->

<div class="container-fluid">
<div class="row-fluid">
<div id="sidebar-code" class="span4">
<div class="well sidebar-nav">
<div class="nav-header"><a href="#" onclick="autoResize()" class="icon-resize-full" id ="icon-resize" ></a>option</div>
<textarea id="code" name="code">
// 自定义扩展图表类型:mapType = USA
require('echarts/util/mapData/params').params.USA = {
getGeoJson: function(callback) {
$.getJSON('geoJson/usa.geo.json', callback);
},
specialArea : {
Alaska : {
left : -131,
top : 31,
width : 15,
height : 15
},
Hawaii : {
left : -112,
top : 29,
width : 5,
height : 5
},
'Puerto Rico' : {
left : -76,
top : 26,
width : 2,
height : 2
}
}
}
option = {
title : {
text: 'USA Population Estimates (2012)',
subtext: 'Data from www.census.gov.',
sublink: 'http://www.census.gov/popest/data/datasets.html',
x:'right'
},
tooltip : {
trigger: 'item',
showDelay: 0,
transitionDuration: 0.2,
formatter : function(a) {
var sName = a[0];
var pName = a[1];
var value = a[2] + '';
value = value.replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,');
return sName + '<br/>' + pName + ' : ' + value;
}
},
dataRange: {
x : 'right',
min: 500000,
max: 38000000,
color: ['orangered','yellow','lightskyblue'],
text:['High','Low'], // 文本,默认为数值文本
calculable : true
},
toolbox: {
show : true,
orient : 'vertical',
x: 'left',
y: 'center',
feature : {
mark : true,
dataView : {readOnly: false},
restore : true,
saveAsImage : true
}
},
series : [
{
name: 'USA PopEstimates',
type: 'map',
roam: true,
mapType: 'USA', // 自定义扩展图表类型
itemStyle:{
emphasis:{label:{show:true}}
},
// 文本位置修正
textFixed : {
Alaska : [20, -20]
},
data:[
{name : 'Alabama', value : 4822023},
{name : 'Alaska', value : 731449},
{name : 'Arizona', value : 6553255},
{name : 'Arkansas', value : 2949131},
{name : 'California', value : 38041430},
{name : 'Colorado', value : 5187582},
{name : 'Connecticut', value : 3590347},
{name : 'Delaware', value : 917092},
{name : 'District of Columbia', value : 632323},
{name : 'Florida', value : 19317568},
{name : 'Georgia', value : 9919945},
{name : 'Hawaii', value : 1392313},
{name : 'Idaho', value : 1595728},
{name : 'Illinois', value : 12875255},
{name : 'Indiana', value : 6537334},
{name : 'Iowa', value : 3074186},
{name : 'Kansas', value : 2885905},
{name : 'Kentucky', value : 4380415},
{name : 'Louisiana', value : 4601893},
{name : 'Maine', value : 1329192},
{name : 'Maryland', value : 5884563},
{name : 'Massachusetts', value : 6646144},
{name : 'Michigan', value : 9883360},
{name : 'Minnesota', value : 5379139},
{name : 'Mississippi', value : 2984926},
{name : 'Missouri', value : 6021988},
{name : 'Montana', value : 1005141},
{name : 'Nebraska', value : 1855525},
{name : 'Nevada', value : 2758931},
{name : 'New Hampshire', value : 1320718},
{name : 'New Jersey', value : 8864590},
{name : 'New Mexico', value : 2085538},
{name : 'New York', value : 19570261},
{name : 'North Carolina', value : 9752073},
{name : 'North Dakota', value : 699628},
{name : 'Ohio', value : 11544225},
{name : 'Oklahoma', value : 3814820},
{name : 'Oregon', value : 3899353},
{name : 'Pennsylvania', value : 12763536},
{name : 'Rhode Island', value : 1050292},
{name : 'South Carolina', value : 4723723},
{name : 'South Dakota', value : 833354},
{name : 'Tennessee', value : 6456243},
{name : 'Texas', value : 26059203},
{name : 'Utah', value : 2855287},
{name : 'Vermont', value : 626011},
{name : 'Virginia', value : 8185867},
{name : 'Washington', value : 6897012},
{name : 'West Virginia', value : 1855413},
{name : 'Wisconsin', value : 5726398},
{name : 'Wyoming', value : 576412},
{name : 'Puerto Rico', value : 3667084}
]
}
]
};
</textarea>
</div><!--/.well -->
</div><!--/span-->
<div id="graphic" class="span8">
<div id="main" class="main" style="height: 530px;"></div>
<div>
<button onclick="refresh(true)">Refresh ~</button>
<span id='wrong-message' style="color:red"></span>
</div>
</div><!--/span-->
</div><!--/row-->
<hr>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013 ECOM-FE &middot; <a href="https://github.com/ecomfe/echarts/blob/master/LICENSE.txt" target="_blank">Terms</a> &middot; <a href="../changelog.html" target="_blank">Changelog</a></p>
</footer>
</div><!--/.fluid-container-->

<script src="../asset/js/jquery.js"></script>
<script src="../asset/js/bootstrap-transition.js"></script>
<script src="../asset/js/bootstrap-alert.js"></script>
<script src="../asset/js/bootstrap-modal.js"></script>
<script src="../asset/js/bootstrap-dropdown.js"></script>
<script src="../asset/js/bootstrap-scrollspy.js"></script>
<script src="../asset/js/bootstrap-tab.js"></script>
<script src="../asset/js/bootstrap-tooltip.js"></script>
<script src="../asset/js/bootstrap-popover.js"></script>
<script src="../asset/js/bootstrap-button.js"></script>
<script src="../asset/js/bootstrap-collapse.js"></script>
<script src="../asset/js/bootstrap-carousel.js"></script>
<script src="../asset/js/bootstrap-typeahead.js"></script>
<script src="../asset/js/echartsExample.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/an_hui.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/ao_men.geo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","id":"8200","properties":{"name":"澳门","cp":[113.5715,22.1583],"childNum":1},"geometry":{"type":"Polygon","coordinates":[[[113.5978,22.1666],[113.6016,22.1573],[113.6052,22.1507],[113.6074,22.1463],[113.6088,22.1424],[113.6101,22.1373],[113.6103,22.1338],[113.61,22.1309],[113.6067,22.1252],[113.6043,22.1215],[113.6016,22.1183],[113.5976,22.1151],[113.5928,22.1117],[113.5876,22.1084],[113.5801,22.1047],[113.571,22.1024],[113.5598,22.1023],[113.5578,22.1035],[113.5552,22.1053],[113.5538,22.1099],[113.5528,22.1178],[113.5528,22.1202],[113.5531,22.1264],[113.5542,22.1367],[113.554,22.1414],[113.5525,22.1454],[113.5458,22.1529],[113.5379,22.1702],[113.537,22.1726],[113.5351,22.1753],[113.5336,22.1768],[113.5327,22.1784],[113.5332,22.1845],[113.5361,22.1903],[113.5379,22.1932],[113.5406,22.2004],[113.5408,22.2023],[113.5396,22.2032],[113.5392,22.2037],[113.5389,22.2063],[113.5382,22.2086],[113.5382,22.2092],[113.5384,22.2096],[113.5416,22.2107],[113.5435,22.2106],[113.5464,22.2099],[113.5483,22.2138],[113.5497,22.2144],[113.5531,22.2138],[113.555,22.2132],[113.5581,22.2126],[113.5628,22.212],[113.5677,22.2095],[113.5703,22.2073],[113.5749,22.2029],[113.5904,22.1827],[113.593,22.1786],[113.5978,22.1666]]]}}],"srcSize":{"left":283.5327,"top":67.7856,"width":0.0776,"height":0.1121}}
{"type":"FeatureCollection","features":[{"type":"Feature","id":"8200","properties":{"name":"澳门","cp":[113.5715,22.1583],"childNum":1},"geometry":{"type":"Polygon","coordinates":[[[113.5978,22.1666],[113.6016,22.1573],[113.6052,22.1507],[113.6074,22.1463],[113.6088,22.1424],[113.6101,22.1373],[113.6103,22.1338],[113.61,22.1309],[113.6067,22.1252],[113.6043,22.1215],[113.6016,22.1183],[113.5976,22.1151],[113.5928,22.1117],[113.5876,22.1084],[113.5801,22.1047],[113.571,22.1024],[113.5598,22.1023],[113.5578,22.1035],[113.5552,22.1053],[113.5538,22.1099],[113.5528,22.1178],[113.5528,22.1202],[113.5531,22.1264],[113.5542,22.1367],[113.554,22.1414],[113.5525,22.1454],[113.5458,22.1529],[113.5379,22.1702],[113.537,22.1726],[113.5351,22.1753],[113.5336,22.1768],[113.5327,22.1784],[113.5332,22.1845],[113.5361,22.1903],[113.5379,22.1932],[113.5406,22.2004],[113.5408,22.2023],[113.5396,22.2032],[113.5392,22.2037],[113.5389,22.2063],[113.5382,22.2086],[113.5382,22.2092],[113.5384,22.2096],[113.5416,22.2107],[113.5435,22.2106],[113.5464,22.2099],[113.5483,22.2138],[113.5497,22.2144],[113.5531,22.2138],[113.555,22.2132],[113.5581,22.2126],[113.5628,22.212],[113.5677,22.2095],[113.5703,22.2073],[113.5749,22.2029],[113.5904,22.1827],[113.593,22.1786],[113.5978,22.1666]]]}}]}
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/bei_jing.geo.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/util/mapData/rawData/geoJson/china.city.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/china.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/chong_qing.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/fu_jian.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/gan_su.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/guang_dong.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/guang_xi.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/gui_zhou.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/hai_nan.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/he_bei.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/he_nan.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/hei_long_jiang.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/hu_bei.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/hu_nan.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/ji_lin.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/jiang_su.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/jiang_xi.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/liao_ning.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/nei_meng_gu.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/ning_xia.geo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/qing_hai.geo.json
Diff not rendered.
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/shan_dong.geo.json
Diff not rendered.
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/shan_xi_1.geo.json
Diff not rendered.
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/shan_xi_2.geo.json
Diff not rendered.
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/shang_hai.geo.json
Diff not rendered.
2 changes: 1 addition & 1 deletion src/util/mapData/rawData/geoJson/si_chuan.geo.json
Diff not rendered.
Loading

0 comments on commit 160c20c

Please sign in to comment.