53seven / d3-nelson-rules

d3 utility to apply nelsons rules of process control to a set of data
MIT License
16 stars 4 forks source link

undefined when loading using RequireJS on Qlik Sense #1

Closed fabio-hora closed 7 years ago

fabio-hora commented 7 years ago

Hi,

First thanks for the library. I was able to make it work on a browser, thanks to your example. I'm trying to add it into a Qlik Sense extension, using RequireJS define function. I get no error doing so, but when I try to call the nelson function, I get this:

TypeError: Cannot read property 'nelson' of undefined

The call I'm using:

var nelson = d3_nelson_rules.nelson().value(function(d) { return d; });

Thanks again,

Fabio

kiernanmcgowan commented 7 years ago

Hmm, the build should be able to opened via RequireJS. Your error implies that d3_nelson_rules is not being loaded via requirejs properly, are you using the correct module name d3-nelson-rules (note dash-case vs snake_case).

My guess is that it should look something like:

requirejs(['d3-nelson-rules'], function(d3_nelson_rules) {
var nelson = d3_nelson_rules.nelson().value(function(d) { return d; });
}); 

Can you post a code snippet?