Installations
npm install @swimlane/ngx-graph
Releases
Unable to fetch releases
Developer
Developer Guide
Module System
ESM
Min. Node Version
Typescript Support
No
Node Version
18.20.4
NPM Version
9.9.3
Statistics
940 Stars
331 Commits
288 Forks
58 Watching
47 Branches
41 Contributors
Updated on 26 Nov 2024
Bundle Size
289.15 kB
Minified
80.68 kB
Minified + Gzipped
Languages
TypeScript (74.44%)
MDX (17.36%)
HTML (5.78%)
JavaScript (0.98%)
CSS (0.97%)
SCSS (0.47%)
Total Downloads
Cumulative downloads
Total Downloads
3,656,433
Last day
12.9%
4,183
Compared to previous day
Last week
4.7%
18,605
Compared to previous week
Last month
2.6%
78,323
Compared to previous month
Last year
-13.2%
881,041
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
ngx-graph
A Graph visualization for angular
Documentation & Demos
https://swimlane.github.io/ngx-graph/
Installation
npm install @swimlane/ngx-graph --save
- Import
NgxGraphModule
into your module - Use the
ngx-graph
component in your components
Usage
Simple
1<ngx-graph 2 class="chart-container" 3 [view]="[500, 200]" 4 [links]="[ 5 { 6 id: 'a', 7 source: 'first', 8 target: 'second', 9 label: 'is parent of' 10 }, { 11 id: 'b', 12 source: 'first', 13 target: 'third', 14 label: 'custom label' 15 } 16 ]" 17 [nodes]="[ 18 { 19 id: 'first', 20 label: 'A' 21 }, { 22 id: 'second', 23 label: 'B' 24 }, { 25 id: 'third', 26 label: 'C' 27 } 28 ]" 29 (select)="onNodeSelect($event)" 30> 31</ngx-graph>
Custom Templates
1<ngx-graph 2 class="chart-container" 3 [view]="[500, 550]" 4 [links]="[ 5 { 6 id: 'a', 7 source: 'first', 8 target: 'second', 9 label: 'is parent of' 10 }, { 11 id: 'b', 12 source: 'first', 13 target: 'c1', 14 label: 'custom label' 15 }, { 16 id: 'd', 17 source: 'first', 18 target: 'c2', 19 label: 'custom label' 20 }, { 21 id: 'e', 22 source: 'c1', 23 target: 'd', 24 label: 'first link' 25 }, { 26 id: 'f', 27 source: 'c1', 28 target: 'd', 29 label: 'second link' 30 } 31 ]" 32 [nodes]="[ 33 { 34 id: 'first', 35 label: 'A' 36 }, { 37 id: 'second', 38 label: 'B' 39 }, { 40 id: 'c1', 41 label: 'C1' 42 }, { 43 id: 'c2', 44 label: 'C2' 45 }, { 46 id: 'd', 47 label: 'D' 48 } 49 ]" 50 [clusters]="[ 51 { 52 id: 'third', 53 label: 'Cluster node', 54 childNodeIds: ['c1', 'c2'] 55 } 56 ]" 57 layout="dagreCluster" 58> 59 <ng-template #defsTemplate> 60 <svg:marker id="arrow" viewBox="0 -5 10 10" refX="8" refY="0" markerWidth="4" markerHeight="4" orient="auto"> 61 <svg:path d="M0,-5L10,0L0,5" class="arrow-head" /> 62 </svg:marker> 63 </ng-template> 64 65 <ng-template #clusterTemplate let-cluster> 66 <svg:g class="node cluster"> 67 <svg:rect 68 rx="5" 69 ry="5" 70 [attr.width]="cluster.dimension.width" 71 [attr.height]="cluster.dimension.height" 72 [attr.fill]="cluster.data.color" 73 /> 74 </svg:g> 75 </ng-template> 76 77 <ng-template #nodeTemplate let-node> 78 <svg:g 79 (click)="onNodeClick($event)" 80 (dblclick)="onNodeClick($event)" 81 class="node" 82 ngx-tooltip 83 [tooltipPlacement]="'top'" 84 [tooltipType]="'tooltip'" 85 [tooltipTitle]="node.label" 86 > 87 <svg:rect 88 [attr.width]="node.dimension.width" 89 [attr.height]="node.dimension.height" 90 [attr.fill]="node.data.color" 91 /> 92 <svg:text alignment-baseline="central" [attr.x]="10" [attr.y]="node.dimension.height / 2"> 93 {{node.label}} 94 </svg:text> 95 </svg:g> 96 </ng-template> 97 98 <ng-template #linkTemplate let-link> 99 <svg:g class="edge"> 100 <svg:path class="line" stroke-width="2" marker-end="url(#arrow)"></svg:path> 101 <svg:text class="edge-label" text-anchor="middle"> 102 <textPath 103 class="text-path" 104 [attr.href]="'#' + link.id" 105 [style.dominant-baseline]="link.dominantBaseline" 106 startOffset="50%" 107 > 108 {{link.label}} 109 </textPath> 110 </svg:text> 111 </svg:g> 112 </ng-template> 113</ngx-graph>
Data
Nodes
1[ 2 { 3 id: '1', 4 label: 'Node A' 5 }, 6 { 7 id: '2', 8 label: 'Node B' 9 }, 10 { 11 id: '3', 12 label: 'Node C' 13 }, 14 { 15 id: '4', 16 label: 'Node D' 17 }, 18 { 19 id: '5', 20 label: 'Node E' 21 }, 22 { 23 id: '6', 24 label: 'Node F' 25 } 26];
Edges
1[ 2 { 3 id: 'a', 4 source: '1', 5 target: '2' 6 }, 7 { 8 id: 'b', 9 source: '1', 10 target: '3' 11 }, 12 { 13 id: 'c', 14 source: '3', 15 target: '4' 16 }, 17 { 18 id: 'd', 19 source: '3', 20 target: '5' 21 }, 22 { 23 id: 'e', 24 source: '4', 25 target: '5' 26 }, 27 { 28 id: 'f', 29 source: '2', 30 target: '6' 31 } 32];
Clusters
1[ 2 { 3 id: 'cluster0', 4 label: 'Cluster node', 5 childNodeIds: ['2', '3'] 6 } 7];
Building ngx-graph
To get started with development, clone a fork of the repository and run yarn
.
Development server
Run yarn start
to serve Storybook at http://localhost:6006/
. Storybook serves as the development and test environment for ngx-graph.
Building
Run yarn build:storybook
to build Storybook to check for production issues. The build artifacts will be stored in the dist/
directory.
Run yarn build:lib
to build ngx-graph.
Running tests
Run yarn test
to execute the linter.
Release
- Checkout master (
git checkout master
) - Pull master (
git pull
) - Run tests (
yarn ci
) - Examine log to determine next version (X.Y.Z)
- Run
git checkout -b release/X.Y.Z
- Update version in
projects/swimlane/ngx-graph/package.json
. - Update changelog in
CHANGELOG.md
- Run
yarn package
to check the package format - Run
git commit -am "(release): X.Y.Z"
- Run
git tag X.Y.Z
- Run
git push origin HEAD --tags
- Run
yarn publish:lib
- Submit PR
Credits
ngx-graph
is a Swimlane open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.
SecOps Hub is an open, product-agnostic, online community for security professionals to share ideas, use cases, best practices, and incident response strategies.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 22/23 approved changesets -- score normalized to 9
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
SAST tool is not run on all commits -- score normalized to 1
Details
- Warn: 3 commits out of 29 are checked with a SAST tool
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/stale.yml:1
- Warn: no topLevel permission defined: .github/workflows/test_and_deploy.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/swimlane/ngx-graph/stale.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_and_deploy.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/swimlane/ngx-graph/test_and_deploy.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_and_deploy.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/swimlane/ngx-graph/test_and_deploy.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test_and_deploy.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/swimlane/ngx-graph/test_and_deploy.yml/master?enable=pin
- Info: 0 out of 3 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
10 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986 / GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
Score
4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @swimlane/ngx-graph
@swimlane/ngx-datatable
ngx-datatable is an Angular table grid component for presenting large and complex data.
@swimlane/ngx-charts
Declarative Charting Framework for Angular
@swimlane/ngx-dnd
Drag and Drop for Angular2 and beyond!
@siemens/ngx-datatable
ngx-datatable is an Angular table grid component for presenting large and complex data.