1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- function changelines(fcolor,tcolor) {
- var conn = $('#graphcolumn .draw .lines .conn-' + fcolor);
- conn.removeClass('conn-' + fcolor);
- conn.addClass('conn-' + tcolor);
- }
- function drawline(from,to,between,color) {
- var nfrom = $('#graphcolumn .draw g.node[data-id=' + from + ']');
- var nto = $('#graphcolumn .draw g.node[data-id=' + to + ']');
- var conn = $('#graphcolumn .draw defs .conn-' + color).clone();
- var points = [];
- var devx = 3.9;
- var devy = 1.5;
- points.push((parseInt(nfrom.data('x')) + devx) + ',' + (parseInt(nfrom.data('y')) + devy));
- $(between).each(function(k,val){
- if (val[0] == 'f') { val[0] = parseInt(nfrom.data('x')) + devx; }
- if (val[1] == 'f') { val[1] = parseInt(nfrom.data('y')) + devy; }
- if (val[0] == 't') { val[0] = parseInt(nto.data('x')) + devx; }
- if (val[1] == 't') { val[1] = parseInt(nto.data('y')) + devy; }
- points.push(val.join(','));
- });
- points.push((parseInt(nto.data('x')) + devx) + ',' + (parseInt(nto.data('y')) + devy));
- conn.attr('points',points.join(' '));
- $('#graphcolumn .draw .lines').append(conn);
- }
- function drawnode(id,x,y,text) {
- var clonode = $('#graphcolumn .draw defs .node').clone();
- clonode.attr('transform','translate(' + x + ' ' + y +')');
- clonode.attr('data-id',id);
- clonode.attr('data-x',x);
- clonode.attr('data-y',y);
- $(text.split('\n')).each(function(k1,val1){
- var tspan = $('#graphcolumn .draw defs .text').clone();
- tspan.text(val1);
- $(clonode).find('text').append(tspan);
- });
- $('#graphcolumn .draw .texts').append(clonode);
- }
|