Search results

Bubble

Bubbles in the Maps control represent the underlying data values of the map. Bubbles are scattered throughout the map shapes that contains bound values.

Bubbles are included when data binding and the bubbleSettings is set to the shape layers.

To add bubbles to the map, bind data source to the layer bubbleSettings and set the valuePath as population. Following example illustrates bubble enable for the World map with datasource. To render bubble in maps need to inject Bubble module using Maps.Inject(Bubble) method.

export let world_map = // paste the World map from WorldMap.json Geo json file.
Source
Preview
index.html
index.css
<!DOCTYPE html><html lang="en"><head>
    <title>EJ2 Maps</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript UI Controls">
    <meta name="author" content="Syncfusion">
    <link href="index.css" rel="stylesheet">
    
    
<script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container" style="height: 500px; width: 500px">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
    ele.style.visibility = "visible";
 }   
        </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Enable Legend for Bubble

To enable the legend for the bubble, need to set legendSettings.visible as true and legendSettings.type as ‘Bubbles’. To render the legend in maps need to Inject Legend module using Maps.Inject(Legend) method. Refer the below code snippet to enable the legend for bubbles with each bubble different colors rendering.

Source
Preview
index.html
index.css
<!DOCTYPE html><html lang="en"><head>
    <title>EJ2 Maps</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript UI Controls">
    <meta name="author" content="Syncfusion">
    <link href="index.css" rel="stylesheet">
    
    
<script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js" type="text/javascript"></script>
</head>

<body>
    
    <div id="container" style="height: 500px; width: 500px">
        <div id="element"></div>
    </div>


<script>
var ele = document.getElementById('container');
if(ele) {
    ele.style.visibility = "visible";
 }   
        </script>
<script src="index.js" type="text/javascript"></script>
</body></html>

Refer the API for Bubble feature.