Legend.addItem( mapdataLayer : TileLayer | MarkerLayer | RasterLayer )
Adds the given mapdata layer item to the legend if it has been enabled.
Prerequisite
The legend must have been enabled before you can use it.
Take a look to the Getting started section and to Legend class to get to know how to enable the legend.
function onYoumapsApiLoaded(){
console.log("YoumapsAPI loaded!");
youmapsApi.displayMapdata(<MAPDATA_ID>);
var mapdata = youmapsApi.getMapdata(<MAPDATA_ID>);
youmapsApi.legend.removeItem(mapdata);
youmapsApi.legend.addItem(mapdata);
}
var mapOptions = {
center : new google.maps.LatLng(48.858386, 2.343435), // Paris,
zoom : 11,
minZoom : 6,
maxZoom : 17
};
var youmapsApi = new YoumapsAPI(
{
techID : <YOUR_TECH_ID>,
initMapboards : true,
initLegend : true,
mapDivId : "map",
mapOptions : mapOptions
},
onYoumapsApiLoaded
);
