Christian
Christian

Reputation: 888

Nameless error using d3.js

I get a strange nameless error message when drawing a bubble chart using d3.js. The chart is working but code after the error is not executed.

Error:          d3.v4.js:3554:42
easeConstant    https://d3js.org/d3.v4.js:3554:42
transition_ease https://d3js.org/d3.v4.js:3564:19
drawbubble      http://testinvest.pl4y6r0und.net/JSInclude/d3.bubblegraph.js:143:5
<anonym>        http://testinvest.pl4y6r0und.net/KeywordCorrelation.php:84:21
fire            https://code.jquery.com/jquery-1.12.4.js:3232:11
fireWith        https://code.jquery.com/jquery-1.12.4.js:3362:7
done            https://code.jquery.com/jquery-1.12.4.js:9840:5
callback        https://code.jquery.com/jquery-1.12.4.js:10311:8

This is how drawbubble:143 looks like

svg.selectAll("circle")
        .data(data)
        .enter()
        .insert("circle")
        .attr("cx", width / 2)
        .attr("cy", height / 2)
        .attr("opacity", function (d) {
            return opacity(d.size);
        })
        .attr("r", function (d) {
            return scale(d.size);
        })
        .style("fill", function (d) {
            return color(d.c);
        })
        .on('mouseover', function (d, i) {
            fade(d.c, .1);
        })
        .on('mouseout', function (d, i) {
            fadeOut();
        })
        .transition()
        .delay(function (d, i) {
            return x(d.x) - y(d.y);
        })
        .duration(500)
        .attr("cx", function (d) {
            return x(d.x);
        })
        .attr("cy", function (d) {
            return y(d.y);
        })
        .ease("bounce");

Upvotes: 1

Views: 175

Answers (1)

feihcsim
feihcsim

Reputation: 1552

Looks like your usage of .ease("bounce") is a leftover from d3 v3 but I can see you're using v4 (https://d3js.org/d3.v4.js). Try updating your code to instead use easeBounce of v4. Here's a good reference: https://bl.ocks.org/d3noob/1ea51d03775b9650e8dfd03474e202fe

Upvotes: 3

Related Questions