Giter Site home page Giter Site logo

javafxsmartgraph's People

Contributors

brunomnsilva 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javafxsmartgraph's Issues

Determine vertex / edge label in data layer

We're working with complex objects and it would be nice if we could set the label during vertex/edge creation. If I'm not mistaken, we would now have to first update the graph, then call update(), then use .attachLabel() on SmartGraphVertexNode (or something like that) and then call update() again.

Currently we're just overriding toString() of the generic vertex value, but for others there might be multiple string representations one would like to see. The method toString() will probably be a technical representation for debugging purposes in most cases. Another solution could be wrapping the object into another class on which the toString() is set for the visualisation, but that's sub-optimal.

Arrow head size + styling

Since the response has been great on a couple bigger issues, I decided to post a couple small ones too.

You can basically resize anything, the edges, the vertices, except for the arrow head. Yes you can change stroke width, but then it turns into a blob instead of a bigger arrow. After diving into the source code it turns out the arrow is a Path element with static coordinates.

Perhaps you could define the path based on stroke width? Or add a property I guess.
While we're on topic of arrow styling, maybe the style classes set on the edge should also appear on the arrow head.

Can't add edges with the same name

Expected behavior:

Two edges should be able to exist with the same name. And by name, I really mean label.

Image from Gyazo

Actual behavior:

If I try to make the graph displayed above, then an error is thrown claiming that the edge a already exists.

com.brunomnsilva.smartgraph.graph.InvalidEdgeException: There's already an edge with this element.
	at com.brunomnsilva.smartgraph.graph.DigraphEdgeList.insertEdge(DigraphEdgeList.java:99)

Perhaps there should be an additional label parameter available to edge objects, and that label is what should be displayed instead of the edge key?

e.g.

g.insertVertex("start", "state a", "a", "a")
g.insertVertex("state b", "state a", "a2", "a")

You could also just auto-generate a unique-enough edge key by combining the inbound-vertex, outbound-vertex, and label.

e.g.

// behind the scenes the key would be something like "start, state a, a" <- could hash this
g.insertVertex("start", "state a", "a")

// "state b, state a, a"
g.insertVertex("state b", "state a", "a")

// the visual label would be a for both

How to setup properties file ?

I know this not really an issue but i've no idea how to setup the properties file on my project ! i managed to understand every point except for this one.

thanks in advance

setStyleClass now cleares default classes

From #10:

Umm, are you certain it doesn't clear the default classes now? (.vertex, .edge, .arrow)

Yeah I (Bertie2011, but now on a school account) finally got around to trying the new version (which you should probably increase the version number of instead of calling it 0.9 again) aaaaand it does seem to have the default classes missing after setting a custom class in the latest version. ๐Ÿ™ƒ

Trouble installing tooltips

Hello!

I have an issue installing tooltips as in javafx.scene.control.Tooltip. I assume it can only be installed on

com.brunomnsilva.smartgraph.graphview.SmartGraphVertexNode but thats an internal class.

How do I install tooltips?

Thanks, J.

Custom CSS does not hide warning

I managed to set a custom properties file path using the Graph constructor (I think), which removed the missing properties file warning. The css file check is hardcoded, a style sheet parameter in SmartGraphPanel would prevent the missing default css file warning from being printed to console.

Edge arrow colours and hover behaviour

I have two problems that may be related.

  1. I draw edges in different colours if their "weight" is positive or negative. However, the edge arrows always appear in one colour. How can I fix this?

  2. In the CSS, file there is a way to specify a hover behaviour for the vertices. I would like to do the same with the edges. How can I do this?

On a related note, it would be really nice to have a detailed manual of sorts.

Thanks,
Ozan

Input/output ports on a digraph's vertex?

Bruno, nice work. Any thought to including input/output port(s) on the vertex so that data could be associated with that graphic? It would be a great enhancement for my application.

Ability for vertices to remember their positions.

I'm trying to use JavaFXSmartGraph to show relationships between people.

It works well but a lot of manual repositioning is required each time the graph is shown to get the layout right. This happens whichever layout strategy is used.

