Show numbers for each country in JavaScript Maps
This article explains how to show numbers for each country in JavaScript Maps.
DataLabel with bubble
Data labels provide information to the user about the shapes. You can add text to the shapes of the maps component using dataLabelSettings. To achieve this, you need to bind the field name in the data source to the labelPath property in dataLabelSettings and bind the desired field name in the data source to the valuePath property in bubbleSettings. The bubble is rendered based on the population value and customized properties such as minRadius, maxRadius, opacity, colorValuePath, etc. The following code renders the names of all the shapes in the WorldMap.
import { enableRipple} from '@syncfusion/ej2-base';
enableRipple(true);
import { Maps, DataLabel, Bubble} from '@syncfusion/ej2-maps';
import { internetUsers } from './datasource';
import { world_Map } from './worldMap';
Maps.Inject(DataLabel, Bubble);
let maps: Maps = new Maps({
format: 'n',
useGroupingSeparator: true,
layers: [
{
shapeDataPath: 'name',
shapePropertyPath: 'name',
shapeData: world_Map,
shapeSettings: {
fill: '#E5E5E5'
},
dataLabelSettings: {
visible: true,
labelPath: 'rank',
intersectionAction: 'Trim'
},
bubbleSettings: [
{
visible: true,
valuePath: 'value',
colorValuePath: 'color',
minRadius: 3,
maxRadius: 70,
opacity: 0.8,
dataSource: internetUsers,
}
]
}
]});
maps.appendTo('#container');

Refer to the working sample for additional details and implementation:
Sample link - Maps Labels
We hope you enjoyed learning about numbers for each country in JavaScript Maps.
You can refer to our JavaScript Maps feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Maps example 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, BoldDesk Support, or feedback portal. We are always happy to assist you!