D3バブルチャート 'bubble.nodes not a function'

Rajshri Mohan KS

私はマイク・ボストックのチュートリアルを以下のよ、ここで私は自分のデータセットを使用していると私はD3 V4を使用していることを除いて...バブルチャートを作成します。私はd3を初めて使用し、v4ではv3から多くの変更があったことを理解しています。サンプルコードをv4に変換するのに問題があります。

たとえば、私はこのコードをd3v3で変換しました。

var bubble = d3.layout.pack()
    .sort(null)
    .size([diameter, diameter])
    .padding(1.5);

に:

var bubble = d3.pack(dataset)
        .size([diameter, diameter])
        .padding(1.5);

上記は正しいですか?この時点までエラーが発生していないのでわかりません。

しかし、次のコードでエラーが発生します。

var node = svg.selectAll(".node")
        .data(
            bubble.nodes(root)
            .filter(function(d) {
                return !d.children;
            })
        )
        .enter()
        .append("g")
        .attr("class", "node")
        .attr("transform", function(d) {
            return "translate(" + d.x + "," + d.y + ")";
        });

bubble.nodes is not a functiond3 v4で同等のものは何ですか?

フィドル:https//jsfiddle.net/r24e8xd7

Chirag Kothari

更新されたフィドルは次のとおりです:https//jsfiddle.net/r24e8xd7/9/

ルートノードは、d3.hierarchyを使用して構築する必要があります。

 var nodes = d3.hierarchy(dataset)
            .sum(function(d) { return d.responseCount; });

次に、パックレイアウトを呼び出すことができます。

var node = svg.selectAll(".node")
            .data(bubble(nodes).descendants())

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

D3: `bubble.nodes`が正しいグラフィックデータをデータセットに適用していません

分類Dev

Passing array of nodes to function and returning an array of nodes

分類Dev

Bubble Function sorting in C on an array of integers

分類Dev

sort function not working properly (bubble sort) - c

分類Dev

How to make one function instead of 3 or more for a visualization in d3 to then add highlight when hovering over nodes

分類Dev

D3 Tree Chart with left and right nodes on every nodes

分類Dev

appending multiple Bubble cloud charts with d3.js

分類Dev

How create legend for bubble chart in d3? Legend not showing up

分類Dev

is it possible to tweak the d3 bubble chart to obtain the bubbles at scattered positions instead of a circle pack?

分類Dev

D3を使用してバブルチャートの凡例を作成する

分類Dev

魚眼レンズ付きのd3バブルチャート

分類Dev

D3js multiple parent nodes

分類Dev

D3.js Tree with Numbering on Nodes

分類Dev

D3にホバー(ツールチップ)を追加する方法。バブルモーションチャート?

分類Dev

D3 force-directed graph( v4) is not accepting img as nodes

分類Dev

D3 Force Graph With Arrows and Curved Edges - shorten links so arrow doesnt overlap nodes

分類Dev

"Hard" filtering of nodes in a d3,js force-directed graph

分類Dev

D3 Tree - How to expand tree to show and highlight all nodes of same name?

分類Dev

Vue D3 - Select newly generated nodes only to stop event propagation

分類Dev

Adding and removing nodes and links from force diagram in d3 based on filter dropdown

分類Dev

How do i select all nodes and apply a css style to all of them, D3

分類Dev

d3.jsの内部バブルチャート

分類Dev

d3.jsの内部バブルチャート

分類Dev

Why does this recursive function counting nodes in a binary search tree always return a result larger than expected?

分類Dev

In the as.party function how can I clarify which are the indices for the different nodes?

分類Dev

D3v4 inserting new nodes

分類Dev

d3.js Cluster bubbles with over 2600 nodes

分類Dev

フォーム検証でvalidation-bubble-messageを削除する方法

分類Dev

D3でマルチレベルオブジェクトからチャートを作成する

Related 関連記事

  1. 1

    D3: `bubble.nodes`が正しいグラフィックデータをデータセットに適用していません

  2. 2

    Passing array of nodes to function and returning an array of nodes

  3. 3

    Bubble Function sorting in C on an array of integers

  4. 4

    sort function not working properly (bubble sort) - c

  5. 5

    How to make one function instead of 3 or more for a visualization in d3 to then add highlight when hovering over nodes

  6. 6

    D3 Tree Chart with left and right nodes on every nodes

  7. 7

    appending multiple Bubble cloud charts with d3.js

  8. 8

    How create legend for bubble chart in d3? Legend not showing up

  9. 9

    is it possible to tweak the d3 bubble chart to obtain the bubbles at scattered positions instead of a circle pack?

  10. 10

    D3を使用してバブルチャートの凡例を作成する

  11. 11

    魚眼レンズ付きのd3バブルチャート

  12. 12

    D3js multiple parent nodes

  13. 13

    D3.js Tree with Numbering on Nodes

  14. 14

    D3にホバー(ツールチップ)を追加する方法。バブルモーションチャート?

  15. 15

    D3 force-directed graph( v4) is not accepting img as nodes

  16. 16

    D3 Force Graph With Arrows and Curved Edges - shorten links so arrow doesnt overlap nodes

  17. 17

    "Hard" filtering of nodes in a d3,js force-directed graph

  18. 18

    D3 Tree - How to expand tree to show and highlight all nodes of same name?

  19. 19

    Vue D3 - Select newly generated nodes only to stop event propagation

  20. 20

    Adding and removing nodes and links from force diagram in d3 based on filter dropdown

  21. 21

    How do i select all nodes and apply a css style to all of them, D3

  22. 22

    d3.jsの内部バブルチャート

  23. 23

    d3.jsの内部バブルチャート

  24. 24

    Why does this recursive function counting nodes in a binary search tree always return a result larger than expected?

  25. 25

    In the as.party function how can I clarify which are the indices for the different nodes?

  26. 26

    D3v4 inserting new nodes

  27. 27

    d3.js Cluster bubbles with over 2600 nodes

  28. 28

    フォーム検証でvalidation-bubble-messageを削除する方法

  29. 29

    D3でマルチレベルオブジェクトからチャートを作成する

ホットタグ

アーカイブ