2015-10-25 11:35:26 +01:00
|
|
|
/**
|
2015-10-28 08:12:47 +01:00
|
|
|
* Created by knut on 14-11-23.
|
2015-10-25 11:35:26 +01:00
|
|
|
*/
|
2015-10-28 08:12:47 +01:00
|
|
|
|
|
|
|
var cd = require('./parser/classDiagram').parser;
|
2015-10-29 07:49:08 +01:00
|
|
|
var cDDb = require('./classDb');
|
|
|
|
cd.yy = cDDb;
|
2015-10-28 08:12:47 +01:00
|
|
|
var d3 = require('../../d3');
|
2015-11-15 15:06:24 +01:00
|
|
|
var Logger = require('../../logger');
|
|
|
|
var dagre = require('dagre');
|
2015-10-28 08:12:47 +01:00
|
|
|
var log = new Logger.Log();
|
|
|
|
|
2015-10-30 11:34:24 +01:00
|
|
|
var idCache;
|
2015-11-15 15:06:24 +01:00
|
|
|
idCache = {};
|
|
|
|
|
|
|
|
var classCnt = 0;
|
2015-10-28 08:12:47 +01:00
|
|
|
var conf = {
|
2015-11-04 20:38:14 +01:00
|
|
|
dividerMargin: 10,
|
|
|
|
padding: 5,
|
|
|
|
textHeight: 14
|
2015-10-28 08:12:47 +01:00
|
|
|
};
|
|
|
|
|
2015-10-30 10:47:25 +01:00
|
|
|
// Todo optimize
|
2015-11-04 20:38:14 +01:00
|
|
|
var getGraphId = function (label) {
|
2015-11-15 15:06:24 +01:00
|
|
|
var keys = Object.keys(idCache);
|
|
|
|
|
|
|
|
var i;
|
|
|
|
for(i=0;i<keys.length;i++){
|
|
|
|
if(idCache[keys[i]].label === label){
|
|
|
|
return keys[i];
|
|
|
|
}
|
2015-10-30 10:47:25 +01:00
|
|
|
}
|
2015-11-15 15:06:24 +01:00
|
|
|
|
2015-10-30 10:47:25 +01:00
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
/**
|
|
|
|
* Setup arrow head and define the marker. The result is appended to the svg.
|
|
|
|
*/
|
|
|
|
var insertMarkers = function (elem) {
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'extensionStart')
|
|
|
|
.attr('class', 'extension')
|
|
|
|
.attr('refX', 0)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 190)
|
|
|
|
.attr('markerHeight', 240)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 1,7 L18,13 V 1 Z');
|
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'extensionEnd')
|
|
|
|
.attr('refX', 19)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 20)
|
|
|
|
.attr('markerHeight', 28)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 1,1 V 13 L18,7 Z'); //this is actual shape for arrowhead
|
2015-11-07 10:00:40 +01:00
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'compositionStart')
|
|
|
|
.attr('class', 'extension')
|
|
|
|
.attr('refX', 0)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 190)
|
|
|
|
.attr('markerHeight', 240)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
|
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'compositionEnd')
|
|
|
|
.attr('refX', 19)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 20)
|
|
|
|
.attr('markerHeight', 28)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
|
|
|
|
|
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'aggregationStart')
|
|
|
|
.attr('class', 'extension')
|
|
|
|
.attr('refX', 0)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 190)
|
|
|
|
.attr('markerHeight', 240)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
|
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'aggregationEnd')
|
|
|
|
.attr('refX', 19)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 20)
|
|
|
|
.attr('markerHeight', 28)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
|
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'dependencyStart')
|
|
|
|
.attr('class', 'extension')
|
|
|
|
.attr('refX', 0)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 190)
|
|
|
|
.attr('markerHeight', 240)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 5,7 L9,13 L1,7 L9,1 Z');
|
|
|
|
|
|
|
|
elem.append('defs').append('marker')
|
|
|
|
.attr('id', 'dependencyEnd')
|
|
|
|
.attr('refX', 19)
|
|
|
|
.attr('refY', 7)
|
|
|
|
.attr('markerWidth', 20)
|
|
|
|
.attr('markerHeight', 28)
|
|
|
|
.attr('orient', 'auto')
|
|
|
|
.append('path')
|
|
|
|
.attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
|
2015-11-04 20:38:14 +01:00
|
|
|
};
|
|
|
|
|
2015-11-11 13:16:38 +01:00
|
|
|
var edgeCount = 0;
|
2015-11-04 20:38:14 +01:00
|
|
|
var drawEdge = function (elem, path, relation) {
|
2015-11-11 13:16:38 +01:00
|
|
|
var getRelationType = function (type) {
|
|
|
|
switch (type) {
|
2015-11-07 10:00:40 +01:00
|
|
|
case cDDb.relationType.AGGREGATION:
|
|
|
|
return 'aggregation';
|
|
|
|
case cDDb.relationType.EXTENSION:
|
|
|
|
return 'extension';
|
|
|
|
case cDDb.relationType.COMPOSITION:
|
|
|
|
return 'composition';
|
|
|
|
case cDDb.relationType.DEPENDENCY:
|
|
|
|
return 'dependency';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-10-30 10:47:25 +01:00
|
|
|
//The data for our line
|
|
|
|
var lineData = path.points;
|
|
|
|
|
|
|
|
//This is the accessor function we talked about above
|
|
|
|
var lineFunction = d3.svg.line()
|
2015-11-04 20:38:14 +01:00
|
|
|
.x(function (d) {
|
|
|
|
return d.x;
|
|
|
|
})
|
|
|
|
.y(function (d) {
|
|
|
|
return d.y;
|
|
|
|
})
|
|
|
|
//.interpolate('cardinal');
|
|
|
|
.interpolate('basis');
|
|
|
|
|
2015-11-07 10:00:40 +01:00
|
|
|
var svgPath = elem.append('path')
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('d', lineFunction(lineData))
|
2015-11-11 13:16:38 +01:00
|
|
|
.attr('id', 'edge' + edgeCount)
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('class', 'relation');
|
2015-11-21 11:51:15 +01:00
|
|
|
var url = '';
|
|
|
|
if(conf.arrowMarkerAbsolute){
|
|
|
|
url = window.location.protocol+'//'+window.location.host+window.location.pathname +window.location.search;
|
|
|
|
url = url.replace(/\(/g,'\\(');
|
|
|
|
url = url.replace(/\)/g,'\\)');
|
|
|
|
}
|
2015-11-04 20:38:14 +01:00
|
|
|
|
2015-11-07 10:00:40 +01:00
|
|
|
//console.log(relation.relation.type1);
|
2015-11-11 13:16:38 +01:00
|
|
|
if (relation.relation.type1 !== 'none') {
|
|
|
|
svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')');
|
|
|
|
}
|
|
|
|
if (relation.relation.type2 !== 'none') {
|
|
|
|
svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')');
|
|
|
|
}
|
|
|
|
|
|
|
|
//var bbox = svgPath[0][0].getBBox();
|
|
|
|
//var x = Math.floor(bbox.x + bbox.width/2.0);
|
|
|
|
//var y = Math.floor(bbox.y + bbox.height/2.0);
|
|
|
|
var x, y;
|
|
|
|
var l = path.points.length;
|
|
|
|
if ((l % 2) !== 0) {
|
|
|
|
var p1 = path.points[Math.floor(l / 2)];
|
|
|
|
var p2 = path.points[Math.ceil(l / 2)];
|
|
|
|
x = (p1.x + p2.x) / 2;
|
|
|
|
y = (p1.y + p2.y) / 2;
|
2015-11-07 10:00:40 +01:00
|
|
|
}
|
2015-11-11 13:16:38 +01:00
|
|
|
else {
|
|
|
|
var p = path.points[Math.floor(l / 2)];
|
|
|
|
x = p.x;
|
|
|
|
y = p.y;
|
2015-11-07 10:00:40 +01:00
|
|
|
}
|
2015-11-11 13:16:38 +01:00
|
|
|
|
|
|
|
if (typeof relation.title !== 'undefined') {
|
|
|
|
var g = elem.append('g').
|
|
|
|
attr('class','classLabel');
|
|
|
|
var label = g.append('text')
|
|
|
|
.attr('class', 'label')
|
|
|
|
.attr('x', x)
|
|
|
|
.attr('y', y)
|
|
|
|
.attr('fill', 'red')
|
|
|
|
.attr('text-anchor', 'middle')
|
|
|
|
.text(relation.title);
|
|
|
|
|
|
|
|
window.label = label;
|
|
|
|
var bounds = label.node().getBBox();
|
|
|
|
|
|
|
|
g.insert('rect', ':first-child')
|
|
|
|
.attr('class', 'box')
|
|
|
|
.attr('x', bounds.x-conf.padding/2)
|
|
|
|
.attr('y', bounds.y-conf.padding/2)
|
|
|
|
.attr('width', bounds.width + 2 * conf.padding/2)
|
|
|
|
.attr('height', bounds.height + 2 * conf.padding/2);
|
|
|
|
//.append('textpath')
|
|
|
|
//.attr('xlink:href','#edge'+edgeCount)
|
|
|
|
//.attr('text-anchor','middle')
|
|
|
|
//.attr('startOffset','50%')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
edgeCount++;
|
2015-10-30 10:47:25 +01:00
|
|
|
}
|
2015-10-28 08:12:47 +01:00
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
var drawClass = function (elem, classDef) {
|
|
|
|
log.info('Rendering class ' + classDef);
|
2015-11-01 19:00:14 +01:00
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
var addTspan = function (textEl, txt, isFirst) {
|
2015-11-01 19:00:14 +01:00
|
|
|
var tSpan = textEl.append('tspan')
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('x', conf.padding)
|
2015-11-01 19:00:14 +01:00
|
|
|
.text(txt);
|
2015-11-04 20:38:14 +01:00
|
|
|
if (!isFirst) {
|
|
|
|
tSpan.attr('dy', conf.textHeight);
|
2015-11-01 19:00:14 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-11-15 15:06:24 +01:00
|
|
|
var id = 'classId' + classCnt;
|
|
|
|
var classInfo = {
|
2015-11-04 20:38:14 +01:00
|
|
|
id: id,
|
|
|
|
label: classDef.id,
|
|
|
|
width: 0,
|
|
|
|
height: 0
|
2015-10-30 10:47:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
var g = elem.append('g')
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('id', id)
|
|
|
|
.attr('class', 'classGroup');
|
|
|
|
var title = g.append('text')
|
2015-11-01 19:00:14 +01:00
|
|
|
.attr('x', conf.padding)
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('y', conf.textHeight + conf.padding)
|
2015-10-29 07:49:08 +01:00
|
|
|
.text(classDef.id);
|
2015-10-28 08:12:47 +01:00
|
|
|
|
2015-11-01 19:00:14 +01:00
|
|
|
var titleHeight = title.node().getBBox().height;
|
|
|
|
|
|
|
|
var membersLine = g.append('line') // text label for the x axis
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('x1', 0)
|
|
|
|
.attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2)
|
|
|
|
.attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2);
|
2015-11-01 19:00:14 +01:00
|
|
|
|
|
|
|
var members = g.append('text') // text label for the x axis
|
|
|
|
.attr('x', conf.padding)
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('y', titleHeight + (conf.dividerMargin) + conf.textHeight)
|
2015-11-01 19:00:14 +01:00
|
|
|
.attr('fill', 'white')
|
|
|
|
.attr('class', 'classText');
|
|
|
|
|
2015-11-15 15:06:24 +01:00
|
|
|
var isFirst = true;
|
2015-11-21 11:51:15 +01:00
|
|
|
|
|
|
|
classDef.members.forEach(function(member){
|
|
|
|
addTspan(members, member, isFirst);
|
|
|
|
isFirst = false;
|
|
|
|
});
|
|
|
|
//for (var member of classDef.members) {
|
|
|
|
// addTspan(members, member, isFirst);
|
|
|
|
// isFirst = false;
|
|
|
|
//}
|
2015-11-01 19:00:14 +01:00
|
|
|
|
|
|
|
var membersBox = members.node().getBBox();
|
|
|
|
|
|
|
|
var methodsLine = g.append('line') // text label for the x axis
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('x1', 0)
|
|
|
|
.attr('y1', conf.padding + titleHeight + 3 * conf.dividerMargin / 2 + membersBox.height)
|
|
|
|
.attr('y2', conf.padding + titleHeight + 3 * conf.dividerMargin / 2 + membersBox.height);
|
2015-11-01 19:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
var methods = g.append('text') // text label for the x axis
|
|
|
|
.attr('x', conf.padding)
|
2015-11-04 20:38:14 +01:00
|
|
|
.attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight)
|
2015-11-01 19:00:14 +01:00
|
|
|
.attr('fill', 'white')
|
|
|
|
.attr('class', 'classText');
|
|
|
|
|
|
|
|
isFirst = true;
|
2015-11-21 11:51:15 +01:00
|
|
|
|
|
|
|
classDef.methods.forEach(function(method){
|
|
|
|
addTspan(methods, method, isFirst);
|
|
|
|
isFirst = false;
|
|
|
|
});
|
|
|
|
//for (var method of classDef.methods) {
|
|
|
|
// addTspan(methods, method, isFirst);
|
|
|
|
// isFirst = false;
|
|
|
|
//}
|
2015-11-01 19:00:14 +01:00
|
|
|
|
|
|
|
var classBox = g.node().getBBox();
|
2015-11-04 20:38:14 +01:00
|
|
|
g.insert('rect', ':first-child')
|
|
|
|
.attr('x', 0)
|
|
|
|
.attr('y', 0)
|
|
|
|
.attr('width', classBox.width + 2 * conf.padding)
|
|
|
|
.attr('height', classBox.height + conf.padding + 0.5 * conf.dividerMargin);
|
2015-11-01 19:00:14 +01:00
|
|
|
|
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
membersLine.attr('x2', classBox.width + 2 * conf.padding);
|
|
|
|
methodsLine.attr('x2', classBox.width + 2 * conf.padding);
|
2015-11-01 19:00:14 +01:00
|
|
|
|
2015-10-30 10:47:25 +01:00
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
classInfo.width = classBox.width + 2 * conf.padding;
|
|
|
|
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
2015-10-30 10:47:25 +01:00
|
|
|
|
2015-11-15 15:06:24 +01:00
|
|
|
idCache[id] = classInfo;
|
2015-10-30 10:47:25 +01:00
|
|
|
classCnt++;
|
|
|
|
return classInfo;
|
2015-10-28 08:12:47 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
module.exports.setConf = function (cnf) {
|
2015-10-28 08:12:47 +01:00
|
|
|
var keys = Object.keys(cnf);
|
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
keys.forEach(function (key) {
|
2015-10-28 08:12:47 +01:00
|
|
|
conf[key] = cnf[key];
|
|
|
|
});
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Draws a flowchart in the tag with id: id based on the graph definition in text.
|
|
|
|
* @param text
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
module.exports.draw = function (text, id) {
|
|
|
|
cd.yy.clear();
|
2015-10-29 07:49:08 +01:00
|
|
|
cd.parse(text);
|
|
|
|
|
2015-11-04 20:38:14 +01:00
|
|
|
log.info('Rendering diagram ' + text);
|
2015-10-30 10:47:25 +01:00
|
|
|
|
|
|
|
|
2015-10-29 07:49:08 +01:00
|
|
|
//// Fetch the default direction, use TD if none was found
|
2015-11-04 20:38:14 +01:00
|
|
|
var diagram = d3.select('#' + id);
|
|
|
|
insertMarkers(diagram);
|
2015-10-30 10:47:25 +01:00
|
|
|
//var svg = diagram.append('svg');
|
2015-10-29 07:49:08 +01:00
|
|
|
|
2015-10-30 10:47:25 +01:00
|
|
|
// Layout graph, Create a new directed graph
|
2015-11-11 13:16:38 +01:00
|
|
|
var g = new dagre.graphlib.Graph({
|
|
|
|
multigraph: true
|
|
|
|
});
|
2015-10-30 10:47:25 +01:00
|
|
|
|
|
|
|
// Set an object for the graph label
|
2015-11-11 13:16:38 +01:00
|
|
|
g.setGraph({
|
|
|
|
isMultiGraph: true
|
|
|
|
});
|
2015-10-30 10:47:25 +01:00
|
|
|
|
|
|
|
// Default to assigning a new object as a label for each new edge.
|
2015-11-04 20:38:14 +01:00
|
|
|
g.setDefaultEdgeLabel(function () {
|
|
|
|
return {};
|
|
|
|
});
|
2015-10-29 07:49:08 +01:00
|
|
|
|
2015-11-15 15:06:24 +01:00
|
|
|
var classes = cDDb.getClasses();
|
|
|
|
var keys = Object.keys(classes);
|
|
|
|
var i;
|
|
|
|
for (i=0;i<keys.length;i++) {
|
|
|
|
var classDef = classes[keys[i]];
|
|
|
|
var node = drawClass(diagram, classDef);
|
2015-10-30 10:47:25 +01:00
|
|
|
// Add nodes to the graph. The first argument is the node id. The second is
|
|
|
|
// metadata about the node. In this case we're going to add labels to each of
|
|
|
|
// our nodes.
|
2015-11-04 20:38:14 +01:00
|
|
|
g.setNode(node.id, node);
|
|
|
|
log.info('Org height: ' + node.height);
|
2015-10-30 10:47:25 +01:00
|
|
|
//g.setNode("swilliams", { label: "Saul Williams", width: 160, height: 100 });
|
|
|
|
//g.setNode("bpitt", { label: "Brad Pitt", width: 108, height: 100 });
|
|
|
|
//g.setNode("hford", { label: "Harrison Ford", width: 168, height: 100 });
|
|
|
|
//g.setNode("lwilson", { label: "Luke Wilson", width: 144, height: 100 });
|
|
|
|
//g.setNode("kbacon", { label: "Kevin Bacon", width: 121, height: 100 });
|
2015-10-28 08:12:47 +01:00
|
|
|
}
|
2015-10-29 07:49:08 +01:00
|
|
|
|
2015-11-15 15:06:24 +01:00
|
|
|
var relations = cDDb.getRelations();
|
2015-11-11 13:16:38 +01:00
|
|
|
var i = 0;
|
2015-11-21 11:51:15 +01:00
|
|
|
relations.forEach(function(relation){
|
|
|
|
i = i + 1;
|
|
|
|
log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
|
|
|
|
g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {relation: relation});
|
|
|
|
});
|
|
|
|
//for (var relation of relations) {
|
|
|
|
// i = i + 1;
|
|
|
|
// log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
|
|
|
|
// g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {relation: relation});
|
|
|
|
//}
|
2015-10-30 10:47:25 +01:00
|
|
|
dagre.layout(g);
|
2015-11-04 20:38:14 +01:00
|
|
|
g.nodes().forEach(function (v) {
|
2015-11-15 15:06:24 +01:00
|
|
|
if(typeof v !== 'undefined'){
|
|
|
|
log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
|
|
|
d3.select('#' + v).attr('transform', 'translate(' + (g.node(v).x - (g.node(v).width / 2)) + ',' + (g.node(v).y - (g.node(v).height / 2)) + ' )');
|
|
|
|
//d3.select('#' +v +' rect').attr('x',(g.node(v).x-(g.node(v).width/2)))
|
|
|
|
//.attr('y',(g.node(v).y-(g.node(v).height/2)));
|
|
|
|
}
|
2015-10-30 10:47:25 +01:00
|
|
|
});
|
2015-11-04 20:38:14 +01:00
|
|
|
g.edges().forEach(function (e) {
|
2015-10-30 10:47:25 +01:00
|
|
|
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
2015-11-07 10:00:40 +01:00
|
|
|
drawEdge(diagram, g.edge(e), g.edge(e).relation);
|
2015-10-30 10:47:25 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2015-11-04 20:38:14 +01:00
|
|
|
diagram.attr('height', '100%');
|
|
|
|
diagram.attr('width', '100%');
|
2015-10-29 07:49:08 +01:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//if(conf.useMaxWidth) {
|
|
|
|
// diagram.attr('height', '100%');
|
|
|
|
// diagram.attr('width', '100%');
|
|
|
|
// diagram.attr('style', 'max-width:' + (width) + 'px;');
|
|
|
|
//}else{
|
|
|
|
// diagram.attr('height',height);
|
|
|
|
// diagram.attr('width', width );
|
|
|
|
//}
|
|
|
|
//diagram.attr('viewBox', (box.startx-conf.diagramMarginX) + ' -' +conf.diagramMarginY + ' ' + width + ' ' + height);
|
2015-10-28 08:12:47 +01:00
|
|
|
};
|