私は完全に無能であると感じさせるd3 V4の能力が大好きです。私は他のモジュールと一緒にwebpackで独自のカスタムバンドルを作る方法を考え出すことができません...代わりに、単にバニラd3バンドルを取り、それにマルチセレクション機能を追加しようとしています。どのようにd3-selection-multiをd3に追加しますか?
コンポーネント間にd3オブジェクトを依存関係に挿入するために、Angular 2でd3サービスを作成しました。
import {Injectable} from "@angular/core";
import * as d3 from "d3";
import "d3-selection-multi";
export type D3 = typeof d3;
@Injectable()
export class D3Service {
constructor() {
}
private d3: D3 = d3;
getD3 =() => {
return this.d3;
};
}
私は
let test = this.d3.select("body").styles({
"background-color": "#F00",
"color": "#00F"
});
私のブラウザは、それがされ.attrsものを知っていないと文句を言い.attrsを使用してのように、複数の選択機能にアクセスしようとするまで、すべてが、素晴らしい作品。
error_handler.js:47 EXCEPTION: Uncaught (in promise): Error: Error in ./ListingComponent class ListingComponent_Host - inline template:0:0 caused by: this.d3.select(...).styles is not a function TypeError: this.d3.select(...).styles is not a function
私も無駄にObject.assign
を持つ2つのojectsをマージしようとしました。
私は間違っていますか?それはおそらく何かばかげて些細なことでしょう。
attrs()と同じ問題が発生しました。解決しませんでした。 –