E.g. The circular layout strategy produces this:

image

But after manual changes it's clearer:

image

Is there some way for the graph to remember previous node positions and to use these if they have been set before?

Dinamically change vertex's label.

Hello and thank you for your hard work on this library. This is more of a question than an issue. I was wondering if I could change a vertex's label in my custom Strategy class or even outside it.
I was looking at the javadoc and eventually I found out that I can load my custom CSS class by using the setStyleClass method on a SmartLabel object. This SmartLabel is attached to a SmartGraphVertextNode in the addVertex method in SmartGraphPanel.
I can't find a way to get this SmartLabel and load the CSS class into it.
Any help is deeply appreciated, thank you.

There's already a vertex with this element.

Hi
Thank you for this beautiful graph library. However its is continuously throwing exception mention in above title. I am trying to show connected graphs. The vertex may be more than one in complex. Also I am adding the vertex dynamically. But After the loop run only onces the library throws this exception. Please have a look on this error.
The error details looks like this:
com.brunomnsilva.smartgraph.graph.InvalidVertexException: There's already a vertex with this element.
at com.brunomnsilva.smartgraph.graph.GraphEdgeList.insertVertex(GraphEdgeList.java:139)
at application.MainApp_Layout.retrieveRelationships(MainApp_Layout.java:612)

I am adding the vertices in this way
for (int i = 0; i < Influence_relation.getLength(); i++) {
Node inner_node = Influence_relation.item(i).getFirstChild();
FTGgraph.insertVertex(inner_node.getNodeValues());

}

method g.replace(e, newElement) with graphView.update() is not updating the graph

Hi,

I used your method from your project at Main.java :
graphView.setVertexDoubleClickAction(graphVertex -> { System.out.println("Vertex contains element: " + graphVertex.getUnderlyingVertex().element()); g.replace(graphVertex.getUnderlyingVertex(),"NewEntity"); System.out.println("Vertex contains element: " + graphVertex.getUnderlyingVertex().element()); graphView.update(); });

I added the instruction g.replace(graphVertex.getUnderlyingVertex(),"NewEntity");
When I ask the name of this current vertex, the method changed its name but even after the instruction of updating the graphView, it doesn't show the new name.

creating a vertex on mouse click.

How can I create a vertex by mouse click, that is, through the event processor? I cannot achieve this by overriding the strategy because the place method only uses the scene value.

The Arrow direction is not working properly. Every time the arrow direction change by itself.

Hi,
Once again I thank you for this nice graph library. I run your own example but when I run it, the arrow itself changes the direction .If I set the arrow like this
A->B and B->A
then the arrow always headed to B like A->B in both cases.
The other problem
When I run this example
g.insertVertex("A");
g.insertVertex("B");
g.insertVertex("C");
g.insertVertex("D");
g.insertVertex("E");
g.insertVertex("F");
g.insertVertex("G");

g.insertEdge("A", "B", "1");
g.insertEdge("A", "C", "2");
g.insertEdge("A", "D", "3");
g.insertEdge("A", "E", "4");
g.insertEdge("A", "F", "5");
g.insertEdge("A", "G", "6");

the arrow head is not heading toward source and target. For example the edge arrow of vertices connected to A is not correct only A->F is connected in correct way. Also the vertices connected to H are not connected correct way lets say the arrow should to toward I in H->I and H->J.

Also It changes every time when I run the application.
Please give some solution. I am working some research work and I want to use this library to show my data.
Thank you
image
image

Set icon to Vertex

Hello!
Can I set an icon to the Vertex?

I tried using "-fx-background-image: url("./town.png)"

But it was not successful.

What are some options to achieve my goal?

Error when using SmartGraph

when I use this repository, I got this error, can you help me with that?

