swarm-support
[Top][All Lists]
Advanced

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

Re: setColors in EZGraph


From: Catherine Dibble
Subject: Re: setColors in EZGraph
Date: Thu, 09 Mar 2000 16:02:32 -0800

hi Darren,

Here's what I've done to set colors on my happyGraph.  
All code is contained within my ObserverSwarm.(h|m)

In my case, I want to graph results from four sectors
and then an average of all four, so I define five colors.
The colors are used in the order I define the 
createAverageSequences.

If you are coming to SwarmFest this weekend, you'll
see this code working there.

Code snippets from ObserverSwarm are included below

Cheers!

Catherine
================8<=========================
First, from ObserverSwarm.h

  // Lots of display objects.  First, widgets.
  id <Colormap> colormap;
  id <Canvas> graphCanvas;
  id <EZGraph> happyGraph;

Then, from ObserverSwarm.m

-buildObjects 
{
        GeoGraph * world;

        static const char * ezgraphColors[5] = 
                {"black", "green", "red", "yellow", "blue"};
  
        [super buildObjects];
...

        happyGraph = 
                [EZGraph create: self
             setTitle: "Happiness of Bugs vs. Time"
             setAxisLabelsX: "Time" Y: "Happiness"
             setWindowGeometryRecordName: "HappyGraph"];

        SET_WINDOW_GEOMETRY_RECORD_NAME (happyGraph);
  
        [happyGraph enableDestroyNotification: self
                notificationMethod: @selector (_happyGraphDeath_:)];

        [happyGraph setColors: ezgraphColors count: 5];

        [happyGraph createAverageSequence: "Population"
                withFeedFrom: [geoModelSwarm getGeobugList] 
                andSelector: M(getHappiness)];

        [happyGraph createAverageSequence: "Grow"
                withFeedFrom: [geoModelSwarm getGrowbugList] 
                andSelector: M(getHappiness)];  
                
        [happyGraph createAverageSequence: "Make"
                withFeedFrom: [geoModelSwarm getMakebugList] 
                andSelector: M(getHappiness)];  
        
        [happyGraph createAverageSequence: "Serv"
                withFeedFrom: [geoModelSwarm getServbugList] 
                andSelector: M(getHappiness)];
        
        [happyGraph createAverageSequence: "Info"
                withFeedFrom: [geoModelSwarm getInfobugList] 
                andSelector: M(getHappiness)];

===============8<===============================


*===============================================*
This problem, too, will look simple after it is solved. 
                                            -- Charles Francis Kettering 
 Catherine Dibble                                      
 Department of Geography               www.econ.ucsb.edu/~cath 
*===============================================*



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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