How to actually use?
yunyu opened this issue · 3 comments
yunyu commented
The information isn't present at all in the readme. Here's what I've tried:
var d3 = require('d3');
require('d3-jetpack');
var sel = d3.select('body');
After Webpacking, I get Uncaught TypeError: d3.select is not a function
. I have both d3 and d3-jetpack modules installed.
If I do
var d3 = require('d3');
var jetpack = require('d3-jetpack');
// ...
c.svg.append('rect').at({width: c.width, height: c.height, opacity: 0})
I get Uncaught TypeError: c.svg.append(...).at is not a function
.
The same also occurs with
var d3 = Object.assign({}, require('d3'), require('d3-jetpack'));
// ...
c.svg.append('rect').at({width: c.width, height: c.height, opacity: 0})
yunyu commented
Managed to get it working with:
var d3 = Object.assign({}, require('d3-selection'), require('d3-shape'), require('d3-drag'), require('d3-array'), require('d3-jetpack'));
Maybe put this in the readme?
pujaarajan commented
If I try this, then I get the error Uncaught ReferenceError: require is not defined. How do I fix this?
yunyu commented
@pujaarajan Use webpack or browserify