Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Commit

Permalink
Update d3.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jan 13, 2014
1 parent be99b58 commit 577d478
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
17 changes: 6 additions & 11 deletions d3.v3.js
@@ -1,6 +1,6 @@
!function() {
var d3 = {
version: "3.4.0"
version: "3.4.1"
};
if (!Date.now) Date.now = function() {
return +new Date();
Expand Down Expand Up @@ -1179,11 +1179,8 @@
function d3_sgn(x) {
return x > 0 ? 1 : x < 0 ? -1 : 0;
}
function d3_isCCWTurn(a, b, c) {
return d3_cross2d(a, b, c) > 0;
}
function d3_cross2d(o, a, b) {
return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
function d3_cross2d(a, b, c) {
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
}
function d3_acos(x) {
return x > 1 ? 0 : x < -1 ? π : Math.acos(x);
Expand Down Expand Up @@ -3633,9 +3630,9 @@
for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) {
b = v[j];
if (a[1] <= y) {
if (b[1] > y && d3_isCCWTurn(a, b, p)) ++wn;
if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn;
} else {
if (b[1] <= y && !d3_isCCWTurn(a, b, p)) --wn;
if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn;
}
a = b;
}
Expand Down Expand Up @@ -4733,9 +4730,7 @@
function d3_geom_hullUpper(points) {
var n = points.length, hull = [ 0, 1 ], hs = 2;
for (var i = 2; i < n; i++) {
while (hs > 1 && !d3_isCCWTurn(points[hull[hs - 2]], points[hull[hs - 1]], points[i])) {
hs--;
}
while (hs > 1 && d3_cross2d(points[hull[hs - 2]], points[hull[hs - 1]], points[i]) <= 0) --hs;
hull[hs++] = i;
}
return hull.slice(0, hs);
Expand Down

2 comments on commit 577d478

@argb
Copy link

@argb argb commented on 577d478 Jan 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mike,

could you add layer graph drawing layout(hierarchy graph drawing) ,It's very usefull,I have a project need to use graph to present the relationships of data item,I looked up D3,found some hierarchy layout,but there is no proper layout,some of them looks very nice,but not usable and readable.
force graph layout is close to my target,but it's not clear enough,it's has no clear hierarchy,it's not readable enough,so it is not proper to use.

I collected some informations about layer graph drawing layout:

  1. Graphviz | Graphviz - Graph Visualization Software [very good]
    This is a opensource program,very good,if D3 can suport its layout algrithm would be great.

  2. yfiles [very good]
    It's very good too, but it's not opensource.

  3. canviz

  4. viz.js
    The solution was that someone cross compiled Graphviz to Javascript using llvm + emscripten.

  5. others js libs

dagre[dagre-d3|JointJS]

Dracula Graph Library

etc. these are not as good as graphviz.

really expecting d3 surport layer graph drawing algrithm!

@mbostock
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @argb. Please check out d3/d3#349 for a related discussion. Thanks!

Please sign in to comment.