createDataLayer: function(map) {
var defaultStyle = new OpenLayers.Style({
externalGraphic: this.Markers.ICON,
- graphicHeight: "${height}"
+ graphicHeight: "${height}",
+ label: "${label}",
+ fontColor: "white",
+ fontWeight: "bold"
}, {
context: {
height: function(feature) {
var defaultHeight = SYP.Markers.HEIGHT || 32;
var increase = 4 * (feature.attributes.count - 1);
return Math.min(defaultHeight + increase, 50);
+ },
+ label: function(feature) {
+ var renderer = feature.layer.renderer;
+ if (renderer.CLASS_NAME == "OpenLayers.Renderer.Canvas") {
+ return ""; // canvas backend cannot draw text above an external Image
+ }
+ return (feature.attributes.count > 1) ? feature.attributes.count: "";
}
}
});