Search code examples
javascriptarcgisesriarcgis-js-api

point clustering in esri javascript api


Can each group have different colors in javascript?

var blue = new PictureMarkerSymbol(picBaseUrl + "BluePin1LargeB.png", 32, 32).setOffset(0, 15);
var green = new PictureMarkerSymbol(picBaseUrl + "GreenPin1LargeB.png", 64, 64).setOffset(0, 15);
var red = new PictureMarkerSymbol(picBaseUrl + "RedPin1LargeB.png", 72, 72).setOffset(0, 15);
renderer.addBreak(0, 2, blue);
renderer.addBreak(0, 2, green);
renderer.addBreak(2, 1001, red);
var newcolor=[];
newcolor.push(blue);
newcolor.push(green);

Can I use both blue and and green in same render based on some case (if condition)?renderer.addBreak(0, 2, newcolor);


Solution

  • Yes you should be able to manage this by updatng the breaks as you need to.

    looking at the esri ClassBreakRedered class here: https://developers.arcgis.com/javascript/jsapi/classbreaksrenderer-amd.html

    You can clear existing breaks when you need to change the colours by calling clearBreaks() then re-add the breaks as you need with the new color e.g. green. Same colour for multiple breaks will be fine as well.