I am looking to do a feature layer which I have set up with a renderer with a CIM Symbol. I want to change the color of theCIMPictureMarker based on an attribute of the feature. My current code doesnt let me change the color. Is this the best renderer to use? I did not use a unique value renderer since I dont need to compare the value I want to use. I am also curious if I can rework valueExpressionInfo to call a function.
Thanks in advance
{
type: "simple",
symbol: new CIMSymbol({
data: {
type: 'CIMSymbolReference',
primitiveOverrides: [
{
type: 'CIMPrimitiveOverride',
primitiveName: 'imageMarker',
propertyName: 'replacementColor',
valueExpressionInfo: {
type: 'CIMExpressionInfo',
expression: '$feature.statusColor',
returnType: 'Default',
},
}
],
symbol: {
type: 'CIMPointSymbol',
primativeName: "imageMarker",
symbolLayers: [
{
type: "CIMPictureMarker",
enable: true,
size: 20,
scaleX: 1,
colorSubstitutions: [
{
targetColor: [255, 0, 0, 255], // red
replacementColor: [0, 0, 255, 255] // blue
}
]
url: "https:////myCnd/images/defaultImage.png"
},
],
},
}
})
}
Solved! Go to Solution.
Hi! Based on your code snippet above, it looks like you have a color stored as the attribute value. Instead of overriding the colorSubstitution value (which is not supported), try overriding the CIMPictureMarker tintColor property. Here's an example: https://codepen.io/annefitz/pen/wBwrooy
Note that the primitiveName on the override must match the primitiveName on the symbol layer with the property you are trying to override.
Hi! Based on your code snippet above, it looks like you have a color stored as the attribute value. Instead of overriding the colorSubstitution value (which is not supported), try overriding the CIMPictureMarker tintColor property. Here's an example: https://codepen.io/annefitz/pen/wBwrooy
Note that the primitiveName on the override must match the primitiveName on the symbol layer with the property you are trying to override.