【发布时间】:2018-10-05 06:02:05
【问题描述】:
谁能帮我调整 d3 仪表盘的大小? 这是Stackblitz 代码。
我试过了,
.attr("preserveAspectRatio", "xMinYMin meet")
和
window.addEventListener("resize", this.draw);
【问题讨论】:
谁能帮我调整 d3 仪表盘的大小? 这是Stackblitz 代码。
我试过了,
.attr("preserveAspectRatio", "xMinYMin meet")
和
window.addEventListener("resize", this.draw);
【问题讨论】:
请修改你的 render() 并添加
svg = d3.select(container)
.append('svg')
.attr('class', 'gauge')
.attr('width', '100%')
.attr('height', '100%')
.attr('viewBox', '0' + ' ' + '0'+ ' ' + config.clipWidth + ' ' + config.clipHeight)
.attr('preserveAspectRatio', 'xMinYMin')
【讨论】: