Hi there,
You don't have to set bandIds or statistics when working with single band images. RasterStretchRenderer uses the statistics from the specified band or the only band by default. I suspect that your service's stats are maybe off. Can you try following two things?
1. Set the ImageryLayer.format to lerc so that the RasterStretchRenderer is applied on the client-side. if image formats are being requested, then the server processes the data and returns an image.
2. Can you set the stats on the RasterStretchRenderer and modify your stats as needed?
I updated the codepen to use single band image service and removed the flow-renderer part (but works with flow renderer as well). https://codepen.io/U_B_U/pen/gOvmmyr?editors=1000
I am setting the service's stats directly on the renderer to show how this is done. You can get the stats from the service rest end point or can get them from ImageryLayer.serviceRasterInfo. In any case, you probably have to play with the numbers.
const temperatureLayer = new ImageryLayer({
url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer",
renderer: {
colorRamp,
stretchType: "min-max",
type: "raster-stretch",
statistics: [{
avg: 712.371337411377,
max: 1611.125,
min: 515.6699829101562,
stddev: 45.56883666949917
}]
},
format: "lerc"
});