Fixed issue where legend was not rendered properly in mobile mode