Welcome to the community and thank you for the well-formatted post! It seems like you are off to a great start with CesiumJS.
With regards to your first question, more details would help me better answer this question. Are you currently trying to upload an image? If so, what data is embedded in the image - what do you mean by “according to its values”? Sharing the image that you are referring to would be useful.
Overall, I think working from the Globe Materials sandcastle is a great place to start. I believe that a combination of using material shaders with a custom image and picking display heights given a user input would give you most of the functionality that you are looking for.
In terms of adding a legend, here is an old thread that discusses making a legend using regular HTML
and overlaying it onto the CesiumJS viewer. Cesium ion also provides simple tools for annotating the Cesium viewer. I have used Cesium ion to create some fun annotated maps.
As eluded to before, more information about your goals, the data you are currently using, and some of the code that you have tried (in the form of a sandcastle) would help me assist you more efficiently. If possible, can you provide some of these resources?
-Sam