Articles in this section
Category / Section

How to render the Legend in JavaScript Maps ?

2 mins read

To render the Legend, follow the given steps.

Step 1

Create a map sample and include the necessary script files.

Step 2

A Legend is a key used on a JavaScript map. It contains symbols with descriptions. It provides valuable information for interpreting what the map is displaying.

For enabling the Legend visibility, set api showLegend to true in the legendSettings.

legendSettings: {
   showLegend: true,
},

 

HTML

<script type="text/javascript">
            jQuery(function ($) {           
            $("#maps").ejMap({              
      layers: [
                        {           .    .    .
            legendSettings: {
                            showLegend:true,
                              mode: "interactive",                        
                                       .    .    .
                                      }
                           }            
                ]
 });
});
        </script>

The following screenshot represents the Legend visibility.

Legend visibility in maps

Sample Links

https://help.syncfusion.com/js/maps/getting-started

https://ej2.syncfusion.com/javascript/demos/#/bootstrap5/maps/default.html


Conclusion

I hope you enjoyed learning about how to render the Legend.

You can refer to our  JavaScript Map feature tour page to know about its other groundbreaking feature representations. You can also explore our JavaScript Map documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied