GraphStream Users

Archives de la liste Aide


Re: background image for graph


Chronologique Discussions 
  • From: Keith Thompson <kthomps6 AT binghamton.edu>
  • To: graphstream-users AT litislab.fr
  • Subject: Re: background image for graph
  • Date: Fri, 28 Oct 2011 11:03:14 -0400

Hi Antoine,

Thank you so much for your help.  I will download the new jar files from git. :-)

Regards,
Keith

On Fri, Oct 28, 2011 at 7:11 AM, Antoine Dutot <antoine.dutot AT gmail.com> wrote:
Hi Keith,

I spotted the bug, but I am too ashamed by the error to tell you what it was :-) It is corrected and pulled on git. I can send you a new gs-ui jar along with a new gs-core jar (the two have changed) if you wish.

Regards,
Antoine


2011/10/27 Keith Thompson <kthomps6 AT binghamton.edu>
Hi Antoine,

My class and main method are posted below.  It works fine when I just have something like:
 
graph {fill-color: #666666;} 

but when I change it to:
 
graph {fill-mode: image-scaled-ratio-max; fill-image: url('C:/path/to/file.png');}
 
it gives me a solid white background for my graph instead of the image file.  I just now tried and it even works with:

graph {fill-mode: image-scaled; fill-image: url('C:/path/to/file.png');}

For some reason, just the image-scaled-ratio-max doesn't work for me.

Regards,
Keith


public class NYTweetsVisual {

Graph g2;
public NYTweetsVisual() {
g2 = new DefaultGraph("2");
}
public void showDynamicGraph() throws IOException {
FileSource fs = FileSourceFactory.sourceFor("C:/nyTweetLoc1.dgs");
fs.addSink(g2);
System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
g2.addAttribute("ui.quality");
g2.addAttribute("ui.antialias");
g2.addAttribute("ui.stylesheet", "graph {fill-mode: image-scaled-ratio-max; fill-image: url('C:/path/to/file.png');} " +
"node {size: 3px; fill-mode: dyn-plain; " +
"fill-color: white, yellow, red, blue, black; text-visibility-mode: hidden;} " +
"node.tracker {size: 15px; fill-color: black;} " +
"node.tracker2 {size: 15px; fill-color: red;}");
g2.display(false);
try {
fs.begin("C:/nyTweetLoc1.dgs");
while (fs.nextEvents()) {
try {
Thread.sleep(10);
}
catch(Exception e) {
e.printStackTrace();
}
}
} catch( IOException e) {
e.printStackTrace();
}
try {
fs.end();
} catch( IOException e) {
e.printStackTrace();
} finally {
fs.removeSink(g2);
}
}
public static void main(String[] args) throws IOException {
NYTweetsVisual graph = new NYTweetsVisual();
graph.showDynamicGraph();
}
}

On Thu, Oct 27, 2011 at 3:38 AM, Antoine Dutot <antoine.dutot AT gmail.com> wrote:
Hi Keith,

This should work with fill-mode and fill-image as expected. Do you have some example of code to reproduce the error here ?

Regards,
Antoine


2011/10/26 Keith Thompson <kthomps6 AT binghamton.edu>
I am able to fill a node with an image but I have not been able to use the same command to fill the graph background with an image.  Do the fill-mode and fill-image commands not work for the graph background?

Regards,
Keith




--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587




--
Keith Thompson
Graduate Research Associate, Xerox Corporation
SUNY Research Foundation
Dept. of Systems Science and Industrial Engineering
Binghamton University
work: 585-422-6587



Archives gérées par MHonArc 2.6.16.

Top of page