Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
PlotMorph
Last updated at 9:09 pm UTC on 29 June 2017
Maintained in

 MCHttpRepository
    location: 'http://www.squeaksource.com/PlotMorph'
    user: ''
    password: ''

Author: Diego Gomez Deck

Morph to draw XY plots. See the methods testXXX in the class side.

Try with:
 PlotMorph test.
 PlotMorph test2.
 PlotMorph test4.
 PlotMorph testWithReferences.

Look at the code behind those methods in Browser


Installation


Note


See it in action


In development


Screenshots

Uploaded Image: Plot1.gif Uploaded Image: Plot2.gif Uploaded Image: Plot3.gif Uploaded Image: f-plotter.jpg

Question


Kwiyi Woo February 01, 2004: I am pretty new to squeak and tried to use plotMorph to create a curve graph. I cannot find the methods "test", "test2" or "testWithReferences" in the PlotMorph class. How can the PlotMorph send message to them. Also I don't know how to plot a curve at specified function. Could anyone give me some suggestions?


Answer
German S. Arduino:
Look at class side for these methods. What I have found (in the test4) is this:

Raymond Asselin: As you see in a SystemBrowser, 5 classes are used to make aPlotMorph:

So if you want to get rid of PlotMorphGrid you have to find where this class is used.


  function := [:x | x degreesToRadians sin / 5 + 
            ((x / 10) degreesToRadians cos + 
            (x / 10) degreesToRadians sin) * 100].
    0 to: 3000
        by: 5
        do: [:x | pm series: #test2 addPoint: x
                  & (function value: x)].
    pm openInWorld  3

where a mathematical function is defined within a bloc
[ :x | x blabla....]
and assigned to the variable function to be used in the loop below where the y value of a point is compute with that function . So, if you change the mathematical function in that bloc you'll have the result you are looking for.

Kwiyi Woo: I got the idea and successfully created my own graph. Thanks. But now I am trying to remove te grid on the Axis coordinators. In other words, I only want to keep the X and Y axis without having a grid on the background. Is there any attribute I can turn off?

One way to find this is: (1) to select the PlotMorphGrid class in the SystemBrowser and (2) to choose in the contextual menu (alt+click on a Mac // right button on Windows) the menu item “class refs” this will open a window with the őusers1 of the selected class. You'll see that there is only one user, it is the class AxesMorph in is őinitialize1 method. (3) Select it and you will see in the bottom pane the code. Find in which statement PlotMorphGrid is used.
grid := PlotMorphGrid on: self.


I tried
grid := self
and the result seem to be what you are looking for.

So remember to look for the class refs of a class when you want to know who uses it, or how it is used.





Related