autoscaling diagrams in JS