Search Locate Previous Next Contents

Adding a Simple Chart from RainPro

If you have experimented with the RainPro graphics workspace, you might like to know how to include completed charts as an integral part of your Causeway application. The first thing to do is to copy the two required namespaces into your current workspace and test them:

      )copy rainpro ch PostScrp
      #.ch.Set 'nomark,fill'
      #.ch.Plot +\?23½12
      #.PostScrp.View #.ch.Close

This should draw a filled line chart of some cumulated random numbers. Rather than using the stand-alone viewer, it would be better to include the chart directly on the application form:


This uses the PostScript Graphics class (listed on the Special menu) to render a chart which was created by pressing the <Randomise> button. The PostScript property for the viewer is simply the text vector returned by #.ch.Close; it can also have a Page No property to select the page to view – not required here as we will only ever have one page.

One useful trick to note is that the chart is made to fit the PostScript field. Because this has been anchored to the height and width of the form the user could pull it to any shape, so the size must be queried every time a new chart is requested.

Note that the local variable ps is initially set to an empty character vector; by default local variables are initialised to scalar 0 which is not valid data for the PS class and will cause an error in its Refresh function.

      Disp dbx.rand[1 2 3;1 2 5]

ÚÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ

ÛFMÛRandom Number ViewerÛÚÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ Û

Û Û ÛÛBehaviourÛÚÎÎÂÂÎÎÎÎÎÂÎÎÌÛ Û

Û Û ÛÛ ÛÛCRÛÛps„’’Û{}ÛÛ Û

Û Û ÛÛ ÛÀÎÎÁÁÎÎÎÎÎÁÎÎÙÛ Û

Û Û ÛÃÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ Û

Û Û ÛÛLocals Û{psÛcht} Û Û

Û Û ÛÀÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ Û

ÃÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ

ÛPSÛ ÛÚÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌ Û

Û Û ÛÛBehaviour ÛÚÎÎÂÂÎÎÎÎÎÂÎÎÌ Û Û

Û Û ÛÛ ÛÛCRÛÛcht„¸Û{}Û Û Û

Û Û ÛÛ ÛÀÎÎÁÁÎÎÎÎÎÁÎÎÙ Û Û

Û Û ÛÃÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ Û

Û Û ÛÛPostScriptÛÚÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÌÛ Û

Û Û ÛÛ ÛÛExpressionÛps ÛÛ Û

Û Û ÛÛ ÛÃÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÝÛ Û

Û Û ÛÛ ÛÛDependenceÛ{ps}ÛÛ Û

Û Û ÛÛ ÛÃÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÝÛ Û

Û Û ÛÛ ÛÛForced Û1 ÛÛ Û

Û Û ÛÛ ÛÀÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÙÛ Û

Û Û ÛÀÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ Û

ÃÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÝ

ÛACÛ&Randomise ÛÚÎÎÎÎÎÎÎÎÎÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÌÛ

Û Û ÛÛBehaviourÛÚÎÎÂÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂÎÎÎÎÌÛÛ

Û Û ÛÛ ÛÛSLÛÛ#.ch.New 0 0,²2œcht ... Û{} ÛÛÛ

Û Û ÛÛ ÛÃÎÎÏÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÝÛÛ

Û Û ÛÛ ÛÛSLÛÛ#.ch.Set ‘nomark,fill’ Û{} ÛÛÛ

Û Û ÛÛ ÛÃÎÎÏÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÝÛÛ

Û Û ÛÛ ÛÛSLÛÛ#.ch.Plot +\?23½12 Û{} ÛÛÛ

Û Û ÛÛ ÛÃÎÎÏÏÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÏÎÎÎÎÝÛÛ

Û Û ÛÛ ÛÛSLÛÛps„#.ch.Close Û{ps}ÛÛÛ

Û Û ÛÛ ÛÀÎÎÁÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÙÛÛ

Û Û ÛÀÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙÛ

ÀÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÁÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÙ

The full code for the first line of the ‘Select’ action on the <Randomise> button is:

#.ch.New 0 0,²2œcht ’Do 'Where'

This cannot just query the size with ŒWG 'Size' because the PS object is drawn with ‘Coord’ ‘User’ and must be temporarily reset to ‘Coord’ ‘Pixel’ in order to get the correct size.

You might also note that the ‘Refresh even if value is unchanged‘ flag has been set for the PostScript property. This is simply to save time and workspace – it is always going to change so it is better to stop Causeway from buffering the old value and comparing it, particularly if we were plotting several thousand points.



Continue to: Setting Chart Options
© Copyright Causeway Graphical Systems Ltd 2001