Ban d3.max and d3.min across the project. Close #843

Close #843.
New version of #879 

newline issue?