livereader / graphly-d3 Goto Github PK
View Code? Open in Web Editor NEWOpen source library to create outstanding graph visualizations with ease.
Home Page: https://docs.graphly.dev
License: GNU General Public License v3.0
Open source library to create outstanding graph visualizations with ease.
Home Page: https://docs.graphly.dev
License: GNU General Public License v3.0
build default factories for common use
A way to describe the expected payload with which a template should be hydrated.
The schema could be validated at runtime and issue an error template if a mismatch is detected.
Level of Detail management
In order to update a template with custom colors whether or not the dark
theme is applied, an additional event handler like OnThemeChange
is required.
Usage could look like this:
const { OnThemeChange } = TemplateAPI;
OnThemeChange((theme) => {
if (theme == "light" {
// light theme styling
shape.attr("fill", "#e5e6e8");
}
else if (theme == "dark") {
// dark theme styling
shape.attr("fill", "#151618");
}
));
To easily integrate it in styling there could be a wrapper ThemeStyle
like this:
const { ThemeStyle } = TemplateAPI;
const someText = TextCollection(
"hello world",
CollectionStyle(300, 300, 100, 100, 15, 15, 1, Alignment.Center),
[
ShapeStyle("fill", ThemeStyle("white", "black")),
ShapeStyle("font-size", "32px"),
]
);
Type | Display | |
---|---|---|
✅ | .solid | ––––––––––– |
✅ | .solid.arrowed | ––––––––––> |
✅ | .dotted | ........... |
✅ | .dotted.arrowed | ..........> |
✅ | .dashed | - - - - - - |
✅ | .dashed.arrowed | - - - - - > |
All edges do have an optional label
attribute
{
"source": "n0",
"target": "n1",
"type": "solid",
"directed": true,
"label": "type_of",
}
[ n0 ] ––––––––type_of–––––––> [ n1 ]
Exposing the shape render
method to create svg elements using a graphly-d3 template makes it possible to use the template system outside of a force simulation.
To match the behaviour of shape-matching links, the collision should also approach the node shapes form.
To get more control in using links, there is a number of further optional properties that should be added to the link type.
directed
values for the link
data structure.In addition to true
and false
to determine whether or not an arrow is drawn on the end of the link a few more advanced options like "head"
, "tail"
and "both"
would provide a more finite control over the visualization.
A method for creating a static snapshot of a simulation would allow to use a graphly-d3 instance as a thumbnail without drawing much performance for the responsive force-simulation itself.
Currently, all links begin and end in a circular orbit around the source and target nodes. Beginning and ending at the actual shape border would be a visualization improvement.
Merge the Graphly D3 Vue npm package and expose it on /components
Usage example:
<template>
<GraphlyD3 />
</template>
<script setup>
import { Vue3 as GraphlyD3 } from "@livereader/graphly-d3/components";
</script>
It is not 0,0 (center) but seemingly the bottom-right edge of the screen size
Currently, satellites are striving toward the calculated orbital position of their source node.
A new option to make this position fixed and not influenced by other forces would be useful for certain use cases.
additional color
property on the link
data structure to configure the color used to render a link.
Hi,
I'm trying to make this graph with this package on vue 3
https://twitter.com/hturan/status/1641780868640374784?s=12&t=dOgaGILz9Qbms-_hYG20VA
I've made most of them, but the problem I couldn't solve is when we create a rectangle shape, we have to pass static size for width and height, but here I need to have a dynamic size by considering the text inside it.
is there any way to make it dynamic?
this is my rectangle shape code.
export default {
shapeSize: 120,
shapeBuilder: shapeBuilder,
};
function shapeBuilder(data, TemplateAPI) {
const { ShapeStyle, TextCollection, CollectionStyle,Shape,TextShape } = TemplateAPI;
const text = TextShape(data.payload?.title ?? "",[
ShapeStyle("font-size", "18px", true),
ShapeStyle("fill", "#000000", true),
]);
const shape = Shape.Rectangle(300, 250, 10);
shape.select("path").style("fill", data.payload?.color ?? "#22d3ee");
const titleShape = TextCollection(data.payload?.title ?? "", CollectionStyle(70, 100, 0, 0, 0, 10, 5), [
ShapeStyle("class", "gly_text.light"),
ShapeStyle("font-size", "1em"),
]);
shape.append(() => titleShape.node());
return shape;
}
A Graphly component that takes any valid SVG code and bakes it into to rendered shape.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.