I'm trying to put inside an OpenLayers project the legend for an NDVI map. Previously I've created with QGIS 3.10 the SLD as indicated on the GeoServer's official documentation.
When I try to use GetLegendGraphic to see the legend's preview I see only the symbol of raster and not the legend. If I set the style as default for my raster layer I can use the link from GetLegendGraphic for see correcty my legend. But If I set "Associated" instead of "Dafault" I see again the raster's symbol.
Why I'm obligated to use "Default" for styling a raster?
EDIT
Here the WMS stylized(A) and here the WMS not stylized(B). The style name is NDVI.
https://gis.massimilianomoraca.it/geoserver/MassimilianoMoraca/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetLegendGraphic&FORMAT=image%2Fpng&LAYER=NDVI_Campania_20150807&SCALE=136494.42037699942
gives
it is possible to see the legend and is not possible to do the same with
https://gis.massimilianomoraca.it/geoserver/MassimilianoMoraca/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetLegendGraphic&FORMAT=image%2Fpng&LAYER=NDVI_Campania_20160712&SCALE=136494.42037699942
The layer A has NDVI as default style and for B I've used "Associated".