dc-js / dc.js

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

transition issue after upgrading to 4.2.0 #1783

Closed aberenyi closed 3 years ago

aberenyi commented 3 years ago

Hi,

After upgrading to 4.2.0 (from 4.0.3) I ran into this issue:

TypeError: selection.transition is not a function
    at transition (dc.js:423)
    at PieChart._createSlicePath (dc.js:10645)
    at PieChart._createElements (dc.js:10620)
    at PieChart._drawChart (dc.js:10606)
    at PieChart._doRender (dc.js:10570)
    at PieChart.render (dc.js:1942)

Also happens w/ composite line charts:

TypeError: selection.transition is not a function
    at transition (dc.js:423)
    at CompositeChart._renderVerticalGridLines (dc.js:3982)
    at CompositeChart._prepareXAxis (dc.js:3926)
    at CompositeChart._drawChart (dc.js:4577)
    at CompositeChart._doRender (dc.js:4556)
    at CompositeChart.render (dc.js:1942)

The source is most likely the 1.3.2 -> 2.0.0 bump of d3-transition.

I'll try to come up with a workaround - any help finding the cause of this would be appreciated.

Cheers

p.s. found this ancient https://github.com/d3/d3/issues/3262 issue, but I'm virtually certain it's not related

gordonwoodhull commented 3 years ago

I suspect it's a bundler issue. Are you using a bundler and ES6 modules, or using pre-bundled D3?

dc.js 4.2 will use d3@6 by default, but it still works with d3@5. If you are using pre-bundled D3, a workaround could be to force d3@5.

If you are using a bundler with ES6 modules, I have seen a lot of conversations that recommend

 import 'd3-transition';

E.g. see d3/d3-selection#185

aberenyi commented 3 years ago

This was indeed a bundler issue.

I've tried various things - not quite sure which one did the trick.

Anyways, thanks for the lightning fast response, closing.

gordonwoodhull commented 3 years ago

I've tried various things - not quite sure which one did the trick.

Haha, yes, that is the most common solution! Which is why this stuff never gets documented properly.