overflowMode property

MapLabelOverflowMode overflowMode
final

Trims or removes the data label when it is overflowed from the shape.

Defaults to MapLabelOverflowMode.none.

By default, the data labels will render even if it overflows form the shape. Using this property, it is possible to remove or trim the data labels based on the available space in the shape.

This snippet shows how to set the overflowMode for the data labels in SfMaps.

 @override
 Widget build(BuildContext context) {
   return
     SfMaps(
       layers: [
         MapShapeLayer(
           dataLabelSettings:
               MapDataLabelSettings(
                   overflowMode: MapLabelOverflowMode.hide
               ),
           delegate: MapShapeLayerDelegate(
               showDataLabels: true,
               shapeFile: "assets/world_map.json",
               shapeDataField: "continent",
               dataCount: bubbleData.length,
               primaryValueMapper: (index) {
                 return bubbleData[index].country;
               }),
         )
       ],
   );
 }

Implementation

final MapLabelOverflowMode overflowMode