| [HTML] <input type="button" onclick="markerChange()" id="marker" value="clicktochange" /> [JS] function markerChange() { var map = $("#container").data("ejMap"); for (var i = 0; i < syncfusion_locations.length; i++) { if (syncfusion_locations[i].orderValue == 1) { map.model.layers[0].markers = marker_locations1; map.model.layers[0].markerTemplate = "template1"; } else { map.model.layers[0].markers = marker_locations; map.model.layers[0].markerTemplate = "template" } } map.refresh(); } |
| setTimeout(function(){ var map = $("#container").data("ejMap"); map.model.layers[0].markers=[]; for (var i = 0; i < syncfusion_locations.length; i++) { if (syncfusion_locations[i].orderValue == 1) map.model.layers[0].markers.push(syncfusion_locations[i]); } map.model.layers[0].markerTemplate = "template1"; map.refresh(); }, 3000); |
| <div id="template1" style="display: none;"> <div> <svg width="100" height="100" style="margin-top:-50px"> <circle cx="30" cy="30" r="20" fill="green"></circle> </svg> <div style="background-image:url(https://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:5px;height:30px;width:90px;margin-top:-45px;"> </div> <div style="margin-left:10px;height:45px;width:120px;margin-top:-30px;"> <label class="label1" style="color:black;margin-left:15px;font-weight:normal">{{:Name}}</label> </div> </div> </div> |
|
[HTML]
<div id="template" style="display: none;">
<div>
<svg width="100" height="100" style="margin-top:-50px">
{{if orderValue === 0}}
<circle cx="30" cy="30" r="20"
fill="orange"></circle>
{{else}}
<circle cx="30" cy="30" r="20"
fill="green"></circle>
{{/if}}
</svg>
<div style="background-image:url(http://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:5px;height:30px;width:90px;margin-top:-45px;">
</div>
<div style="margin-left:10px;height:45px;width:120px;margin-top:-30px;">
<label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label>
</div>
</div>
</div>
|
|
[HTML]
<div id="template_both" style="display: none;">
<div style="margin-top:-20px;">
{{if orderValue === 0}}
<div style="background-color:orange;width:30px;height:30px;border-radius:50%;"></div>
{{else}}
<div style="background-color:green;width:30px;height:30px;border-radius:50%;"></div>
{{/if}}
<div style="background-image:url(http://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:-30px;height:25px;width:90px;margin-top:5px;">
</div>
<div style="margin-left:-15px;height:45px;width:120px;margin-top:-22px;">
<label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label>
</div>
</div>
</div>
|
|
[JS]
function getOrderValue() {
var map = $("#container").data("ejMap");
//code to get the current order value from database
//for demonstration purpose we are just toggling the value between 0 and 1
orderValue = (orderValue === 0 ? 1 : 0);
if (orderValue === 0)
//Use the template that uses orange color
map.model.layers[0].markerTemplate = "template";
else
//Use the template that has two colors (green and orange) for order value
map.model.layers[0].markerTemplate = "template_both";
//Refresh the map control
map.refresh();
}
|
|
[JS]
syncfusion_locations =
[
{ "Name": "USA", "latitude": 38.8833, "longitude": -77.0167, "orderValue": 0 },
{ "Name": "Brazil", "latitude": -15.7833, "longitude": -47.8667, "orderValue": 1 },
{ "Name": "India", "latitude": 21.0000, "longitude": 78.0000, "orderValue": 2 },
{ "Name": "China", "latitude": 35.0000, "longitude": 103.0000, "orderValue": 0 },
{ "Name": "Indonesia", "latitude": -6.1750, "longitude": 106.8283, "orderValue": 1 },
{ "Name": "Russia", "latitude": 61.524010, "longitude": 105.318756, "orderValue": 2 },
{ "Name": "Congo", "latitude": -4.783195, "longitude": 21.508523, "orderValue": 1 },
];
// Template values
<svg width="100" height="100" style="margin-top:-50px">
{{if orderValue === 0}}
<circle cx="30" cy="30" r="20"
fill="orange"></circle>
{{else orderValue === 1}}
<circle cx="30" cy="30" r="20"
fill="green"></circle>
{{else}}
<circle cx="30" cy="30" r="20"
fill="red"></circle>
{{/if}}
</svg>
|
|
[JS]
syncfusion_locations =
[
{ "Name": "USA", "latitude": 38.8833, "longitude": -77.0167, "orderValue": 0, "orderValue1": 1 },
{ "Name": "Brazil", "latitude": -15.7833, "longitude": -47.8667, "orderValue": 1, "orderValue1": 1 },
{ "Name": "India", "latitude": 21.0000, "longitude": 78.0000, "orderValue": 2, "orderValue1": 0 },
{ "Name": "China", "latitude": 35.0000, "longitude": 103.0000, "orderValue": 0, "orderValue1": 1 },
{ "Name": "Indonesia", "latitude": -6.1750, "longitude": 106.8283, "orderValue": 1, "orderValue1": 0 },
{ "Name": "Russia", "latitude": 61.524010, "longitude": 105.318756, "orderValue": 2, "orderValue1": 1 },
{ "Name": "Congo", "latitude": -4.783195, "longitude": 21.508523, "orderValue": 1, "orderValue1": 0 },
];
<script id="template" style="display: none;">
<div>
<svg width="100" height="100" style="margin-top:-50px">
{{if orderValue === 0 && orderValue1 === 1}}
<circle cx="30" cy="30" r="20"
fill="orange"></circle>
{{else orderValue === 1 && orderValue1 === 1}}
<circle cx="30" cy="30" r="20"
fill="green"></circle>
{{else}}
<circle cx="30" cy="30" r="20"
fill="red"></circle>
{{/if}}
</svg>
<div style="background-image:url(http://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:5px;height:30px;width:90px;margin-top:-45px;">
</div>
<div style="margin-left:10px;height:45px;width:120px;margin-top:-30px;">
<label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label>
</div>
</div>
</script> |
|
[JS]
<script id="template" style="display: none;">
<div>
<svg width="100" height="100" style="margin-top:-50px">
{{if orderValue === 0 }}
<circle cx="30" cy="30" r="20"
fill="orange"></circle>
{{else orderValue1 === 1 }}
<circle cx="30" cy="30" r="20"
fill="green"></circle>
{{else orderValue == 2 && orderValue1 == 0}}
<circle cx="30" cy="30" r="20"
fill="red"></circle>
{{/if}}
</svg>
<div style="background-image:url(http://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:5px;height:30px;width:90px;margin-top:-45px;">
</div>
<div style="margin-left:10px;height:45px;width:120px;margin-top:-30px;">
<label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label>
</div>
</div>
</script> |
|
[JS]
<div>
<div style="margin-top:-20px;">
{{if orderValue === 0}}
<div style="background-color:orange;width:30px;height:30px;border-radius:50%;"></div>
{{else orderValue1 === 1 }}
<div style="background-color:green;width:30px;height:30px;border-radius:50%;"></div>
{{else orderValue == 2 && orderValue1 == 0}}
<div style="background-color:red;width:30px;height:30px;border-radius:50%;"></div>
{{/if}}
<div style="background-image:url(http://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:-30px;height:25px;width:90px;margin-top:5px;">
</div>
<div style="margin-left:-15px;height:45px;width:120px;margin-top:-22px;">
<label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label>
</div>
</div> |
|
[JS]
<script id="template" type="text/x-jsrender" style="display:none">
<div>
<div style="margin-top:-20px;">
{{if orderValue === 0}}
<div style="background-color:orange;width:30px;height:30px;border-radius:50%;"></div>
{{else orderValue1 === 1 }}
<div style="background-color:green;width:30px;height:30px;border-radius:50%;"></div>
{{else orderValue == 2 && orderValue1 == 0}}
<div style="background-color:red;width:30px;height:30px;border-radius:50%;"></div>
{{/if}}
<div style="background-image:url(http://js.syncfusion.com/demos/web/Images/map/mappath.png);margin-left:-30px;height:25px;width:90px;margin-top:5px;">
</div>
<div style="margin-left:-15px;height:45px;width:120px;margin-top:-22px;">
<label class="label1" style="color:white;margin-left:15px;font-weight:normal">{{:Name}}</label>
</div>
</div>
</script> |