I also was able to set the symbology using RasterLayer. You can view the sample here. This is a little more complicated but it renders the symbology quickly. Basically the important part of this code to look at is the pixelFilter property inside the rasterLayer constructor. It references a custom function: reclassifyPixels() that defines the color for each pixel based on it's value.
Constructor:
var rasterLayer = new RasterLayer(rasterUrl, {
opacity: 1,
pixelFilter: reclassifyPixels,
imageServiceParameters: params
});
pixelFilter:
// The pixel filter
function reclassifyPixels(pixelData) {
if (pixelData == null || pixelData.pixelBlock == null) {
return;
}
var pixelBlock = pixelData.pixelBlock;
var pixels = pixelBlock.pixels;
var numPixels = pixelBlock.width * pixelBlock.height;
if (pixels == null) {
return;
}
var p = pixels[0];
var pr = new Uint8Array(p.length); //set up array for red values
var pg = new Uint8Array(p.length); //set up array for green values
var pb = new Uint8Array(p.length); //set up array for blue values
for (var i = 0; i < numPixels; i++) {
//apply color based on temperature value of each pixel
if (p>10) {
pr = 0; //red
pg = 255; //green
pb = 0; //blue
}
if(p<=10){
pr = 255; //red
pg = 0; //green
pb = 0; //blue
}
}
pixelData.pixelBlock.pixels = [pr, pg, pb]; //assign rgb values to each pixel
pixelData.pixelBlock.statistics = null;
pixelData.pixelBlock.pixelType = "U8";
return pixelData;
}
Also keep in mind that RasterLayer is in beta right now, but you may find it very useful as it does processing/filtering on the client, thus speeding up your performance. See the following links for more information:
RasterLayer | API Reference | ArcGIS API for JavaScript
PixelBlock | API Reference | ArcGIS API for JavaScript