Thursday, 18 May 2017

How to use d3-jetpack with d3v4?

I am trying to recreate this You Draw It graph:https://bl.ocks.org/1wheel/07d9040c3422dac16bd5be741433ff1e

It requires d3.conventions function which is in d3-jetpack which I found here: https://github.com/gka/d3-jetpack

raw d3v4 version is here: https://raw.githubusercontent.com/gka/d3-jetpack/master/build/d3v4%2Bjetpack.js

^I saved this file in the same folder as my index.html.

How do I import it into my index.html for my project?

ATTEMPT 1

Here is what I tried:

<script>
var d3 = Object.assign({}, require('d3v4+jetpack.js'));
</script>

This is the error I get: Uncaught ReferenceError: require is not defined

ATTEMPT 2

Added <script src="d3v4+jetpack.js"></script> in the header of the html file. Says d3.conventions still not found.



via pr338

No comments:

Post a Comment