我正在尝试插入以下数据,但是我收到“ 2,docking station ...”行的语法错误
这是我遇到的错误,但是我以完全相同的方式输入了第1行。
JS:
if (CB == null || typeof (CB) != "object") {
var CB = new Object();
}
(function () {
//private var's and functions
function draw(id, json) {
document.getElementById('title').innerHTML = "World Map";
var width = 960,
height = 500;
var projection = d3.geo.robinson()
.scale(150)
//.translate(100,100)
.precision(.5);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("#" + id)
.attr("width", width)
.attr("height", height)
.attr("style", "background:" + json.bc);
// grid
var graticule = d3.geo.graticule()
.extent([[-180, -90], [180 - .1, 90 - .1]]);
svg.append("path")
.datum(graticule)
.attr("class", "graticule")
.attr("d", path);
//shape
d3.json("https://dl.dropboxusercontent.com/s/2qg71ltlq0hc88j/readme-world-110m.json", function (error, world) {
svg.selectAll(".countries")
.data(topojson.feature(world, world.objects.countries).features)
.enter()
.append("path")
.attr("style", "fill:#FEFEE4")
.attr("class", "country")
.attr("d", path)
.on("mouseover", function(d){
current_position = d3.mouse(this);
var tooltipDiv = document.getElementById('tooltip');
tooltipDiv.innerHTML = d.id;
tooltipDiv.style.top = current_position[1]+'px';
tooltipDiv.style.left = current_position[0]+'px';
tooltipDiv.style.display = "block";
d3.select(this).style("fill", "red");
})
.on("mouseout", function(d){
d3.select(this).style("fill", "white");
var tooltipDiv = document.getElementById('tooltip');
tooltipDiv.style.display = "none";
})
});
}
window.CB.geo = {
draw: draw
};
})();
Html:
<h1 id="title"></h1>
<div id="tooltip" style="display:none;position:absolute;z-index:1001;background-color:gray"></div>
<svg id="map_container"></svg>
<script>
// Json Datas
var json = {
};
CB.geo.draw("map_container", json);
</script>