This post describes how to build a line chart with several groups. Mind the Spaghetti chart: it becomes unreadable when too many lines are displayed. More examples of line charts in the dedicated section.
d3.nest
function to group the variable. Read more about it here.