【问题标题】:How to make d3 gauge chart responsive?如何使 d3 仪表图响应?
【发布时间】:2018-10-05 06:02:05
【问题描述】:

谁能帮我调整 d3 仪表盘的大小? 这是Stackblitz 代码。

我试过了,

.attr("preserveAspectRatio", "xMinYMin meet")

window.addEventListener("resize", this.draw);

【问题讨论】:

    标签: angular d3.js


    【解决方案1】:

    请修改你的 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')
    

    【讨论】:

      猜你喜欢
      • 2013-07-11
      • 1970-01-01
      • 2019-04-16
      • 2013-11-23
      • 2014-11-25
      • 1970-01-01
      • 2016-07-22
      • 2014-01-20
      • 1970-01-01
      相关资源
      最近更新 更多