the error: "Exception in thread "main" java.lang.ExceptionInInitializerError
at com.brunomnsilva.smartgraph.graphview.SmartGraphPanel.addEdge(SmartGraphPanel.java:506)
at com.brunomnsilva.smartgraph.graphview.SmartGraphPanel.initNodes(SmartGraphPanel.java:433)
at com.brunomnsilva.smartgraph.graphview.SmartGraphPanel.(SmartGraphPanel.java:199)
at com.brunomnsilva.smartgraph.graphview.SmartGraphPanel.(SmartGraphPanel.java:163)
at com.brunomnsilva.smartgraph.graphview.SmartGraphPanel.(SmartGraphPanel.java:148)
at MainClass.Main.main(Main.java:49)
Caused by: java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:436)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:431)
at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(PlatformImpl.java:724)
at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(PlatformImpl.java:686)
at javafx.scene.control.PopupControl.(PopupControl.java:89)
... 6 more"

Note: I use JDK 17

Question: Programmatically changing node colors

I've never worked with CSS before, so maybe this is obvious, but is there any way to change the color of nodes in the code? I know that you can change the styles nodes used based on preconfigured CSS entries, but I'd like to be able to have nodes slowly fade from one color to another to show gradual changes in "attitude" of nodes.

Graph.removeEdge() removes the visual edge but the attraction remains

To reporduce:

Add 2 vertexs A and B. Make a link between them.

In code later make a new vertex C and then add an edge to A.

In code later remove the C to A edge with g.removeEdge(name)

graphView.update();

Observe that the arrow is removed, but the attraction between C and A remains.

How to reset graph after remove vertices of edges

Hi,
In my project, when i double click on a vertex, i want to display only vertices that are adjacents to the one a clicked on, and after i want to display all the elements of my graph but does not work...
I tried to remove all vertices and edges and then insert all of them but it crash here:

var v = this.viewGraph.getStylableVertex(vertex);
v.removeStyleClass("vertex");

v is null

I tried to reinstance my graph and viewgraph but it crash when i do an update of the graph, here is the error:

Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: You must call this method after the instance was added to a scene.
	at com.brunomnsilva.smartgraph.graphview.SmartGraphPanel.update(SmartGraphPanel.java:317)

How can i do that ? thx

Question : new style of Vertex / Edge

Hi,

First of all, thank you for you work - it's great.

I'm working with your project and I need to create a new method to apply a different style of Edges and Vertexes. I was thinking of creating property in the "smartgraph.css" and then create a new method of inserting an element like the "insertVertex(...)" method.
The issue is the link from a property in smartgraph.css and insertVertex() is more deep than expected.

Do you see an easy way to do it ? Or should I modify / create a method for each file in the process ?

Thank you for your time,

TL

Weird behevior with arrow when reattach current arrow

Here is my code:

var e = this.viewGraph.getStylableEdge(edge);
var line = (SmartGraphEdgeLine) e;
var arrow = line.getAttachedArrow();
line.attachArrow(arrow);

When i attach the current arrow, the arrows are missed placed and they doesn't move correctly when i move the vertices.

I tried to do that because i reset the radius of vertices with this :

var v = this.viewGraph.getStylableVertex(vertex);
var node = ((SmartGraphVertexNode<?>) v);
node.setRadius(35);

But the arrows are hid by the vertices now...

I can't replace the arrows :/
How can i do that ?

Node overlap

Hi,

I have an issue with overlapping nodes.
Every time I insert an element in the graph, I update it with graphView.update().
I am currently putting on the graph around 70 nodes in row.

Do you think the issue has something to do with the "smartgraph.properties" and the Force-directed layout ? Or graphView.updateAndWait() could do the trick ?

NB : there are currently no edge in the graph

Screen Shot 2020-03-24 at 14 38 07

_Figure 1 : Node overlap_

Screen Shot 2020-03-24 at 14 42 47

_Figure 1 : Node overlap after I drag the top node of the stack_

Thank you for you help

TL

Question: are there plans to make this available through Maven?

Hello, thank you very much for making this available, it is really useful.
I'm using it in a Maven project, and it would be very convenient to have it available through a Maven repository. Do you have any plans for this? If not, that's completely fine, I was just wondering.
Thank you!

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.