簡體   English   中英

d3標度與打字稿

[英]d3 scale with Typescript

我將scale.scaleTime()與Typescript和Angular 6一起使用。scale函數:

import * as scale from 'd3-scale';
public xScale: ScaleTime<number, number>;

this.xScale = scale.scaleTime()
  .domain([
    new Date('2018-01-02'),
    new Date('2018-04-02')
  ])
  .range([
    0,
    100
  ])
  .clamp(true);
 this.xTicks = this.xScale.ticks(6); 

但是在模板中我看到錯誤:成員xScale不可調用。 我已經安裝了打字

npm install --save-dev @types/d3-scale

這是PHP Storm通知,不是Typescript本身的錯誤。 看來我需要檢查打字稿插件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM