Reputation: 51
Questions
Desired Result
Apply different styles to multiple labels for an object (line) depending on the attributes attached to the line/label. Note there are many more scenarios for the attribute values than the ones included in the image.
Current Method
At present, I have achieved the desired result by rendering the object (line) multiple times, and fiddling with the styling each time it is rendered - this is not performing well and is very clunky.
Upvotes: 0
Views: 666
Reputation: 17897
You can use a style array
feature.setStyle([
new Style({
stroke: new Stroke({
...
}),
text: new Text({
...
})
}),
new Style({
text: new Text({
...
})
})
]);
Upvotes: 2