Skip to content

Instantly share code, notes, and snippets.

@roundrobin
Created June 24, 2012 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roundrobin/2985492 to your computer and use it in GitHub Desktop.
Save roundrobin/2985492 to your computer and use it in GitHub Desktop.
just another inlet to tributary
trib.moveX = 395.6043956043959;
trib.moveY = 72.45501750996254;
var x_scale = d3.scale.linear().domain([-100,100]).range([0,50]);
var p1 = {x:0, y:0};
var p2 = {x:119, y:0, b1:100, b2:100};
var p3 = {x:0, y:100};
var p4 = {x:100, y:100, b1:100, b2:100};
var graph = [p1,p2,p3,p4];
var typeList = ['M','Q','L','Q'];
var adjacentList =[
[0,1,0,0],
[0,0,1,0],
[0,0,0,1],
[0,0,0,0]
];
var topList = [1,1,0,0];
var path = g.append('path');
drawPath();
var Slider1 = function(){}
function drawPath(){
var pathWay = '';
for(i in graph){
var point = graph[i];
var addPath = typeList[i]+point.x+','+point.y+' ';
if(typeList[i] == 'Q')
addPath = typeList[i]+point.b1+','+point.b2+' '+point.x+','+point.y+' ';
pathWay += addPath
}
path.attr('d',pathWay)
.attr('fill','none')
.attr('stroke','black')
.attr('stroke-width','3')
.attr('transform','translate('+trib.moveX+','+trib.moveY+')')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment