Fix the up/down calc on Diagram. Make the viewBox attr easier to read.
Use max rather than a harder-to-read reduce in Diagram. Incidental whitespace changes.