Initializing help system before first use

# Drawing a user graph

We now have gathered all the data required to draw the graph. Graphing functions are provided by the module mmsvg (documented in the `Mosel Language Reference Manual'), so it needs to be loaded at the beginning of the model by adding the following line:

     uses "mmsvg"

Then the following code extract draws the graph (note the use of the sum operator to create a list of points):

     svgaddgroup("GrS", "Solution values", SVG_GREY)
     forall(r in 1..ct) svgaddpoint("GrS", SOLRET(r), SOLDEV(r))
     svgaddline("GrS", sum(r in 1..ct) [SOLRET(r), SOLDEV(r)])

The user graph will be displayed in the editor window of the Workbench workspace. Select the tab SVG drawing to move it to the foreground. With the above we obtain the following output (due to the interplay of the various constraints the resulting graph is not a straight line as one might have expected at first thought):

Figure 6.1: Plot of the result graph

In addition to this graph, we may also display labeled points representing the input data (`GrL' for low risk shares and `GrH' for high risk shares):

     svgaddgroup("GrL", "Low risk", SVG_GREEN)
     svgaddgroup("GrH", "High risk", SVG_RED)

     forall(s in SHARES - RISK) do
      svgaddpoint("GrL", RET(s), DEV(s))
      svgaddtext("GrL", RET(s)+1, 1.3*(DEV(s)-1), s)
     end-do

     forall(s in RISK) do
      svgaddpoint("GrH", RET(s), DEV(s))
      svgaddtext("GrH", RET(s)-2.5, DEV(s)-1, s)
     end-do

Notice the set notation: SHARES - RISK means `all elements of SHARES that are not contained in RISK'.

The complete output now is:

Figure 6.2: Plot of result graph and data

Parent Topic Drawing user graphs

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.