more layout engines
This commit is contained in:
@ -17,6 +17,7 @@ export class Edge {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public toString (): string {
|
||||
const attributes = [];
|
||||
|
||||
if (this.style)
|
||||
attributes.push ({ name: 'style', value: this.style.toString () });
|
||||
if (this.color)
|
||||
|
@ -14,6 +14,7 @@ export class Element {
|
||||
|
||||
public constructor (name: string, parent = '') {
|
||||
const regex = /^[a-z_][a-z_0-9]+$/iu;
|
||||
|
||||
if (!regex.test (name))
|
||||
throw new Error ('invalid name specified');
|
||||
this.name = name;
|
||||
|
@ -1,4 +1,10 @@
|
||||
export enum GraphLayouts {
|
||||
neato= 'neato',
|
||||
dot= 'dot'
|
||||
neato = 'neato',
|
||||
dot = 'dot',
|
||||
circo = 'circo',
|
||||
fdp = 'fdp',
|
||||
sfdp = 'sfdp',
|
||||
osage = 'osage',
|
||||
twopi = 'twopi',
|
||||
patchwork = 'patchwork'
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ export class Node extends Element {
|
||||
|
||||
const mapped_columns = this.table_contents
|
||||
.map ((val) => `<td>${val.join ('</td><td>')}</td>`);
|
||||
|
||||
return `<table>\n <tr>${
|
||||
mapped_columns.join ('</tr>\n <tr>')
|
||||
}</tr>\n</table>`;
|
||||
@ -28,6 +29,7 @@ export class Node extends Element {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public toString (): string {
|
||||
const attributes = [];
|
||||
|
||||
if (this.label || this.is_table) {
|
||||
attributes.push ({
|
||||
name: 'label',
|
||||
@ -51,6 +53,7 @@ export class Node extends Element {
|
||||
'"',
|
||||
'"'
|
||||
];
|
||||
|
||||
return `${v.name}=${d[0]}${v.value}${d[1]}`;
|
||||
})
|
||||
.join (', ');
|
||||
|
Reference in New Issue
Block a user