Coder Social home page Coder Social logo

d3-plugin-captain-sankey's People

Contributors

hongtaobai avatar jasondavies avatar mbostock avatar nmalkin avatar smashtie avatar soxofaan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d3-plugin-captain-sankey's Issues

marker-end causes path to bunch up

I added a marker:

//marker-end of path
svg.append('marker')
.attr('id', "end-arrow")
.attr('markerHeight', 2.5)
.attr('markerWidth', 2, 5)
.attr('orient', 'auto')
.attr('refX', -5)
.attr('refY', 0)
.attr('viewBox', '-5 -5 20 10')
.append('path')
.attr('d', 'M 0,0 m -5,-5 L 0,0 L -5,5 Z')
.style("fill", "#969696");

And then here:
// Enter + Update
links.attr('d', path)
.style("marker-end", "url(#end-arrow)")
.style("stroke-width", function (d) {
return Math.max(1, d.dy);
});

And a slight mod to sankey.js for some room to draw the arrow at the end of the path:

function link(d) {
var xs = d.source.x + d.source.dx,
//added the following to shrink the path so there is room for the arrow;
//however path bunches up in cycle demo, is there a way to smooth out the path a bit
xt = d.target.x - (d.dy / 2),
//xt = d.target.x,

Is there a way to smooth out the path a bit so that it doesn't bunch up as shown in the png.

image

Status

Hi,

I'm very much interested in the cycles support extension developed here.
But after reading through d3's original sankey plugin issues and here, it's not clear to me whether this project is still active or it has been subsumed into other d3's official repo, like d3-sankey.

I'll be closing this when I have an answer.

Thanks.

Improve the layout algorithm in computeNodeDepths

In computeNodeDepths, the node position recalculation is based on a weighted average of the centers of the source/target nodes of incoming/outgoing links.

It would probably be better to use the centers of only the node fractions corresponding with the links

Sankey with variable nodeWidth

Hey @soxofaan, you look like the expert with this plugin.

I was just wondering how feasible it would be to modify it to allow for variable nodeWidths, so that each node could be a block that displayed some other information inside.

In particular, my application is a timeline where groups split and re-join, and I'd like to fix the x-axis to reflect the beginning and end of these groups (i.e. real-time) rather than fixed-width and fixed spacing. It seems like setting the .dx values to a parameter rather than a fixed value is pretty simple; I'm just wondering how much it would mess up the layout algorithm. Any thoughts would be much appreciated!

cc @ldworkin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.