Migrating from v3 to v4

145 views
Skip to first unread message

Erin McCaffrey

unread,
Aug 17, 2016, 5:58:11 PM8/17/16
to d3-js
Hey guys - I am currently migrating a parallel coordinates viz from v3 to v4 - would any of you have any ideas as to why the paths are showing up, but not the axis or labels? I can't seem to figure it out.

Seemant Kulleen

unread,
Aug 17, 2016, 7:22:00 PM8/17/16
to d3-js
Happy Wednesday Erin!

The v4 migration can be a bit tricky.  Are you able to share your code?  It would make it easier to debug if we could see it.

Cheers,
Seemant

--
Oakland Finish Up Weekend
Be Amazed.  Be Amazing.
Get Mentored | Get Inspired | Finish Up
http://oaklandfinishup.com


On Wed, Aug 17, 2016 at 2:58 PM, Erin McCaffrey <ekmcc...@gmail.com> wrote:
Hey guys - I am currently migrating a parallel coordinates viz from v3 to v4 - would any of you have any ideas as to why the paths are showing up, but not the axis or labels? I can't seem to figure it out.

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Erin McCaffrey

unread,
Aug 18, 2016, 9:01:47 AM8/18/16
to d3-js

Sure thing! I'm very new to d3 (and coding in general) so I've put where I think/hope the issue is below. I've also attached an image of the difference between the two viz. Let me know if this doesn't seem right and I can include more of the code.

tickFormats = { "Time": msToDate  }

function msToDate(t) {
        var d = new Date(t);
        var date = d.toLocaleDateString();
        return date + " " + d.toLocaleTimeString();
    }

tickCounts = {}
y = {}

Original in v3:

var axis = d3.svg.axis().orient("left");

// Add a group element for each dimension
        var g = graph.selectAll(".dimension")
            .data(columns);
        g.enter().append("g")
            .attr("class", "dimension")
            .attr("transform", function (d) { return "translate(" + x(d) + ")"; });

    g.selectAll(".tick").remove();
// Add an axis and title
        g.append("g")
            .attr("class", "axis")
            .each(function (d) {
                var format = function (p) { return p; }
                if (tickFormats.hasOwnProperty(d))
                    format = tickFormats[d];
                if (tickCounts.hasOwnProperty(d))
                    d3.select(this).call(axis.scale(y[d]).ticks(tickCounts[d]).tickFormat(format));
                else
                    d3.select(this).call(axis.scale(y[d]).ticks(10).tickFormat(format));
            })
        .append("text")
            .style("text-anchor", "middle")
            .attr("y", -9)
            .text(function (d) { return d; });
    }


what I have currently in v4:

var axis = d3.axisLeft();

// Add a group element for each dimension
        var g = graph.selectAll(".dimension")
            .data(columns);
        g.enter().append("g")
            .attr("class", "dimension")
            .attr("transform", function (d) { return "translate(" + x(d) + ")"; });

       g.selectAll(".tick").remove();
// Add an axis and title
        g.append("g")
            .attr("class", "axis")
            .each(function (d) {
                var format = function (p) { return p; }
                if (tickFormats.hasOwnProperty(d))
                    format = tickFormats[d];
                if (tickCounts.hasOwnProperty(d))
                    d3.select(this).call(axis.scale(y[d]).tickArguments([tickCounts[d], format]));
                else
                    d3.select(this).call(axis.scale(y[d]).tickArguments([10, format]));
            })
        .append("text")
            .style("text-anchor", "middle")
            .attr("y", -9)
            .text(function (d) { return d; });
    }

On Wednesday, August 17, 2016 at 7:22:00 PM UTC-4, seemantk wrote:
Happy Wednesday Erin!

The v4 migration can be a bit tricky.  Are you able to share your code?  It would make it easier to debug if we could see it.

Cheers,
Seemant

--
Oakland Finish Up Weekend
Be Amazed.  Be Amazing.
Get Mentored | Get Inspired | Finish Up
http://oaklandfinishup.com


On Wed, Aug 17, 2016 at 2:58 PM, Erin McCaffrey <ekmcc...@gmail.com> wrote:
Hey guys - I am currently migrating a parallel coordinates viz from v3 to v4 - would any of you have any ideas as to why the paths are showing up, but not the axis or labels? I can't seem to figure it out.

--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
parcoordviz.png

Konrad Sobon

unread,
Sep 12, 2017, 10:01:11 AM9/12/17
to d3-js
Hi Erin,

Were you able to get this sorted out? I am looking at the translation to v4 as well, and I am raking my head with no results. 
Reply all
Reply to author
Forward
0 new messages