Size
sizeMethod used to set the height of the Polygon
IPointSize: number |[number, number] | [number, number, number]
- The size type is number, which represents the height of the Polygon.
pointLayer.size(1);
size(width: IPointSize)
The radius can be set directly on the polygon layer. All points in the layer use a height.
layer.size(2);
size(field: string)
The height of a polygon layer can be mapped based on the data values accepted by the layer, accepting fields of incoming data as parameters.
layer.source([
{
lng: 120,
lat: 30,
r: 2,
},
]);
layer.size('r');
size(field: string, domain: IPointSize[])
sizeMethod supports simple value mapping and will be based onfieldThe values extracted from the data passed into the layer are mapped todomainin the value range.
layer.size('type', [1, 2, 3]);
size(field: string, callback: () => IPointSize )
sizeThe method supports the writing method of callback function, which will be based onfieldascallbackmethod parameters,callbackThe return value of the method is the actual height of the polygon layer.
layer.size('type', (value) => {
switch (value) {
case 'path':
return 1;
case 'road':
return 2;
}
});