Hi JMIX team
Do you have any examples or can share code snippets how the weightProperty can be used?
weightProperty — if specified, then each point of the layer will have a weight value (int) defined by the weight property of the geo-object. This value will be used when calculating the summed-up value of the cluster (by default, the number of points is used).
I have a use case.
I want to show the total sales amount from customers in different geolocations instead of just count of customers.
The aggregation will be based on the hierarchy used e.g. Country, Province, District etc.
As per the documentation, it seems #1 above is possible but any sample code will be helpful.
Is this add-on has the option to achieve #2 above too?
weightProperty takes entity’s property to show value of the cluster instead of number of points. It should return the Integer type.
You can define the existing property from entity or create non-persistent property which will be calculated based other ones or later. For instance the weight property in Location entity:
Location class
@JmixEntity
@Table(name = "SAMPLER_LOCATION")
@Entity(name = "sampler_Location")
public class Location {
@JmixGeneratedValue
@Column(name = "ID", nullable = false)
@Id
private UUID id;
@Column(name = "NAME")
private String name;
@Column(name = "POINT")
@Geometry
@Convert(converter = PointWKTConverter.class)
protected Point point;
@Column(name = "INTENSITY")
private Double intensity;
@JmixProperty
@Transient
private Integer weight = RandomUtils.nextInt(1, 100);
public Double getIntensity() {
return intensity;
}
public void setIntensity(Double intensity) {
this.intensity = intensity;
}
public Point getPoint() {
return point;
}
public void setPoint(Point point) {
this.point = point;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
}
As far as I know map does not provide the ability to cluster by country, city, etc. I think the only way is to group data by containers and create several layers with cluster. However they won’t group together.
Hi,
Thanks for creating the issue for enhancement. You may also consider adding the following too:
3. Option to use different shapes (instead of just circle)
4. Option to show more than 1 value like a) target sales b) actual sales. These two fields can be the criteria to change the colour e.g. when actual sales >= target then green, else red.
Do you also have any plan to include Direction, distance, routing etc. features in the map add-on? Currently, the map component add-on looks to have very limited functionalities. Being a commercial component, I would expect more useful features in it.