This is a Vue 3 component that wraps the yFiles graph visualization library. It implements the generic graph visualization API of Qwiery and thus allows an in-place replacement (betweeen Cytoscape, Ogma, yFiles and GoJs).
Note that yFiles is a commercial component and you need to obtain a license to use it.
If you don't have a license you can use the free Cytoscape version. It implements the same API referred above.
Assuming you have a Vue 3 application, install the component with
npm i @orbifold/vue-yfiles
and make sure you also have the yFiles library installed. You can download it from the yWorks website.
If you don't have a Vue app, use
npx nuxi init myapp
cd myapp
npm i <the path to the yFiles tgz package>
npm i @orbifold/vue-yfiles
Assign the license via the license
prop like so:
<GraphViewer :license="license"/>
The license looks like this:
const license = {
"company": "Your Corp",
"date": "2021-09-01",
"distribution": "global",
"domains": [ "localhost"],
"key": "your key",
...
See the demo application (npm run dev
) for a complete example.
This wrapper implements the Qwiery IGraphView
interface and it means you can transparently exchange it with other implementations.
The yFiles and Linkurious Ogma implementations are more advanced but are not free.
Clone the repo, install things (npm i
). To build the library run npm run build
and to test it run npm run test
.
You can run the sample application with npm run dev
and then open http://localhost:5173
(or whatever Vite shows in the console) in your browser.
If you include the Qwiery Graph package (npm i @orbifold/graphs
) you can use diverse graph generators to create graphs and then visualize them with this component.
For instance
import { Graph } from "@orbifold/graphs";
const g = Graph.create("erdos");
const viewe = <IGraphView>viewer.value; //see snippet above
viewer.loadGraph(g);
viewer.layout(); //organica layout by default
The loadGraph
method expects a JSON graph:
const g = {
nodes: [
{ id: 'a', name: 'A' },
{ id: 'b', name: 'B' }
],
edges: [
{ sourceId: 'a', targetId: 'b', name: 'A to B' },
]
};
cy.loadGraph(g)
The name
property is optional and will be used as the label of the node or edge.
The style of the graph defines whether the label is shown or not.
There are many different graph structures out there and if you wish to convert or use them, see the Qwiery Graph package.
This component is part of the Qwiery framework to help jump-start your graph visualizations. It's neither bug-free nor complete and
if you find something isn't as expected you can report it or contact us:
You can use any of the links above to contact us with respect to custom development and beyond. We have more than 20 years experience with everything graphs.
MIT License
Copyright (c) 2024 Orbifold B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.