我在我的網頁中有熱圖。它工作正常,但我必須刷新整個頁面才能獲取新值。刪除熱圖更新
我現在正在更改它,每5秒獲取一個值並繪製新值。
也工作正常。但我認爲新的價值觀正在被繪製在舊的價值觀上,因爲我每5秒鐘就會得到一個更明亮的噪音點。
如何刪除塗色值並繪製新值?
function initialize() {
mapOptions = {
zoom: 16,
center: new google.maps.LatLng(lat, lon),
mapTypeId: google.maps.MapTypeId.SATELLITE
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
initValues();
}
function initValues(){
pointArray = new google.maps.MVCArray(taxiData);
heatmap = new google.maps.visualization.HeatmapLayer({
data: pointArray
});
heatmap.setOptions({radius: 40});
heatmap.setMap(map);
}
在taxiData中我每次調用initValues函數都有更新的值。我調用一次初始化,然後每5秒更新一次taxiData並調用initValues。