Fix legend plugin to work with complex values
Fix trendline plugin to work with complex values, fix tests