我的ammap对我的尼日利亚地图不起作用

时间:2015-09-17 14:05:15

标签: javascript amcharts ammap

我目前正在从amCharts处理尼日利亚地图,我希望地图能够从外部源读取.json是现在唯一的格式。我使用SharePoint 2010作为我的服务器并且它不允许我复制.json文件,所以我决定以JSON方式存储我的数据,但是在文本文件(.txt)中。 amCharts文档附带的示例(美国)运行良好。但是当我将数据和脚本更改为尼日利亚地图时,它并不起作用。如果你可以解雇我。以下是我的代码示例:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
 "http://www.w3.org/TR/html4/strict.dtd">
  <html xmlns:mso="urn:schemas-microsoft-com:office:office"
  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="http://www.amcharts.com/lib/3/ammap.css" type="text/css">
<script src="http://www.amcharts.com/lib/3/ammap.js"></script>
<script src="http://www.amcharts.com/lib/3/maps/js/nigeriaLow.js"></script>
<script src="../dataloader.min.js"></script>
<style>
 body, html {
  font-family: Verdana;
  font-size: 12px;
}
#chartdiv {
  width: 100%;
  height: 500px;
}
</style>
<script>
  var map = AmCharts.makeChart("chartdiv", {
    type: "map",
    "dataLoader": {
      "url": "data/globalrepresentation.txt",
      "showErrors": false
    },
    "colorSteps": 10,
    "areasSettings": {
      "autoZoom": true
    },
    "smallMap": {},
    "valueLegend": {
      "right": 10,
      "minValue": "little",
      "maxValue": "a lot!"
    },
    "responsive": {
      "enabled": true
    }
  });
</script>
</head>
<body>
<div id="chartdiv"></div>
</body>

</html>

附加的外部文件是

=============================================== =========================

{
"map": "nigeriaLow",
"areas"=[{
 { "id":"NG-AB",
 "value": 4447100
 },{ 
 "id":"NG-AD", 
 "value": 4447100
 },{
 "id":"NG-AK", 
 "value": 4447100
 },{
 "id":"NG-AN", 
 "value": 4447100
 },{
 "id":"NG-BA", 
 "value": 4447100
 },{
 "id":"NG-BE", 
 "value": 4447100
 },{
 "id":"NG-BO", 
 "value": 4447100
 },{
"id":"NG-BY", 
 "value": 4447100
 },{
  "id":"NG-CR", 
 "value": 4447100
 },{
 "id":"NG-DE", 
 "value": 4447100
 },{
 "id":"NG-EB", 
 "value": 4447100
 },{
 "id":"NG-ED", 
 "value": 4447100
 },{
 "id":"NG-EK", 
 "value": 4447100
 },{
 "id":"NG-EN", 
 "value": 4447100
 },{
 "id":"NG-FC", 
 "value": 4447100
 },{
 "id":"NG-GO", 
 "value": 4447100
 },{
"id":"NG-IM", 
 "value": 4447100
 },{
 "id":"NG-JI", 
 "value": 4447100
 },{
 "id":"NG-KD", 
 "value": 4447100
 },{
 "id":"NG-KE", 
 "value": 4447100
 },{
 "id":"NG-KN", 
 "value": 4447100
 },{
 "id":"NG-KO", 
 "value": 4447100
 },{
"id":"NG-KT", 
 "value": 4447100
 },{
"id":"NG-KW", 
 "value": 4447100
 },{
 "id":"NG-LA", 
 "value": 4447100
 },{
 "id":"NG-NA", 
 "value": 4447100
 },{
 "id":"NG-NI", 
 "value": 4447100
 },{
"id":"NG-OG", 
 "value": 4447100
 },{
 "id":"NG-ON", 
 "value": 4447100
 },{
 "id":"NG-OS", 
 "value": 4447100
 },{
 "id":"NG-OY", 
 "value": 4447100
 },{
 "id":"NG-PL",
 "value": 4447100
 },{
 "id":"NG-RI",
 "value": 4447100
 },{
 "id":"NG-SO", 
 "value": 4447100
 },{
"id":"NG-TA", 
 "value": 4447100
 },{
 "id":"NG-YO", 
 "value": 4447100
 },{
 "id":"NG-ZA", 
 "value": 4447100

}]
}

0 个答案:

没有答案