This post describes how to build a
connected scatter plot
with multiple data series in d3.js. It includes a legend that allows
to show or hide groups. It follows the previous
basic connected scatter plot. This example works with d3.js v4
and v6
on("click",..)
element that will show or hide
the group.
opacity
attribute of the group elements. If it
is 0, it switches to 1. And reciprocally.
currentOpacity == 1 ? 0:1
. It is just a shorter
way to write
if(currentOpacity == 1){return 0}else{return 1}