added better custom legend handling
Merge branch 'develop' into yazio