我是Js的初学者,我正在尝试使用D3.js 更改其ID 的特定国家/地区(函数colorCountry)的颜色.但是,我选择的颜色并不重要.结果将始终显示以橙色突出显示的地图.我该怎么做才能解决这个问题?
我的代码如下.
谢谢.
json文件可以在这里下载 - https://gist.githubusercontent.com/d3noob/5193723/raw/6e1434b2c2de24aedde9bcfe35f6a267bd2c04f5/world-110m2.json
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #fcfcfa;
}
.stroke {
fill: none;
stroke: #000;
stroke-width: 3px;
}
.fill {
fill: #fff;
}
.graticule {
fill: none;
stroke: #777;
stroke-width: .5px;
stroke-opacity: .5;
}
.land {
fill: #888;
}
.boundary {
fill: none;
stroke: #fff;
stroke-width: .5px;
}
</style>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>
var countryCode = 840; //36: AUSTRALIA * 643: RUSSIA * 76: BRAZIL * …Run Code Online (Sandbox Code Playgroud)