the mapping between the scalar values and the color representation is not occurring.

Did you try your VTP with the GeometryViewer example ?
If it works you can look at the code of the example.

HTH,
Julien.