Generates a HTMLified legend and enables data item toggling by clicking legend items.