Gathering detailed insights and metrics for @peritoz/smart-view-engine
Gathering detailed insights and metrics for @peritoz/smart-view-engine
Gathering detailed insights and metrics for @peritoz/smart-view-engine
Gathering detailed insights and metrics for @peritoz/smart-view-engine
Advanced automatic layout generator for better graph visualization.
npm install @peritoz/smart-view-engine
Typescript
Module System
Min. Node Version
Node Version
NPM Version
74.9
Supply Chain
99
Quality
75.5
Maintenance
100
Vulnerability
81.3
License
TypeScript (99.58%)
JavaScript (0.42%)
Total Downloads
745
Last Day
1
Last Week
3
Last Month
18
Last Year
189
MPL-2.0 License
10 Stars
199 Commits
1 Watchers
2 Branches
1 Contributors
Updated on Oct 21, 2024
Minified
Minified + Gzipped
Latest Version
0.2.2
Package Id
@peritoz/smart-view-engine@0.2.2
Unpacked Size
183.66 kB
Size
37.13 kB
File Count
108
NPM Version
9.6.7
Node Version
18.17.0
Published on
Jan 21, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
200%
3
Compared to previous week
Last Month
-10%
18
Compared to previous month
Last Year
-16%
189
Compared to previous year
Advanced automatic layout generator for better graph visualization.
This lib was created after observing how hard it can be for some experts to communicate an architecture accurately. Architecture representation and visualization are part of the process of solution design. However, sometimes it is challenging to juggle the discussion of content with the effort it takes to style and organize all elements properly for many audiences. Smart View Engine illuminates this activity by providing views automatically generated from raw architecture models.
Using npm:
npm i --save @peritoz/smart-view-engine
Using Yarn:
yarn add @peritoz/smart-view-engine
This lib allows you to easily generate diagrams from a graph description. You can choose from different auto-layout styles, such as Nested and Hierarchy layouts.
Organizes elements in a top view approach, nesting children inside parents. Best suitable for tree visualization.
Organizes elements in a side view approach, positioning children below parents and respecting parents' horizontal boundaries. Best suitable for tree visualization.
You can pass relationship paths that describe your graph as input to generate advanced views. A relationship path can be represented as an array of elements, where the most left (first) element is considered the main element. For example, the following elements form a relationship chain with the main element:
(Customer)->(Product)<-(Supplier)
The situation presented could be translated as:
[Customer, Product, Supplier]
For proper rendering, additional information is required when describing an element in the relationship chain. Elements must be described as follows:
{
identifier: string; // Optional - Represents the element id
name: string;
type: string;
}
Firstly, you must define the paths (graph) to be processed; in this case, a simple example is provided:
const paths = [
[
{
"identifier": "2cdb720a",
"name": "A",
"type": "businessactor"
},
{
"identifier": "46f5e647",
"name": "B",
"type": "businessprocess"
}
],
[
{
"identifier": "2cdb720a",
"name": "A",
"type": "businessactor"
},
{
"identifier": "46f5e646",
"name": "C",
"type": "businessprocess"
}
]
];
Then, create and set up the engine by passing a Settings object.
const layoutSettings = new Settings({
layoutType: "nested", // The chosen layout type is indicated here
spaceBetween: 2,
spaceToOuterLabel: 2
});
let smartView = new SmartViewEngine(layoutSettings);
Finally, generate a View description from your paths.
const view = smartView.generateViewFromPaths(paths, "View Name");
The result is a View description containing View Nodes and Relationships with proper Width, Height and Position to be drawn using a drawing tool from your preference.
The following image shows a sample output rendering for the paths provided in the example mentioned above.
You can use archimate-diagram-engine to render Archimate views using JointJS
The generated diagram is returned as a View, which is an object containing mainly the View Nodes and View Relationships. From this object, you can render your diagram using a drawing tool of your choice.
A View is structured as follows:
{
id: string;
viewRelationships: [
{
name: string;
type: string;
parentId: string | null;
modelNodeId: string;
viewNodeId: string;
}
];
viewNodes: [
{
modelRelationshipId: string;
sourceId: string;
targetId: string;
viewRelationshipId: string;
type: string;
bendpoints: [{ x: number; y: number }];
}
];
name: string;
bounds: {
horizontal: { min: number; max: number };
vertical: { min: number; max: number };
};
}
You can control how the View will be generated by adjusting Settings parameters.
The image below illustrates how the Settings parameters affect the generated visualization.
No vulnerabilities found.
No security vulnerabilities found.