directive with d3 for averages