相关疑难解决方法(0)

使用d3.js和TypeScript绘制饼图时的编译错误

我试图使用d3.js库和TypeScript绘制饼图.我有以下代码:

"use strict";
module Chart {
  export class chart {

    private chart: d3.Selection<string>;
    private width: number;
    private height: number;
    private radius: number;
    private donutWidth: number;
    private dataset: { label: string, count: number }[];
    private color: d3.scale.Ordinal<string, string>;

    constructor(container: any) {
      this.width = 360;
      this.height = 360;
      this.radius = Math.min(this.width, this.height) / 2;
      this.donutWidth = 75;

      this.dataset = [
        { label: 'Road', count: 5500 },
        { label: 'Bridge', count: 8800 },
        { label: 'Tunnel', count: 225 },
      ];

      this.color = d3.scale.category10(); …
Run Code Online (Sandbox Code Playgroud)

javascript svg d3.js typescript

6
推荐指数
3
解决办法
4458
查看次数

标签 统计

d3.js ×1

javascript ×1

svg ×1

typescript ×1