GraphStream Users

Archives de la liste Aide

Re: Issue with rendering nodes in a view

Chronologique Discussions 
  • From: guilhelm savin <guilhelm.savin AT>
  • To: graphstream-users AT, Karina Mocinecová <karina.mocinecova AT>
  • Subject: Re: Issue with rendering nodes in a view
  • Date: Fri, 9 Mar 2018 11:13:34 +0100

Hi Kaniôčka,

The transform between PX and GU will evolve during the graph process because the view is trying to fit its boundaries for the best. Also, if autolayout is enable, layout can change your node coordinates before rendering,

I would try to disable autolayout, and autofitview on the camera :

Viewer viewer = graph.display(false);
View view = viewer.getDefaultView();

Hope it helps...

2018-03-08 14:54 GMT+01:00 Karina Mocinecová <karina.mocinecova AT>:
Dear sir or madam,

I am using your libraries available online at and I have one issue that I was hoping you can help me with.

I want to render a node in view on mouse-click at the exact same positions where I have clicked. To accomplish that I am using this code snippet:

view.addMouseListener(new MouseListener() {

            public void mouseClicked(MouseEvent e) {
                Point3 gu = view.getCamera().transformPxToGu(e.getX(), e.getY());
                Node node = graph.addNode(name);
                node.setAttribute("xyz", gu.x, gu.y, 0);

The problem is, that the node is shifted after rendering from the position where it should have appeard. It's not being shifted for the same constant of pixels. Only time the rendering works properly is when I have set resolution for 1600x900. What influence does the resulution have on setting of xyz attributes of a node? If it is not because of the resolution, do you have any suggestions what should I look into to solve the problem. I am adding the view into my own JPanel. Can that be the cause of my persisting issue?

Thank you for your help.

I am looking forward to hear from you.

Best regards,


Táto správa bola skontrolovaná na prítomnosť vírusov programom Avast Antivirus.

Guilhelm Savin
Computer Science PhD

Archives gérées par MHonArc 2.6.16.

Top of page