Created method to generate legend state
- passed the current legend state in the legendToggled event