dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.41k stars 1.81k forks source link

Is DC v4 compatible with D3 v7? #1882

Open JG-QuarkNet opened 9 months ago

JG-QuarkNet commented 9 months ago

I'm trying to update a webapp that uses DC.js, D3.js, and Crossfilter to use all currently-supported versions of these libraries.

When I test using the following versions

dc.js          4.0.0
dc CSS         3.0.3
d3.js          7.8.5
Crossfilter    1.5.4

the graphs misbehave and the console logs the error

Uncaught TypeError: r.event is undefined
    _brushing coordinate-grid-mixin.js:978
    renderBrush coordinate-grid-mixin.js:935
    call d3-7.8.5.min.js:2
    emit d3-7.8.5.min.js:2
    start d3-7.8.5.min.js:2
    move d3-7.8.5.min.js:2
    each d3-7.8.5.min.js:2
    move d3-7.8.5.min.js:2
    call d3-7.8.5.min.js:2
    redrawBrush coordinate-grid-mixin.js:1028
    renderBrush coordinate-grid-mixin.js:946
    _drawChart coordinate-grid-mixin.js:1149
    _doRender coordinate-grid-mixin.js:1114
    render base-mixin.js:657
    render bar-chart.js:78
    <anonymous> (index):816
    jQuery 8
    <anonymous> (index):728
    jQuery 8

The root of the error stack is attributed to coordinate-grid-mixin.js:978:13, which only exists on this system as a reference within the DC v4 map file dc-4.0.0.min.js.map.

I'm guessing that r.event refers to d3.event, which was removed in D3 v6, and that DC hasn't yet been updated to reflect its removal. Is that the case, and if so, have you determined what the highest version of D3 is that DC v4 is compatible with? I've looked through the issues here and found lots of discussion about D3 and DC versions, but I couldn't find a clear statement of the bottom line.

Thanks for your work on the library.

caracal7 commented 7 months ago

dc.js 5.0.0 alpha is working for me with d3 7.8.5 without any issues

gordonwoodhull commented 7 months ago

Since D3 and dc.js are both evolving, the best way to answer this sort of question is to look at the package.json for the version of dc.js you are using

dc.js 4.0.0 is compatible with d3 5.15

https://github.com/dc-js/dc.js/blob/66f6f31700251afd6b0630e7a9b397296ecf99ed/package.json#L28

dc.js 4.2.7 is compatible with d3 6.6.2

According to the changelog, version 4.1 and above is compatible with d3 6. while remaining compatible with 5.

https://github.com/dc-js/dc.js/blob/18a05a92b01693ebaf9fbf3afda4ee820f54621a/package.json#L28

Deepak has taken over as of dc.js 5.* - looks like the latest on dc-v5 branch is compatible with d3 7.1.1

https://github.com/dc-js/dc.js/blob/390d8a6c18735e1bbfcadfb5c7334c9c77382901/package.json#L28

JG-QuarkNet commented 6 months ago

Thanks for the info! Do you know if there's going to be a stable release of 4.27 or anything on 5.*?

gordonwoodhull commented 6 months ago

4.2.7 is a stable release - up through 4.* we followed continuous integration and a scaled-down variant of semantic versioning.

@kum-deepak introduced a lot of breaking changes in 5.*, and for good reason. He has cleaned things up quite a bit.

Maybe he can answer how stable the dc-v5 branch is.