Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带d3的角形子弹图_Javascript_Angular_Typescript_D3.js - Fatal编程技术网

Javascript 带d3的角形子弹图

Javascript 带d3的角形子弹图,javascript,angular,typescript,d3.js,Javascript,Angular,Typescript,D3.js,我使用代码用d3创建项目符号图表。现在我想在一个角度分量中创建一个项目符号图表。 我是d3新手,所以我尝试将代码转换为typescript 这是我的密码。我知道代码中有错误。你能帮我把它弄好吗 this.svg = d3.select('body').selectAll('svg') .enter().append('svg') .attr('class', 'bullet') .attr('width', 100 + this.margin.left + this.margin.r

我使用代码用d3创建项目符号图表。现在我想在一个角度分量中创建一个项目符号图表。 我是d3新手,所以我尝试将代码转换为typescript

这是我的密码。我知道代码中有错误。你能帮我把它弄好吗

this.svg = d3.select('body').selectAll('svg')
  .enter().append('svg')
  .attr('class', 'bullet')
  .attr('width', 100 + this.margin.left + this.margin.right)
  .attr('height', 300 + this.margin.top + this.margin.bottom);

this.g = this.svg.append('g')
  .attr('transform', 'translate(' + this.margin.left + ',' + this.margin.top + ')')
;
这是svg初始化函数。我应该在dom中创建svg元素,但它没有。 在示例中,
.attr('class','bullet')
执行此操作。但这在角度上是行不通的。
有什么想法吗?

删除
。选择All('svg')。输入()。Enter仅在加入
.data()
后有效。看看。

谢谢,这很有帮助!@Blom…你能为bullet Chart创建一个工作的plunker吗?这样可能会有所帮助。你在angular2应用程序中把bullet.js放在哪里。