swarm-support
[Top][All Lists]
Advanced

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

Re: X axis time values


From: Alex Lancaster
Subject: Re: X axis time values
Date: 27 May 1999 16:12:32 -0600

>>>>> "SM" == Steve LaMotte <address@hidden> writes:

SM> Hi Alex, We're using an EZgraph to plot data.  We would like the X
SM> axis to represent "our" simulation time, which is in time steps of
SM> 0.01, or whatever time step we choose.

SM> How do we do this? Our code for creating the graph:

SM> deltaGraph = [EZGraph createBegin: self]; [deltaGraph setTitle:
SM> "Value of Deltas"]; [deltaGraph setAxisLabelsX: "Time / 100" Y:
SM> "Value"]; deltaGraph = [deltaGraph createEnd]; [deltaGraph
SM> createSequence: "Delta 2,1" withFeedFrom: self andSelector:
SM> M(getDeltaDiff1)]; [deltaGraph createSequence: "Delta 3,1"
SM> withFeedFrom: self andSelector: M(getDeltaDiff2)];

SM> I won't bother to send the rest of the code.  It works, plots
SM> great, etc.  We would just rather our X axis label to reflect
SM> "Time" rather than "Time / 100"

There's no short answer to this one, it's new functionality that you
would need to be implement yourself.

You could get a start on it, by modifying the ActiveGraph object
(found in swarm/src/analysis/ActiveGraph.[hm]).

You could add an ivar `xScaleFactor' (with a default value of 1), and
appropriate getter/setter methods to the ActiveGraph class, say:

-{get,set}XScaleFactor

and in the [ActiveGraph -step] method, use that scaling factor to
scale the time:

// add a new point, (currentTime, averageValue).
- step
{
  [element addX: (double)(getCurrentTime ()/xScaleFactor)
           Y: [self doubleDynamicCallOn: dataFeed]];
  return self;
}

This way you'll have appropriately scaled the time on the display by
your xScaleFactor (i.e. `100' in your case).  

Of course, you'd like to set this in the EZGraph object itself (which
contains an ActiveGraph instance variable, if graphics mode is set),
so you'd need to add the appropriate pass through methods (i.e. do
`delegation') that would pass the scaling factor onto the ActiveGraph
instance.

Of course, there is then the problem that your `external' (i.e. the
Swarm integer timesteps) clock won't match the displayed graph, which
could cause some misinterpretation of the data.  But, I'll see if I
can look into it at some stage.

Regards,

 --- Alex

-- 
  Alex Lancaster           |  e-mail: address@hidden
  Swarm Program            |     web: http://www.santafe.edu/~alex
  Santa Fe Institute       |     tel: +1-(505) 984-8800 (ext 242)
-------------------------------------------------------------------

                  ==================================
   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]