Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Tymoteusz Motylewski
    @tmotyl_twitter
    hi
    Anybody using d3 v4 micromodules with require.js ?
    Gordon Smith
    @GordonSmith
    @tmotyl_twitter I did a quick test with them, not quite what I was expecting.
    Tymoteusz Motylewski
    @tmotyl_twitter
    I would like to have one d3 object instead of one obect per module e.g. d3_hierarchy d3_select ...
    I had sth like define(['d3-hierarchy', 'd3-select'], function('d3_hierarchy', 'd3_select') {})
    Gordon Smith
    @GordonSmith
    My take is that you have two options:
    1. Create your own d3 bundle as per Mikes instructions (and there will soon be a web page to simplify this).
    2. Manualy create a local object with them:
      require(['d3-hierarchy', 'd3-select'], function([d3Hierarchy d3Select]){
      var d3 = {
       select: d3Select,
       hierarchy: d3Hierarchy
      };
      ...
      })
    With 2 you can wrap up into your own file and then return "d3" - its like creating your own bundle, but on the client at runtime...
    Tymoteusz Motylewski
    @tmotyl_twitter
    thanks Gordon, "d3 bundle as per Mikes instructions" -> can you point me to these instructions?
    Gordon Smith
    @GordonSmith
    Tymoteusz Motylewski
    @tmotyl_twitter
    thanks
    Gordon Smith
    @GordonSmith
    (wasn't the one I was thinking of , but is probably better)
    Brian Rutledge
    @bhrutledge
    I'm trying to wrap my head around zoom.translateExtent in V4, with respect to controlling panning on a TopoJSON map. I've got a live example on bl.ocks.org, with links to prior art. Also posted to StackOverflow.
    Adi Prasetyo
    @brutalcrozt
    guys don't you think it's necessary to update our example to v.4 ? i am new on d3js and stuck on one of these example
    con-ssc
    @con-ssc
    I think examples are not maintained
    at all
    there are also just way to many of them
    Brian Rutledge
    @bhrutledge
    Silver lining: I've found it to be a useful learning experience to adapt the V3 examples for V4. I keep https://github.com/d3/d3/blob/master/CHANGES.md open in a tab. :)
    Andrés
    @andresin87
    I think the main important think is to understand how svg works. Once you understand it, d3 v3 or v4 version decission only deppends on the js version you decice to code and follow the d3 version documentation rules
    Alex
    @alexc101
    is it possible to wrap a window.resize trigger within a .attr function? for example;
      .attr("transform", function(d, i) {
                    $(window).resize(function() {
                        if ($(window).width() >= 760) {
                            return "translate(10," + (10 + i * 15) + ")";
                        }
                        else if ($(window).width() <= 760) {
                            return "translate(" + (10 + i * 15) + "," + 10 + ")";
    
                        }
                    })
                })`
    Andrés
    @andresin87
    $( window ).resize(function() {
       var w = $(window).width();
       xxxx..attr("transform”, function(){ return (w>= 760) ? "translate(10," + (10 + i * 15) + “)” : "translate(" + (10 + i * 15) + "," + 10 + ")"});
       }
    }
    Andrés
    @andresin87
    more or less
    Alex
    @alexc101
    @andresin87 That's got it working, thanks!
    Andrés
    @andresin87
    you need to return a value, not a handler...
    JavascriptMick
    @JavascriptMick
    Has anybody spotted/used/started an Angular2 component library for d3?
    I'm using this (http://mean.expert/2016/05/02/angular-2-chart-component/) as a guide but can't find a library
    naoyashiga
    @naoyashiga
    I have a question. I want to get a testArray hovered value when mouse hovered. But every time, value is 'a'. Why?
    //This is d3.js version4 code
    
    var testArray = ["a", "b", "c"];
    
    var sample = d3.selectAll(".sampleClass").data(testArray);
    
    sample.exit().remove();
    
    sample.enter().append("p")
    .merge(sample)
    .text((s) => s)
    .on("mouseover", (s) => {
        // every time s is 'a'  
        console.log(s);
    });
    Gordon Smith
    @GordonSmith
    @naoyashiga you need to set the class of your newly appended node (also your adding a new event handler on every update cycle which you probably don't want to do:
    //This is d3.js version4 code
    
    var testArray = ["a", "b", "c"];
    
    var sample = d3.selectAll(".sampleClass").data(testArray);
    
    sample.exit().remove();
    
    sample.enter().append("p")
    .attr("class", "sampleClass")
    .on("mouseover", (s) => {
        // every time s is 'a'  
        console.log(s);
    }).merge(sample)
    .text((s) => s);
    (untested)
    naoyashiga
    @naoyashiga
    @GordonSmith thank you
    Pepijn
    @pepf
    Hey Guys, so these circular chord diagrams are pretty awesome right? But are there also examples of chord diagrams that are divided by "left" and "right" rather than positioned on a circle? After some digging I found an example ( http://www.dgisenra.nl/wp-content/uploads/2015/01/Chord-diagram-magnitude.png ), I just haven't found any d3 example of such a diagram
    con-ssc
    @con-ssc
    they are called Sankey Diagrams
    con-ssc
    @con-ssc
    @pepf
    Pepijn
    @pepf
    ok thanks, gonna look for those then
    Valentin Robert
    @Ptival

    Hello, I am encountering an issue where I have something like:

    d3.transition().duration(d).each(() => { ... }).each("end", onFulfilled);

    But I have been experiencing cases where, if I fire multiple of these, only the latest seems to call back.
    Is this to be expected?

    Caleb Martin
    @caleb272
    i recently upgraded to d3 v4 and now its saying ordinal is not defined in this code
    var x = d3.scale.ordinal()
        .rangeRoundBands([0, width], .1)
    Martin Colwell
    @colwem
    Hi, I'm sure this is rudimentary but I can't figure it out. I have a g and under that I have a rect. In the enter I want to append the g then append the rect. I also want to set attr on the g and rect. Then in update I want to change attr on the g and the rect. Somehow I can't figure out how to get the selection for the rects for the update.
    Sorry I know that's confusing. Not sure how I should present my problem.
    Oh you know what. I started with https://bl.ocks.org/mbostock/3048450 and I'
    'm just trying to change it so it works dynamically.
    Martin Colwell
    @colwem
    Ok. I figured it out.
    Alex
    @alexc101
    does anyone know why my xscale isn't matching up the start of the y axis in this line graph? : http://plnkr.co/edit/6VtE38a6CM1pBZ3poHXA?p=preview
    con-ssc
    @con-ssc
    hmm no idea but maybe you want to use a time scale?
    Alex
    @alexc101

    @con-ssc Works better not sure how to get the graph to output though?

    http://plnkr.co/edit/6VtE38a6CM1pBZ3poHXA?p=preview

      .x(function(d) {
        return x(d.date);
      })

    this seems to be causing the problem.

    can you see the version?
    Alex
    @alexc101
    I can now :) thanks for the help!
    con-ssc
    @con-ssc
    no problem
    there is a more elegant way for sure ;)