question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3.1.9 crossfilter is not a function

See original GitHub issue

Recently I tried to run npm update on a vue website that uses dc.js and it changed the crossfilter import that is exposed by dc.js.

Here is a screenshot of the updated package list in case this was not a direct result of dc.js being updated

dc version from 3.1.2 -> 3.1.9 d3 version from 5.10.0 -> 5.15.0 crossfilter2 version from 1.4.7 -> 1.5.2 (problem?)

Screenshot of package.json diff

Screen Shot 2020-02-07 at 3 28 02 PM

after some quick inspection it appears that the dc.crossfilter wasn’t imported correctly and can be fixed by either:

updating the reference on on dc.js:13925 from dc.crossfilter = crossfilter to dc.crossfilter = crossfilter.default

or

just using dc.crossfilter.default(dataArray) without editing any dc.js source directly

I definitely feel that the workaround listed above isn’t the correct way to solve the issue I’ve come across, but judging by the version numbers, it looks like dc.js should be compatible with the version of d3 and crossfilter being used but may not be imported correctly into dc 3.1.9.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gordonwoodhullcommented, Feb 12, 2020

Thanks very much for your thorough testing.

It sounds like it is “simply” a bug in crossfilter2@1.5 where the interface is not backward compatible when used in the vue bundler. I suspect it’s the same issue in the above crossfilter/Angular issue. From your dependency list it doesn’t look like you are using Typescript, but maybe Babel transpilation has something to do with it.

I don’t see any reason to believe this has to do with dc.js in particular, so I’m going to open a crossfilter issue. And yeah, I supposed dc.js could peg to the old version of crossfilter but I’d rather not do that, especially since this doesn’t seem to be a JavaScript issue but a bundler issue.

I’ll leave this issue open as a reminder to remove crossfilter from the public interface of dc.js in 3.2, since it just complicates things.

0reactions
Spacararcommented, Feb 11, 2020

I didn’t try using dc.js 4.0 as this is in a pretty large project currently and was worried about reworking the code at the moment though may not be that much work looking at your upgrade guide.

currently everything is working using dc@3.1.2 crossfilter2@1.4.7 and d3@5.15.0

It seems the d3 version doesn’t affect my current implementation as it was updated from 5.10.0 -> 5.15.0 and worked with any of the dc/crossfilter2 versions I have tried.

after retrying dc@3.1.9 and crossfilter2@1.4.7 it appears I may have been mistaken or this was a caching issue from when I had installed crossfilter2@1.5.2 because this combination appears to be working for me.

I can however confirm that dc@3.1.9 with crossfilter2@1.5.2 does not work for me running a vue project on a Mac with the error described in the original post that crossfilter is not a function.

I’m unfamiliar with how npm update actually works but could dc@3.X.X be limited to crossfilter2@1.4.X rather than crossfilter2@1.5.X?

Read more comments on GitHub >

github_iconTop Results From Across the Web

DC js charts, crossfilter not filtering on click - Stack Overflow
I have an issue where my dc charts are not filtering each other upon clicking a selection on a chart. It does work...
Read more >
Cross filter function not working for multiple visual.
I am trying to add Cross filter function for both visual ones i put the both measure in a filters pane visual level...
Read more >
dc | Yarn - Package Manager
Dimensional charting built to work natively with crossfilter rendered using d3.js. In dc.js, each chart displays an aggregation of some attributes through ...
Read more >
CROSSFILTER function - DAX | Microsoft Learn
In CROSSFILTER, the cross-filtering setting of a relationship is not important; that is, whether the relationship is set to filter one, ...
Read more >
crossfilter.js + d3.js + dc.js example - Unsaved project - Plunker
0 : NaN; }; d3.descending = function(a, b) { return b < a ? -1 : b > a ? 1 : b...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found