Scale diagram

Sometimes the generated diagram is larger than the bounds of the SVG. This fix applies a scale to ensure that the generated diagram is within bounds and then applies the centering (center_diagram branch).