これは以下の私のコードです。何らかの理由で、適切にレンダリングされる唯一のスタイルは、ストローク (白) と不透明度 (0.4 に設定) です。ただし、グラデーションが読み込まれないようです。代わりに、それはすべて赤です。どうしてこれなの?
<html>
<head>
<meta charset="UTF-8">
<title>Customizing Fusion Tables map using Fusion Tables' Javascript API</title>
<style type="text/css">
#map-canvas {
height: 800px;
width: 800px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <!-- Google Maps API -->
<script type="text/javascript">
var locationColumn = "geometry";
var tableId = "1FbzvoRkdJzXvIxMJg2mGYVz5Q1BW2-4feMolgVc"; // California Census Tracts FT
var condition = "'Median income (dollars)'>0";
var mapOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP
};
function initialize() {
var geocoder = new google.maps.Geocoder();
var gmap = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
var layer = new google.maps.FusionTablesLayer({
query: {
select: locationColumn,
from: tableId,
where: condition
},
styles: [
{
polygonOptions: {
strokeColor: "#ffffff",
strokeOpacity: 0.4,
strokeWeight: 1,
fillColorStyler: {
kind: "fusiontables#gradient",
columnName: "Median income (dollars)",
gradient: {
min: 28183.65,
max: 122762.9,
colors: [
{
color:"#990000",
opacity:0.4
},
{
color:"ffd966",
opacity:0.4
},
{
color:"#274e13",
opacity:0.4
}
]
}
}
}
}
]
});
geocoder.geocode(
{
'address':'California'
},
function(results,status){
var sw = results[0].geometry.viewport.getSouthWest();
var ne = results[0].geometry.viewport.getNorthEast();
var bounds = new google.maps.LatLngBounds(sw,ne);
gmap.fitBounds(bounds)
}
);
layer.setMap(gmap);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>