MacSOS
Software License Agreement
======================================
GraphPro™ is Copyright ©2000-2008 by MacSOS.
You must purchase a separate copy of the software for each Macintosh it is used on.
Unless explicitly stated in writing, MacSOS does not grant permission to distribute
this source code for profit in any form, including but not limited to,
electronic information service distribution, bulletin board distribution,
and magnetic or optical medium distribution.
MacSOS is not responsible for any damage to the purchaser's computer system or data and in no event will MacSOS,
its officers, directors, employees or agents be responsible to the purchaser for any consequential,
incidental, or indirect damages (including damages for loss of business profits, business interruption,
loss of business information and the like) arising out of the use or inability to use the MacSOS product,
even if MacSOS has been advised of the possibility of such damages.

 

Preliminary Graph Pro Documentation:
======================================

Dr Gerard Hammond, © MacSOS 2008

GraphPro is a REALbasic Class used to display Cartesian Graphs.
It is based on the built-in Canvas Control.

Preliminary Graph Pro Documentation:
======================================

Dr Gerard Hammond, © MacSOS 2006

GraphPro is a REALbasic Class used to display Cartesian Graphs.
It is based on the built-in Canvas Control.

The cGraphPro object has several built-in features:
-It can have axes
-It can have a title
-It can have a legend
-It has a coloured outer rim in which AXIS labels generally reside
-It has an inner coloured region where the Cartesian graph is plotted.
-It can have several curves or datasets of nodes

Each of these features is an instance of the CGraphObject class.
CGraphObjects are abstract objects that have a position in space, a
height and width, may have a text description, might be draggable and have an
outline and may be invisible or have a background color. CGraphObjects can report
if a supplied point is within their bounds, can be repositioned and can draw themselves
onto the screen when requested.

CGraphObject.IsWithIn(X as integer, Y as integer) As Boolean
CGraphObject.Move(LeftPos as integer, topPos as integer)
CGraphObject.goDraw(theBuff as graphics)
CGraphObject.resized(w as integer, h as integer)

 

Almost all items in a cGraphPro derived graph are instances of this class.

AXIS:

Every Graph Pro object has at least 5 axes: X, Y, X2, Y2, and Z which hug
the inner Graph Region. In this version the Z axis is not implemented. These axes
are labelled "X", "Y", "X2", "Y2", and "Z" respectfully.
AXES can have these properties.
Angle as integer: Not yet implemented
AXISColor as Color exponent as string
mantissa as string
MajorTickFormatSpec as string
NumberMajorTicks as integer
NumberMinorTicks as integer
vertical as Boolean: this may change in future releases
BaseGp as CGraphPro
AXISPict as picture: Yes the entire axis could be a picture
AXISTextPlacement as string: This can be "left", "right",
"top", "below"
autosize as boolean: This determines if the axes should always be
larger than the bounds of the dataset in any of the curves
AXISLabelText as CText: This is the axis label. It is a CText item so that it can be dragged around.

 

TITLE:

Titles are instances of the CText which are turn instances of
CGraphObject. CText Classes are used to display styled text strings. The
visibility is set by CGraphPro.ShowTitle as Boolean. Use the
CGraphPro.ChangeTitle(theNewStr as string) method to change the text of the
title.

LEGEND:

Legends are draggable areas that describe curves.
The visibility is set by CGraphPro.ShowLegend as Boolean

 

CURVES:

Curves contain nodes. Curves can also be colored lines connecting nodes.
Curves calculate the basic statics across the whole dataset. The bounds of a
dataset can modify the bounds of an AXIS. Curves call on nodes to draw themselves
onto the screen, but the error bars for each node are actually drawn by the curve
(nodes don't understand the 'big picture' with regards to scaling). You add nodes
to curves indirectly via one of the four CGraphPro method's for adding nodes.

 

CGraphPro:

============


To use this class you need to do several things.

- Define which 'built-in' axis you want to display
- Add curves.
- Add Nodes.

Other things that are possible include:
- Define the inset distance between the top, left, right and Bottom edges of the screen and the inner plot area.
- setting the background Colour
- setting the plot area Colour
- Adding a title
- enabling in-line editing of the title by providing a link to an editfield that exists on the window of CGraphPro)
- enabling ContextualMenu menus
- enable the node 'Tooltips' information window

Properties:
============

ShowLegend = true
ShowTitle = true
ShowStats = true

 

Methods:
=========
CGraphPro.AddCurve(c as CCurve)
You can add curves to the CGraphPro canvas

CGraphPro.GetCurveIndexFromCurveName(theName as string) As integer
Returns an integer reference to a curve.

CGraphPro.NumberOfCurves() As Integer
Returns the number of curve on this graph.

CGraphPro.GetAxisIndexFromAxisName(AXISName as string) As Integer
Returns an integer reference to an AXIS.

CGraphPro.DrawGraph(printing as boolean)
This is the main draw to screen method.

CGraphPro.ChartResized()
This is the main recalculate and refresh method

 

Adding Nodes:
--------------
There are four methods for adding nodes:

CGraphPro.AddNode(CurveIndex as integer, theNode as CNode)
Use this when you want to explicitly insert a well-defined node

CGraphPro.AddNode(CurveIndex as integer, Xv as double, Yv as double)
This is a lazy method for adding n+1 nodes to a curve that already exists

CGraphPro.AddNode(Xv as double, Yv as double)
This is an even lazier method for adding extra nodes. The previous node is cloned and re-added.

CGraphPro.AddColouredNode(Xv as double, Yv as double, c as color)
This is a quick way to add a coloured node

CGraphPro.ChangeCurveNodeSize(CurveIdx as Integer, Newwidth as integer, NewHeight as integer)
Changes the size of all nodes in a curve

CGraphPro.ChangeShapeAllNodes(CurveIdx as integer, s as string, goP as goPolygon)
Changes the shape of all nodes in a curve

CGraphPro.ClearAllNodes()
Deletes all nodes from all curves.

CGraphPro.ClearAClearAllNodesInCurvellNodes()
Delete all nodes from a specific curve.

CGraphPro.ShowErrorBars(CurveIdx as integer, yes as Boolean)
Calls on the curve to show the errors for the nodes

 

Events:
=========
The cGraphPro Canvas provide extra events on top of the usual Canvas events:
resized, MouseDown, MouseOverNode and DoubleClick, UpdateMajorTickFormatSpec, NodeDoubleClick