Skip to content

Quick use with d3.js v4? #1

@franzvezuli

Description

@franzvezuli

Hello!

I'm new to d3, and it's great so far! Right now my project is using d3v4, and I've been going crazy trying to configure the node sizes on a per node basis.

So I found d3-flextree, and it looked perfect! Having a function getting passed to .nodeSize() would be great.

However it wasn't available for v4, then I saw this version here so I'm trying it out. I'm a bit confused how to use though, on this page: https://github.com/d3/d3/wiki/Plugins - plugins just have a simple <script> import to use along with their Node.js implementations. However when I just try to use the raw JS script, it gives me this error:

Uncaught ReferenceError: module is not defined

for this line:

const Node = require('d3-hierarchy/src/hierarchy/index').Node;

I read that d3.js v4 is modular, so you can just import the ones you need. However I just have the whole project like so:

<script src="https://d3js.org/d3.v4.min.js"></script>

My wish it to just do something like this:

<script src="https://example.com/d3-flextree-v4.js"></script>

I'm not using Node.js, this is just straight javascript.

Thanks if anyone can help! Trying to get this to import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions