调整大小时,我很难让它看起来很漂亮。 我确定父/子大小与我不理解的方面之间存在某种逻辑关系。如果有人能给我一些指示,我将不胜感激。
<script src="javascript.js"</script>
答案 0 :(得分:0)
每次调整窗口大小时,只需动态获取viewBox
,而不是preserveAspectRatio
上的$(window).resize
和parent height and width
出汗:
var containerWidth = $("#yourChartId").parent().width(); // gets immediate parent width
var containerheight = $("#yourChartId").parent().height();// gets immediate parent height
var margin = {top: 15, right: 15, bottom: 20, left: 40},
width = containerWidth- margin.left - margin.right,
height = containerheight - margin.top - margin.bottom;