just a sample legend....

code needs to be refactored and commented, but it works.