I am using this method for changing shape colors on a conditional basis, and it works great. However, I've run into a fairly large issue. I'm also using the shapeCreated event to display a label on the map (state postal code) using this code. However, the data is actually made up of multipolygons, so the created shapes may or may not refelect the actual state outline. As such, the label prints multiple times. I can put code in place to ensure it's a new state name when a shape gets created, but the label doesn't get centered any more since it centers on the actual shape being created, and not the shape the subshape belongs to (hope that makes sense).
So what is a good way of centering the label on a shape made up of multiple polygons?
var
provNum = e.shape.dataItem.properties[
"postal"
];
var
bbox = e.shape.bbox();
var
center = bbox.center();
// Create the label
var
label =
new
kendo.drawing.Text(provNum);
var
labelCenter = label.bbox().center();
// Position the label
label.position([
center.x - labelCenter.x,
center.y - labelCenter.y
]);
// Render the label on the layer surface
e.layer.surface.draw(label);