Displaying more than a few groups on the same linechart most of the time result in a spaghetti plot that is almost unreadable. Using small multiple is a very good alternative, and this post describes how to implement it in d3.js. This example works with d3.js v4
and v6