Select to view content in your preferred language

Specify 'symbol' when using sizeRendererCreator.createClassBreaksRenderer()

662
4
10-18-2019 07:25 PM
HanlunSong
Emerging Contributor

Here is the documentation for the API:

size | ArcGIS API for JavaScript 4.13 

For my map, it generates 'simple-marker' for the symbol.

But I need 'simple-fill'.

Is there a way to specify that by passing in something?

I can modify the actual renderer instance after it is generated. But I think it is hackish.

I think this is a much needed feature nonetheless.

var layer = new FeatureLayer({
  url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/counties_politics_poverty/FeatureServer/0"
});

// visualization based off Arcade expression
var sizeParams = {
  layer: layer,
  classificationMethod: "equal-interval",
  valueExpression: "($feature.POP_POVERTY / $feature.TOTPOP_CY) * 100",
  view: view,
  legendOptions: {
    title: "% of people living in poverty"
  }
};

// when the promise resolves, apply the renderer to the layer
sizeRendererCreator.createClassBreaksRenderer(sizeParams)
  .then(function(response){
    layer.renderer = response.renderer;
  });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
4 Replies
BenElan
Esri Contributor

Hi Hanlun,

Have you taken a look at this sample? It uses 'simple-fill' symbology when defining class breaks.

0 Kudos
HanlunSong
Emerging Contributor

Thanks. But I am using this API: size | ArcGIS API for JavaScript 4.13, since I need it to automatically determine size/breaks. But I don't see how to specify symbol type with this API.

0 Kudos
BenElan
Esri Contributor

I created a sample that changes the symbol to a 'simple fill' after the class breaks have been determined by the sizeRenderer.

Edit: 

After rereading your initial post, I see that you already found this solution. I did not find a way to change the symbol type as a parameter. If adding this functionality as a parameter is important, I would recommend posting on the GeoNet Ideas page or contacting Esri Technical Support and asking the analyst to log an enhancement.

Thanks

HanlunSong
Emerging Contributor

Thank you very mush still