fix a minor bug
[d3 diagram] improve diagram when there are 2 or 3 elements