百度Echart 地图
生活随笔
收集整理的這篇文章主要介紹了
百度Echart 地图
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用百度地圖做一個全國地圖數據分析的功能,如下圖
代碼
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EchartMap.aspx.cs" Inherits="Demo.EchartMap" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"><title></title><script src="Script/jquery/jquery-1.10.1.min.js" type="text/javascript"></script> </head> <body><form id="frmEchartMap" runat="server"><div id="mainChart" style="width: 100%; height: 500px; margin-top: 20px;"></div></form><script src="Script/echarts/echarts.min.js" type="text/javascript"></script><script src="Script/echarts/china.js" type="text/javascript"></script><script src="Script/1.9.3/layer.js" type="text/javascript"></script><script type="text/javascript">var myChart = echarts.init(document.getElementById('mainChart'));option = {title: {text: '訂單量',subtext: '純屬虛構',x: 'center'},tooltip: {trigger: 'item'},legend: {orient: 'vertical',x: 'left',data: ['訂單量']},dataRange:{x: 'left',y: 'bottom',splitList:[{ start: 900, end: 1500 },{ start: 310, end: 1000 },{ start: 200, end: 300 },{ end: 10 },{ start: 10, end: 200, label: '10 到 200(自定義label)' },{ start: 5, end: 5, label: '5(自定義特殊顏色)', color: 'black' },{ start: 1500 }],color: ['#E0022B', '#E09107', '#A3E00B']},toolbox: {show: true,orient: 'vertical',x: 'right',y: 'center',feature: {mark: { show: true },dataView: { show: true, readOnly: false },restore: { show: true },saveAsImage: { show: true }}},roamController: {show: true,x: 'right',mapTypeControl: {'china': true}},series:[{name: '訂單量',type: 'map',mapType: 'china',roam: false,itemStyle: {normal: {label: {show: true,textStyle: {color: "#080808"}},areaColor: "#EDEDED"},emphasis:{label: { show: true }}},showLegendSymbol: false, //去掉地圖的上標志點 data: [{ name: '北京', value: Math.round(Math.random() * 2000) },{ name: '天津', value: Math.round(Math.random() * 2000) },{ name: '上海', value: Math.round(Math.random() * 2000) },{ name: '重慶', value: Math.round(Math.random() * 2000) },{ name: '河北', value: 0 },{ name: '河南', value: Math.round(Math.random() * 2000) },{ name: '云南', value: 5 },{ name: '遼寧', value: 305 },{ name: '黑龍江', value: Math.round(Math.random() * 2000) },{ name: '湖南', value: 200 },{ name: '安徽', value: Math.round(Math.random() * 2000) },{ name: '山東', value: Math.round(Math.random() * 2000) },{ name: '新疆', value: Math.round(Math.random() * 2000) },{ name: '江蘇', value: Math.round(Math.random() * 2000) },{ name: '浙江', value: Math.round(Math.random() * 2000) },{ name: '江西', value: Math.round(Math.random() * 2000) },{ name: '湖北', value: Math.round(Math.random() * 2000) },{ name: '廣西', value: Math.round(Math.random() * 2000) },{ name: '甘肅', value: Math.round(Math.random() * 2000) },{ name: '山西', value: Math.round(Math.random() * 2000) },{ name: '內蒙古', value: Math.round(Math.random() * 2000) },{ name: '陜西', value: Math.round(Math.random() * 2000) },{ name: '吉林', value: Math.round(Math.random() * 2000) },{ name: '福建', value: Math.round(Math.random() * 2000) },{ name: '貴州', value: Math.round(Math.random() * 2000) },{ name: '廣東', value: Math.round(Math.random() * 2000) },{ name: '青海', value: Math.round(Math.random() * 2000) },{ name: '西藏', value: Math.round(Math.random() * 2000) },{ name: '四川', value: Math.round(Math.random() * 2000) },{ name: '寧夏', value: Math.round(Math.random() * 2000) },{ name: '海南', value: Math.round(Math.random() * 2000) },{ name: '臺灣', value: Math.round(Math.random() * 2000) },{ name: '香港', value: Math.round(Math.random() * 2000) },{ name: '澳門', value: Math.round(Math.random() * 2000) }]}]};myChart.on("click", function (param) {var selected = param.data;//如果出現亂碼可以使用escape、encodeURI、encodeURIComponent() 等方法轉碼,解碼使用對應的unescape、decodeURI、decodeURIComponentlayer_show_wh("訂單查看", "ParMap.aspx?pName=" + selected['name'], "800px", "900px");myChart.setOption(option);//window.location.href = encodeURI("ParMap.aspx?pName=" + escape(selected['name'])); })// 使用剛指定的配置項和數據顯示圖表。 myChart.setOption(option);function layer_show_wh(title, url, w, h) {if (title == null || title == '') {title = false;};if (url == null || url == '') {url = "/manage/404.html";};if (w == null || w == '') {w = 800;};if (h == null || h == '') {h = ($(window).height() - 50);};layer.open({type: 2,area: [w, h],fix: false, //不固定maxmin: true,shade: 0.4,title: title,content: url});}</script> </body> </html> View Code <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ParMap.aspx.cs" Inherits="Demo.ParMap" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"><title></title> </head> <body><form id="form1" runat="server"><div id="mainChart" style="width: 100%; height: 500px; margin-top: 20px;"></div></form><script src="Script/jquery/jquery-1.10.1.min.js" type="text/javascript"></script><script src="Script/echarts/echarts.min.js" type="text/javascript"></script><script type="text/javascript">var myChart = echarts.init(document.getElementById('mainChart'));window.onload = function () {var mapHash = { "河北": "hebei", "山西": "shanxi", "內蒙古": "neimenggu", "遼寧": "liaoning", "吉林": "jilin", "黑龍江": "heilongjiang", "江蘇": "jiangsu", "浙江": "zhejiang", "安徽": "anhui", "福建": "fujian", "江西": "jiangxi", "山東": "shandong", "河南": "henan", "湖北": "hubei", "湖南": "hunan", "廣東": "guangdong", "廣西": "guangxi", "海南": "hainan", "四川": "sichuan", "貴州": "guizhou", "云南": "yunnan", "西藏": "xizang", "陜西": "shanxi1", "甘肅": "gansu", "青海": "qinghai", "寧夏": "ningxia", "新疆": "xinjiang", "北京": "beijing", "天津": "tianjin", "上海": "shanghai", "重慶": "chongqing", "香港": "xianggang", "澳門": "aomen", "臺灣": "taiwan" };var pName = GetQueryString("pName");showProvince(mapHash[pName]);};function GetQueryString(name) {var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");var url = decodeURI(window.location.search);var r = url.substr(1).match(reg);if (r != null) return unescape(r[2]); return null;}function showProvince(name) {$.get('/Script/echarts/mapdata/' + name + '.json', function (geoJson) {echarts.registerMap(name, geoJson);myChart.setOption(option = {//backgroundColor: '#404a59', tooltip: {trigger: 'item'},title: {left: 'center',textStyle: {color: '#fff'}},legend: {x: 'right',data: ['訂單數據']},dataRange:{orient: 'horizontal',x: 'right',min: 0,max: 1000,color: ['orange', 'yellow'],text: ['高', '低'], // 文本,默認為數值文本splitNumber: 0},series: [{name: '訂單數據',type: 'map',mapType: name,label: {emphasis: {textStyle: {color: '#fff'}}},itemStyle: {normal: {borderColor: '#389BB7',areaColor: '#fff',label: { show: true }},emphasis: {areaColor: '#389BB7',borderWidth: 0,label: { show: true }}},showLegendSymbol: false, //去掉地圖的上標志點animation: false,roam: true,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: '香港', 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) },{ 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) }]}]});});}</script> </body> </html> View Code注:全國省份的數據不要帶市、省、自治區等
如果彈出框出現亂碼可以使用escape、encodeURI、encodeURIComponent() 等方法轉碼
?
js對文字進行編碼涉及3個函數:escape,encodeURI,encodeURIComponent,相應3個解碼函數:unescape,decodeURI,decodeURIComponent1、???傳遞參數時需要使用encodeURIComponent,這樣組合的url才不會被#等特殊字符截斷。????????????????????????????
例如:<script language="javascript">document.write('<a href="http://passport.baidu.com/?logout&aid=7&u= +encodeURIComponent("http://cang.baidu.com/bruce42")+">退出</a>');</script>
2、???進行url跳轉時可以整體使用encodeURI
例如:Location.href=encodeURI("http://cang.baidu.com/do/s?word=百度&ct=21");
3、???js使用數據時可以使用escape
例如:搜藏中history紀錄。
4、???escape對0-255以外的unicode值進行編碼時輸出%u****格式,其它情況下escape,encodeURI,encodeURIComponent編碼結果相同。
最多使用的應為encodeURIComponent,它是將中文、韓文等特殊字符轉換成utf-8格式的url編碼,所以如果給后臺傳遞參數需要使用encodeURIComponent時需要后臺解碼對utf-8支持(form中的編碼方式和當前頁面編碼方式相同)
escape不編碼字符有69個:*,+,-,.,/,@,_,0-9,a-z,A-Z
encodeURI不編碼字符有82個:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z
encodeURIComponent不編碼字符有71個:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z 參考http://blog.csdn.net/bingle14/article/details/53941727
?
轉載于:https://www.cnblogs.com/ZJ199012/p/7356753.html
總結
以上是生活随笔為你收集整理的百度Echart 地图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Chromium相关产品
- 下一篇: 9号天气