eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SimpleFunctionGraphView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: SimpleFunctionGraphView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--SimpleFunctionGraphView

Package:
stx:libwidg3
Category:
Views-Misc
Version:
rev: 1.5 date: 2019/03/13 20:45:02
user: cg
file: SimpleFunctionGraphView.st directory: libwidg3
module: stx stc-classLibrary: libwidg3
Author:
Claus Gittinger

Description:


UNDER CONSTRUCTION

displays the graph of a function.
TODO: grid & scale drawing.


Instance protocol:

accessing
o  displayModeHolder
return the value of the instance variable 'displayModeHolder' (automatically generated)

o  displayModeHolder: something
set the value of the instance variable 'displayModeHolder' (automatically generated)

o  function: aBlock
(comment from inherited method)
set the drawing function if it has changed.
The argument is one of:
#copy,#copyInverted,#xor,#and,#andReverse
#andInverted,#or,#orReverse,#orInverted
#invert,#clear,#set,#noop,#equiv,#nand
Notice: not all graphicMedia support all functions

o  functionHolder
return the value of the instance variable 'functionHolder' (automatically generated)

o  functionHolder: something
set the value of the instance variable 'functionHolder' (automatically generated)

o  graphColorHolder
return the value of the instance variable 'graphColorHolder' (automatically generated)

o  graphColorHolder: something
set the value of the instance variable 'graphColorHolder' (automatically generated)

o  gridColorHolder
return the value of the instance variable 'gridColorHolder' (automatically generated)

o  gridColorHolder: something
set the value of the instance variable 'gridColorHolder' (automatically generated)

o  invalidColorHolder
return the value of the instance variable 'invalidColorHolder' (automatically generated)

o  invalidColorHolder: something
set the value of the instance variable 'invalidColorHolder' (automatically generated)

o  markInvalidHolder
return the value of the instance variable 'markInvalidHolder' (automatically generated)

o  markInvalidHolder: something
set the value of the instance variable 'markInvalidHolder' (automatically generated)

o  maxXHolder
return the value of the instance variable 'maxXHolder' (automatically generated)

o  maxXHolder: something
set the value of the instance variable 'maxXHolder' (automatically generated)

o  maxYHolder
return the value of the instance variable 'maxYHolder' (automatically generated)

o  maxYHolder: something
set the value of the instance variable 'maxYHolder' (automatically generated)

o  minXHolder
return the value of the instance variable 'minXHolder' (automatically generated)

o  minXHolder: something
set the value of the instance variable 'minXHolder' (automatically generated)

o  minYHolder
return the value of the instance variable 'minYHolder' (automatically generated)

o  minYHolder: something
set the value of the instance variable 'minYHolder' (automatically generated)

o  showGridHolder
return the value of the instance variable 'showGridHolder' (automatically generated)

o  showGridHolder: something
set the value of the instance variable 'showGridHolder' (automatically generated)

o  showUnitsXHolder
return the value of the instance variable 'showUnitsXHolder' (automatically generated)

o  showUnitsXHolder: something
set the value of the instance variable 'showUnitsXHolder' (automatically generated)

o  showUnitsYHolder
return the value of the instance variable 'showUnitsYHolder' (automatically generated)

o  showUnitsYHolder: something
set the value of the instance variable 'showUnitsYHolder' (automatically generated)

o  unitColorHolder
return the value of the instance variable 'unitColorHolder' (automatically generated)

o  unitColorHolder: something
set the value of the instance variable 'unitColorHolder' (automatically generated)

change & update
o  sizeChanged: how
(comment from inherited method)
tell subviews that I changed size.
How is either #smaller, #larger or nil, and is used to control the order,
in which subviews are notified (possibly reducing redraw activity)

o  update: something with: someArgument from: changedObject
something changed - for now, do a full redraw

drawing
o  chooseGrid
for every centimeter on the display ...

o  computeGraph
compute the graph

o  redrawX: x y: y width: w height: h
redraw the graph

o  test: arg
redraw the graph

usage example(s):

     self basicNew test:nil


Examples:


        |top graphView|

        top := StandardSystemView extent:300@300.
        graphView := SimpleFunctionGraphView origin:0.0@0.0 corner:1.0@1.0 in:top.

        graphView minXHolder:(-5 asValue).
        graphView maxXHolder:(5 asValue).
        graphView minYHolder:(-2 asValue).
        graphView maxYHolder:(2 asValue).

        graphView function:[:x | x sin].

        top open.
        |top graphView|

        top := StandardSystemView extent:300@300.
        graphView := SimpleFunctionGraphView origin:0.0@0.0 corner:1.0@1.0 in:top.

        graphView graphColorHolder:(Color white).
        graphView backgroundColor:Color black.
        graphView minXHolder:(-5 asValue).
        graphView maxXHolder:(5 asValue).
        graphView minYHolder:(-2 asValue).
        graphView maxYHolder:(2 asValue).

        graphView function:[:x | x sin].

        top open.
        |top graphView minX maxX|

        top := StandardSystemView extent:300@300.
        graphView := SimpleFunctionGraphView origin:0.0@0.0 corner:1.0@1.0 in:top.

        graphView graphColorHolder:(Color white).
        graphView backgroundColor:Color black.
        graphView minXHolder:(minX := -5 asValue).
        graphView maxXHolder:(maxX := 5 asValue).
        graphView minYHolder:(-2 asValue).
        graphView maxYHolder:(2 asValue).

        graphView function:[:x | x sin].

        top openAndWait.

        [
            [top realized] whileTrue:[
                Delay waitForSeconds:0.05.
                minX value:(minX value + 0.1).
                maxX value:(maxX value + 0.1).
            ]
        ] fork
                
        |top graphView functionList|

        functionList := OrderedCollection new.
        functionList add:[:x | x].
        functionList add:[:x | x * x].
        functionList add:[:x | x sqrt].
        functionList add:[:x | x sin].
        functionList add:[:x | x cos].
        functionList add:[:x | x tan].
        functionList add:[:x | x log].
        functionList add:[:x | 0].

        top := StandardSystemView extent:300@300.
        graphView := SimpleFunctionGraphView origin:0.0@0.0 corner:1.0@1.0 in:top.

        graphView graphColorHolder:(Color white).
        graphView backgroundColor:Color black.
        graphView minXHolder:(-5 asValue).
        graphView maxXHolder:(5 asValue).
        graphView minYHolder:(-2 asValue).
        graphView maxYHolder:(2 asValue).
        graphView displayModeHolder:(#lineMode asValue).

        graphView function:(functionList last).

        top openAndWait.

        [
            [top realized] whileTrue:[
                functionList do:[:funcBlock |
                    Delay waitForSeconds:1.
                    graphView displayModeHolder value:#dotMode.
                    Delay waitForSeconds:1.
                    graphView displayModeHolder value:#lineMode.
                    Delay waitForSeconds:1.
                    graphView displayModeHolder value:#dotMode.

                    Delay waitForSeconds:1.
                    graphView displayModeHolder value:#lineMode.
                    graphView functionHolder value:funcBlock.
                ]
            ]
        ] fork



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Mon, 26 Feb 2024 14:52:07 GMT