Skip to content

Commit

Permalink
WeightedLocation heatmap does not render #166
Browse files Browse the repository at this point in the history
  • Loading branch information
valentasm committed Dec 15, 2021
1 parent 0fcce69 commit 10b865a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GoogleMapsComponents/GoogleMapsComponents.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<RazorLangVersion>3.0</RazorLangVersion>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<PackageId>BlazorGoogleMaps</PackageId>
<Version>1.4.1</Version>
<Version>1.4.2</Version>
<Authors>Rungwiroon</Authors>
<Company>QueueStack Solution</Company>
<Product>BlazorGoogleMaps</Product>
Expand Down
10 changes: 9 additions & 1 deletion GoogleMapsComponents/wwwroot/js/objectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,15 @@ window.googleMapsObjectManager = {
else if (functionToInvoke == "setData") {
var pointArray = new google.maps.MVCArray();
for (i = 0; i < args2[0].length; i++) {
pointArray.push(new google.maps.LatLng(args2[0][i].lat, args2[0][i].lng))
var cord = args2[0][i];

if (cord.hasOwnProperty("weight")) {
var cordLocation = new google.maps.LatLng(cord.location.lat, cord.location.lng);
var location = { location: cordLocation, weight: cord.weight };
pointArray.push(location);
} else {
pointArray.push(new google.maps.LatLng(cord.lat, cord.lng));
}
}

try {
Expand Down
8 changes: 7 additions & 1 deletion ServerSideDemo/Pages/MapHeatMapPage.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ private async Task AddHeatMap()
},
};

await heatMap.SetData(heatPoints);
var hwp = new List<WeightedLocation>();
hwp.Add(new WeightedLocation { Location = new LatLngLiteral { Lat = 13.505892, Lng = 100.8142 }, Weight = 3 });
hwp.Add(new WeightedLocation { Location = new LatLngLiteral { Lat = 13.506892, Lng = 100.8132 }, Weight = 5 });

await heatMap.SetData(hwp);

//await heatMap.SetData(heatPoints);
}
}
}

0 comments on commit 10b865a

Please sign in to comment.