var classDef = new ClassBreaksDefinition();
<<< classDef.classificationField = app.currentAttribute; >>>
<<< assign an Array here instead of the line before >>>
//Known values: natural-breaks | equal-interval | quantile | standard-deviation | geometrical-interval
classDef.classificationMethod = "natural-breaks";
classDef.breakCount = 5;
classDef.baseSymbol = app.symbol;
Do you mean a symbology based on multiple values? I think it should be possible if you do it with a weighted index approach.
Thanks for the hint. GenerateRendererTask requires a Featurelayer , therefor it's impossible to work with arrays.
Now I try to append one Calculation-Field to the Featurelayer to commit this as classificationField.
What would you do with that ClassBreaksDefinition?
Its purpose is to create renderer, which you will be then using to update the symbology of a graphicslayer or featurelayer. If there is no field with the values in the array, the symbology will not work.
If you are talking about creating class breaks, with values(min, max symbol etc) stored in an array. that might be possible. You need not use GenerateRendererTask. You can simply create a new ClassBreaksRenderer and update the infos property with the desired valid values.
Thank you for the answer.
Example: (app.Layer is a FeatureLayer)
//adding a new Field
for (feature in app.Layer.graphics) {
var attributes = app.Layer.graphics[feature].attributes;
attributes["DIFF"] = <someValue>;
}
Debugging app.Layer.graphics.attributes shows "DIFF" with the contents <someValue>
//here creating the ClassBreaksDefinition, GenerateRendererTask
//here Comes the error: unable to find classificationField
generateRenderer.execute(params, applyRenderer, errorHandler);
You cannot add a field into a FeatureLayer at runtime. Unless, you do it every time the FeatureLayer updates itself.
What kind of mode are you using for the FeatureLayer. If it is AUTO or ONDEMAND, you might have problems, because the content keeps getting updated when ever the map extent changes. You might have better luck with SNAPSHOT as the features are retrieved only once.
The Problem seemed to be simple:
Calculate the difference between two attributes from a Featureclass during runtime, generate Classbreaks from the difference-Attribute and rerender the map.
I think I have to look for other Solutions ...
Have you looked at the valueExpression in the ClassBreaksRenderer. It uses the new Arcade format, which can be used to small calculation and use that as alternative for attributeField.