Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node shape: rounded-box not apply #49

Closed
rmaestre opened this issue Dec 23, 2011 · 8 comments
Closed

node shape: rounded-box not apply #49

rmaestre opened this issue Dec 23, 2011 · 8 comments

Comments

@rmaestre
Copy link

Hi everyone, firstly: nice job with this library!!
However, with the next code i have one problem (using 1.1 libraries):

Node n = g.getNode(nodeLabel);
n.addAttribute("ui.style" , ("size: 10px, 10px; fill-color: #3d5689; shape: rounded-box; stroke-mode: plain; stroke-color: yellow;");
n.setAttribute("label",nodeLabel);

With the above code, nodes perform the change of size and fill-color well, but not shape, stroke-mode and stroke-color. In edges does not work shape forms.

Edge e = g.getEdge(from+to);
e.addAttribute("ui.style" , "cubic-curve;");

Any suggestion?
Best regards !

@sbalev
Copy link
Member

sbalev commented Dec 23, 2011

Hi, the viewer included in gs-core supports only a minimal subset of CSS. To have a full CSS support, use the one included in gs-ui. Make sure that gs-ui.jar is in your classpath and use this instruction before displaying the graph:

System.setProperty("gs.ui.renderer",
                "org.graphstream.ui.j2dviewer.J2DGraphRenderer");

Hope this helps.

@sbalev sbalev closed this as completed Dec 23, 2011
@rmaestre
Copy link
Author

Works perfectly in the display but ¿This new styles will apply in the pictures save by FileSinkImages?

Graph g = new DefaultGraph("g");
FileSinkImages fsi = new FileSinkImages(...
g.addSink(fsi);
fsi.begin("/tmp/prefix");
// Graph operations
....
fc.close();

Thank you.
Best regards.

@sbalev
Copy link
Member

sbalev commented Dec 23, 2011

With FileSinkImages you should use

fsi.setRenderer(RendererType.SCALA);

Regards

@yixuanhuangyx
Copy link

Hi there!

I also got a question about the node shape.

I have gs-ui.jar in my classpath and this at the first line of my code:
System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");

Then I define a node:
Node A = g.addNode("A"); A.setAttribute("ui.label", "Node A");
with the styleSheet like this:
graph {padding:60px; fill-color: red;} node {size-mode: fit; text-style: bold; shape: rounded-box; fill-color: white; stroke-color: yellow; stroke-mode: plain; }
I want to get a reactangle shape of each node. but it only show up as a square.
Except the node shape, the other properties are good.

Any suggestion here? :)

@vilimek-jakub
Copy link

Hi there!

I also got a question about the node shape.

I have gs-ui.jar in my classpath and this at the first line of my code:
System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");

Then I define a node:
Node A = g.addNode("A"); A.setAttribute("ui.label", "Node A");
with the styleSheet like this:
graph {padding:60px; fill-color: red;} node {size-mode: fit; text-style: bold; shape: rounded-box; fill-color: white; stroke-color: yellow; stroke-mode: plain; }
I want to get a reactangle shape of each node. but it only show up as a square.
Except the node shape, the other properties are good.

Any suggestion here? :)

I solved the same issue today. My bug was in gs-ui-javafx org.graphstream.ui.javafx.renderer.shape.javafx.Area
private void sizeForElement(Style style, DefaultCamera2D camera, GraphicElement element) {
...
if(style.getSize().size() > 1)
h = camera.getMetrics().lengthToGu(style.getSize(), 1) ;
...
}

@hichbra
Copy link
Contributor

hichbra commented Mar 11, 2020

This issue is already fixed graphstream/gs-ui-javafx@bbea8a2 and will be in the next release.

@vilimek-jakub
Copy link

Great, when will be the release ready? ;-)

@hichbra
Copy link
Contributor

hichbra commented Mar 11, 2020

It depends on a lot of things, but I'm hoping it'll probably be done before the summer.
You can use the dev branch in the meantime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants