|
private nodeDefaults(obj: NodeModel): NodeModel {
obj.constraints = NodeConstraints.Default & ~NodeConstraints.Drag;
let empInfo: EmployeeInfo = obj.data as EmployeeInfo;
let color: string = empInfo.branch === 'subRight' ? '#8E44AD' : '#3498DB';
obj.shape = { type: 'Basic', shape: 'Ellipse' };
obj.style = { fill: color, strokeWidth: 0 };
obj.minWidth = 100;
obj.height = 50;
obj.borderColor = 'red';
obj.borderWidth = 1;
obj.backgroundColor = 'red';
//…
//…
//…
}
|
|
private nodeDefaults(obj: NodeModel): NodeModel {
obj.constraints = NodeConstraints.Default & ~NodeConstraints.Drag;
let empInfo: EmployeeInfo = obj.data as EmployeeInfo;
if (
empInfo.branch === 'Root' ||
empInfo.branch === 'Left' ||
empInfo.branch === 'Right'
) {
//…
//…
obj.width = 70;
obj.height = 40;
obj.annotations = [
{
content: empInfo.Label,
margin: { left: 10, right: 10, top: 10, bottom: 10 },
style: {
color: 'white',
textOverflow: 'Ellipsis',
textWrapping: 'NoWrap'
}
}
];
} else {
let color: string = empInfo.branch === 'subRight' ? '#8E44AD' : '#3498DB';
obj.shape = { type: 'Basic', shape: 'Rectangle' };
obj.style = { fill: color, strokeWidth: 0 };
obj.width = 50;
obj.height = 4;
obj.annotations = [
{
content: empInfo.Label,
offset: { x: 0.5, y: 0 },
verticalAlignment: 'Bottom',
style: {
textOverflow: 'Ellipsis',
textWrapping: 'NoWrap'
}
}
];
return obj;
} |