Code Monkey home page Code Monkey logo

graphly-d3's People

Contributors

dependabot[bot] avatar jason-rietzke avatar jnhck avatar luisa-schmidt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

graphly-d3's Issues

build d3 factory set

build default factories for common use

  • TextFieldFactory
  • TagFieldFactory
  • RefreshRoutines (for partial rerendering)
  • OnClick event handling
  • Collection Indicator for more hidden elements (Ellipsis)

template payload schema

Template Payload Schema

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.

theme reactive template style

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"),
  ]
);

develop templates

Templates

Design

  • Person
  • Emergency
  • Rescue vehicle [type, label, status, distance]
  • Clock
  • Date

Implementation

  • Person
  • Emergency
  • #32
  • Clock
  • Date

implement edge styles

Static Edges

Type Display
.solid –––––––––––
.solid.arrowed ––––––––––>
.dotted ...........
.dotted.arrowed ..........>
.dashed - - - - - -
.dashed.arrowed - - - - - >

All edges do have an optional label attribute

Example JSON

{
    "source": "n0",
    "target": "n1",
    "type": "solid",
    "directed": true,
    "label": "type_of",
}

In Action

[ n0 ] ––––––––type_of–––––––> [ n1 ]

expose shape renderer

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.

Shape matching collision

Shape matching collision

To match the behaviour of shape-matching links, the collision should also approach the node shapes form.

link properties

Link Properties

To get more control in using links, there is a number of further optional properties that should be added to the link type.

  • id – adds control in identifying link entities (especially useful for custom processing)
  • payload – adds a clean way to carry custom data (consistent with node templates)
  • width – adds an easy way to adjust the width of link paths
  • curvature – adds the possibility to override the by default calculated curvature of a link path

bidirectional links

Enhanced 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.

simulation snapshot

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.

implement ForceSimulation interface

Interface

  • onClick(callback)
  • onContextClick(callback)
  • onMouseOver(callback)
  • onMouseOut(callback)
  • onBackground(callback)
  • onNewEdge(callback)

shape matching link rendering

Shape-Matching link rendering

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 graphly-d3-vue package

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>

defining style set

Graph Styles

Link

  • edge (solid, dashed, dotted)
  • label
  • arrow

Node

  • shadow
  • selected

Component Styles

Text

  • title [ 120px ]
    • XL [ 180px ]
    • XXL [ 240px ]
  • subtitle [ 80px; lighter ]
  • description [ 48px; lighter ]
  • tag [ 48px ]

Color

  • accent colors
  • shape colors
  • #30
  • #31

satellite fix position

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.

link color

additional color property on the link data structure to configure the color used to render a link.

node shape size depends on the content

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;
}


re-implement functional approach

Things to gain:

  • re-render nodes with data changes
  • handle entering, exiting, and changing data
  • improved data management for each node
  • intuitive function calls that return the fully assembled SVG-node
  • upgraded templates

implement SVGShape

SVGShape

A Graphly component that takes any valid SVG code and bakes it into to rendered shape.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.