refactor (component.legend) return null if no data collection