Hello. I have a question about map.
I need update info about temperatures in building at my map. This map gets data from List<MeasurementData> (I will take this values from DB in future). It looks right when i load the page: map gets the values and draw right color of rooms.
But i need something else. Can syncfusion refresh data for map and map without refreshing all page? For example i want load the page watch it 1-2 hours. If the temperature drops lower - room will be recolored from green to red.
I understand that refreshing of colors need redraw all map, but i dont want refresf all page every 5-10 sec. Can you consult me, how to do it, if it is possible?
Take a look, please, at About.aspx. There is my building. Project.7z is more then 30MB and a cant add it to post. I load it on my Gdrive. Link is below.
https://drive.google.com/open?id=0B2RgdnBQvJGfSU9yNlNBbVIwQkU
ASP.NET:
<asp:button ID="btninsert" runat="server" text="Button" OnClientClick="mapRefresh(); return false;" />
function mapRefresh() {
//Taking instance of map
var map = $("#ControlsSection_selection").ejMap("instance");
map.model.background = "cyan";
map.refresh();
} |
[C#]
[WebMethod]
public static string GetMapData(){
List<MeasurementData> result = Measurement_Result.GetMeasurementResults();
Random r = new Random();
for(int i=0; i<result.Count; i++)
{
result[i].Temperature1 = r.Next(0, 100) < 50 ? 11: 13;
result[i].Temperature2 = r.Next(16, 55);
}
//Returns new data to the AJAX method
return new JavaScriptSerializer().Serialize(result);
}
[ASPX]
<asp:Button ID="Button1" runat="server" Text="Обновить данные" OnClientClick="updateData();return false;" />
<script>
//Method to update the map without refreshing the page
function updateData() {
$.support.cors = true;
$.ajax({
url: 'About.aspx/GetMapData',
type: 'post',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data) {
//Update the map with data returned by server
var map = $("#selection").ejMap("instance");
map.model.layers[0].dataSource = JSON.parse(data.d);
map.refresh();
}
});
}
</script> |