swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swarm-Support] EZGraph line colours


From: Michael Carney
Subject: [Swarm-Support] EZGraph line colours
Date: Tue, 18 Feb 2003 14:37:51 +0000

Hi,

The EZGraph class that I have only seems to include these twelve colors,

"blue", "orange", "yellow", "green",
"red", "purple", "violet", "cyan",
"grey50", "darkgreen", "goldenrod", "seagreen"

How do I extend this. I'm using swarm-2.1.1 and java, maybe a newer version of 
swarm would have more colors, where can I download a new version?

Thanks,
Michael Carney
Trinty, Dublin


>===== Original Message From address@hidden =====
Michael Carney writes:
 > I need to set the colours of the lines on my EZGraph for a swarm model I'm
 > writting. Swarm automatically assigns colours to the lines but I need them 
to
 > correspond to my agents colours. I was wondering would any know how I can 
do
 > this.
 >
 > I'm developing in Java and using swarm-2.1.1.

You might try accessing the underlying graph components directly,
instead of going through EZGraph.

Then define something like:
static const char * colors[NUMCOLORS] =
{
  "blue", "orange", "yellow", "green",
  "red", "purple", "violet", "cyan",
  "grey50", "darkgreen", "goldenrod", "seagreen",
  "navy", "turquoise",
  "khaki", "gold", "brown", "salmon",
  "pink", "magenta", "maroon", "thistle"
};

And put as many values as you want in there, as long as they
comply with the colors Tcl/Tk understands.

When you define your graph element (the thing that actually draws
data to the graph), you can set the color directly using:

    [ge setColor: colors[colorNdx % NUMCOLORS]];

--
glen e. p. ropella              =><=                           Hail Eris!
H: 831.335.4950                              http://www.ropella.net/~gepr
M: 831.247.7901                               http://www.tempusdictum.com

_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]