moving directive logic into map-chart and bar-chart files