Selecting legend + graph. bugfix null pointer exception