小编use*_*834的帖子

"scale"和"svg"在"node_modules/@ types/d3/index"中不存在

我正在尝试使用Angular 2和D3 JS创建条形图,下面是我添加的NPM包:

"d3": "4.4.0",
"d3-tip": "0.7.1",
"@types/d3": "^4.3.0",
Run Code Online (Sandbox Code Playgroud)

下面的typescript文件在编译时出错:

import { Component, ElementRef, ViewEncapsulation } from '@angular/core';
import * as d3 from 'd3';

@Component({
  selector: 'simple-bar-chart',
  template: require('./about.component.html'),
  styles: [require('./about.component.css').toString()]
})

export class AboutComponent {
constructor(public elementRef: ElementRef) {
}

ngOnInit() {
    var y = d3.scale.linear()
        .domain([0, 1])
        .range([height, 0]);

    var xAxis = d3.svg.axis()
        .scale(x0)
        .orient("bottom");
Run Code Online (Sandbox Code Playgroud)

错误是:

ERROR in ./angular2App/app/components/about/about.component.ts
(34,21): error TS2339: Property 'scale' does not exist on type 'typeof "App_path/node_modules/@types/d3/index"'.

ERROR in ./angular2App/app/components/about/about.component.ts
(44,24): error TS2339: Property …
Run Code Online (Sandbox Code Playgroud)

d3.js d3.js-v4 angular

9
推荐指数
1
解决办法
5622
查看次数

关键字default和new有什么区别

下面是一个示例类,

public class Loan
{
}
Run Code Online (Sandbox Code Playgroud)

现在,这些低于2线的区别是什么,它们之间有什么区别?

Loan loan = default(Loan);
Loan loan = new Loan();
Run Code Online (Sandbox Code Playgroud)

是否优先使用其他?

c#

5
推荐指数
3
解决办法
1434
查看次数

如何使用 D3 Js 制作具有向下钻取功能的图表列

有人可以建议如何使用 D3 JS 库进行列钻取吗?

下面的例子来自 Hightchart,

http://www.highcharts.com/demo/column-drilldown

d3.js

0
推荐指数
1
解决办法
8802
查看次数

标签 统计

d3.js ×2

angular ×1

c# ×1

d3.js-v4 ×1