svg大小根据内容自适应

宽度内容自适应

			let width = _.max(_.map(svg.children, function(s) {
					let b = s.getBBox(),
						w = b.x + b.width;
					if(s.style.strokeWidth.match(/\d+/)) {
						w += parseFloat(s.style.strokeWidth.match(/\d+/).shift());
					}
					return w;
				})); 
				svg.setAttribute('width', width);

高度内容自适应

 
			let	height = _.max(_.map(svg.children, function(s) {
					let b = s.getBBox(),
						h = b.y + b.height;
					if(s.style.strokeWidth.match(/\d+/)) {
						h += parseFloat(s.style.strokeWidth.match(/\d+/).shift());
					}
					return h;
				}));
				
				svg.setAttribute('height', height);