4

I'm experiencing issues with d3 v4.4.0 and v4.7.3 when I'm trying to redraw some chart.

There is a problem with g tag decomposition. When I try to redraw some element:

    rect.transition()
        .attr("transform", rectTransform)
        .attr("height", function (d) {
            return d.oneDayTask ?
                    Math.sqrt(Math.pow(y.bandwidth(), 2) /2)
                :   y.bandwidth();
        })
        .attr("width", function (d) {
            return  d.oneDayTask ?
                    Math.sqrt( Math.pow(y.bandwidth(), 2) / 2)
                :   Math.max(1, (x(d.endDate) - x(d.startDate)));
        });

I get this error:

Uncaught TypeError: Cannot read property 'baseVal' of undefined

Issue is related to this function:

function parseSvg(value) {
    if (value == null) return identity$2;
    if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
    svgNode.setAttribute("transform", value);
    if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2;
    value = value.matrix;
    return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
}

svg.transform is missing (undefined)

It seems to be an issue of LockerService or intended action?

Does anyone have any idea how to solve it?

  • As I can see at this moment none of d3 SVG transformation is available. Christophe Coenraets says that D3 with version 4.4 is verified to be working: blog Yes it is at least most of it. However whenever you're trying to use transfromation you'll get an exception. – Mystery Mar 24 '17 at 13:54
3

This has been resolved in the Summer '17 major release.

LockerService was mistakenly excluding a number of SVG elements and their properties from being exposed. Among these were SVGTransformList and SVGAnimatedTransformList.

Also, please continue to use D3 version 4.4.0 as it is currently the most reliable to work inside Locker.

  • 1
    Good news. Is it in release notes? – Mystery Apr 9 '17 at 19:21
  • I'll talk to the documentation folks about getting it added. – TrevorBliss Apr 10 '17 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.