D3 not available when RequireJS is present
See original GitHub issueWhen I call chart.render() for piechart it throws the following error:
keen.js:19724 Unhandled rejection TypeError: d3.select is not a function
at Dataviz.module.exports (http://localhost:8010/lib/keen.js:23456:25)
at Dataviz.render (http://localhost:8010/lib/keen.js:24074:40)
at http://localhost:8010/lib/keen.js:23264:55
at domReady (http://localhost:8010/lib/keen.js:23361:13)
at Dataviz.render (http://localhost:8010/lib/keen.js:23242:9)
Using version 4.3.0 of keen-js. Furthermore the legend is not showing in any chart type.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Requirejs, d3 and nvd3 integration - javascript - Stack Overflow
I'm facing the problem of integrating requirejs with d3 and nvd3, and i found an easy solution using require's shim. Using the shim...
Read more >RequireJS API
If this function returns a value, //then that value is used as the module export value //instead of the object found via the...
Read more >How to use D3 Component library in Require.js Dashboard
How to use D3 Component library plugin in Require.js Dashboard.?Right now d3 component library is missing in Require.js dashboard.
Read more >d3 CVC not working when embedded using visualize.js
You are trying to embed one of the example d3 CVC components (d3_treemap) using visualize.js and are encountering a "Report render error".
Read more >Have trouble with require/requirejs - Jupyter Community Forum
Hi, The answer found from Display d3.js visualisation in Jupyter Lab - Stack Overflow works in jupyter lab but not in the “classic”...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @alejandromagnorsky ,
We’ve just published new versions of our 3 core libs.
Moving from keen-js main package to standalone packages will give you much more freedom and new opportunities. Especially if you are using js bundlers.
Thanks
Thank your for digging into that further and helping figuring this out!
Require has issues with nested dependencies that also define Require modules. I just double-checked the version of D3 we’re including, and it’s module definition block looks like this:
If I’m reading this correctly, when RequireJS is present the D3 module just isn’t loaded the way our library expects to reference it… which in turn triggers the
d3.select is not a function
error you noted. I’ll look into solutions for patching this up… Sorry for the bumpy ride!As for the original issue, I think this
id.substring()
error stems from an edge case with the type of data being passed in. Categorical data labels are passed in as a string, but in this case those labels are likelyDate
instances, since your query uses an interval but no groups.Example:
Try changing the
type
to'line'
or'area'
and it should work as expected. I’ll look into the error and see if type-enforcement can squash the issue.