updated to comply with the D3 'Margin Convention'; added color legends