A legend does not show up when you use a colour expression.
There are 2 work arounds:
1) You can create an image and use it in your app as a text object with background image. but this legend will not be interactive.
2) Build an extension to make use of the same colour expression and have $("#id").click() functionality to these legend items. I would recommend you to use this.