- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 angular2 中使用 d3js,但是当我想在元素更改时添加过渡时出现错误: Property 'transition' does not exist on type 'Selection<BaseType, {}, null, undefined>'
我使用angular-cli生成项目,angular的版本是4.0.0,d3js是4.8.0
这是我的 typings.d.ts
:
declare module 'd3' {
export * from 'd3-array';
export * from 'd3-axis';
export * from 'd3-brush';
export * from 'd3-chord';
export * from 'd3-collection';
export * from 'd3-color';
export * from 'd3-dispatch';
export * from 'd3-drag';
export * from 'd3-dsv';
export * from 'd3-ease';
export * from 'd3-force';
export * from 'd3-format';
export * from 'd3-geo';
export * from 'd3-hierarchy';
export * from 'd3-interpolate';
export * from 'd3-path';
export * from 'd3-polygon';
export * from 'd3-quadtree';
export * from 'd3-queue';
export * from 'd3-random';
export * from 'd3-request';
export * from 'd3-scale';
export * from 'd3-selection';
export * from 'd3-shape';
export * from 'd3-time';
export * from 'd3-time-format';
export * from 'd3-timer';
export * from 'd3-transition';
export * from 'd3-voronoi';
export * from 'd3-zoom';
这是我的 app.component.ts
import * as d3 from 'd3';
......
d3.select(this).select("path").transition().attr("d", function(d) {
console.log(d);
return arc2(<any>d);
})
如果我删除 transition()
它表现良好。
如何解决?谢谢
最佳答案
我已经通过以下方式修复了我的代码:
import { select as d3Select } from 'd3-selection';
import { transition as d3Transition } from 'd3-transition';
d3Select.prototype.transition = d3Transition;
然后在您的代码中使用 d3Select 代替 select
您可以关注: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/16176
关于javascript - 类型 'transition' 上不存在属性 'Selection<BaseType, {}, null, undefined>',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43653228/
我陷入了无法找到 MyType 的 BaseType 父类(super class)的接口(interface)声明和尝试使用 BaseType 的前向声明作为 MyType 的父类(super cl
我想知道如何获得对象的实际基础对象?我有一个名为 MessageBase 的基类,还有很多继承这个基类的类,它们本身被不同深度的其他类继承。一个例子: 有些类是这样继承的: MessageBase -
在 VS2013 中:创建可移植类库 目标 .NET Framework 4.5、Windows Phone 8.1 和 Windows 8 编写如下代码: public class Class1 {
我的所有页面都有一个基类: //BASE CLASS public class WebBasePage : Page { protected override void OnLoad(Even
我有三个类,它们都实现了类似的功能,但在细微的细节上有所不同。我想创建一个抽象基类并将共享的代码移动起来。现在我卡住了。 每个子类都有一个 ListBuffer 保存另一个关系的对象,这是一些基本类型
在方法参数中使用基类型有什么好处? 这是一个示例: private void Foo(List numbers) //R# laments: parameter can be IEnumerable.
我正在尝试创建一个(非常)简单的消息传递系统,但被 C++03 困住了。我在使用 C++11 功能之前已经解决了这个问题,但我不再有这样的奢侈了。 目标编译器是 Visual Studio 2008
我正在尝试绑定(bind)一个 objective-c 库。无法创建 BaseType 属性! 我正在学习 Xamarin 的网站教程。我也尝试在网上搜索并找到了一些解决方案,例如: 有人说我没有创建
我有几个类: class Vehicle { } class Car : Vehicle { } 我有一个派生类的列表: IList cars; 我想将列表转换为其基类,并尝试过: IList bas
这只是我正在尝试实现的一种服务定位器类型的模式,我想在其中捕获将实现注册到它不属于的接口(interface)的尝试,如: public void Add(Type interfaceType, ob
我正在使用 AssembliyDefinition.ReadAssembly 加载两个程序集 在 AssemblyA 中我定义了 ClassA。 在 AssemblyB 中我定义了 ClassB :
接口(interface)定义 public interface IPayeePayrollRunInitialPayElementData : IPayeePayrollRunPayElementD
我如何输入 List至 List ,在我的代码实例中,List 将作为一个对象(程序要求不是故意的),通过这样做我将检索 vehicleId.. public Form1() {
我想知道是否有人能指出我正确的方向...... 我如何从 ReadOnlyCollection 转换至 ReadOnlyCollection没有迭代或“更新”副本? 我正在使用 .NET Framew
例子: class Base{} class Child : Base{} typeof( Base<> ).IsGenericTypeDefinition; // == true ie. param
我这里有 stackbiltz - https://stackblitz.com/edit/lable-line-break-vaszab?file=src/app/app.component.ts
我这里有 stackbiltz - https://stackblitz.com/edit/lable-line-break-vaszab?file=src/app/app.component.ts
这个问题在这里已经有了答案: Do interfaces derive from System.Object? C# spec says yes, Eric says no, reality say
我需要忽略 abstract class BaseEntity 上的属性 State,但如果不使用 [NotMappedAttribute],我无法让它工作>,但如果我使用属性,该属性也会在 ODat
我想在 angular2 中使用 d3js,但是当我想在元素更改时添加过渡时出现错误: Property 'transition' does not exist on type 'Selection'
我是一名优秀的程序员,十分优秀!