*-----------------------------------------------------------------------------
* RMCDEMO.PRG  (adapted by R. Seiler from the VB6 program: RMCDEMO.FRM v.5)
*              This version for FiveWin (FWH) for xHarbour
*
*              April 9, 2008
*
*              For use with the RMChart graphics application developed by
*              Rainer Morgen and available for download at: www.rmchart.com
*
* This program demonstrates how to create a great variety of types of graphs
* for use in your own apps, utilizing functions in the Rmchart dll. It also
* shows how to load your user-data into the graphs at runtime.
*
* The conversion of this demo from VB6 to Fivewin for xHarbour is mostly 
* complete. However, none of the mouse-click functions originally programmed
* for VB6 work in FWH yet. Thus tooltips, scrolling and zoom-magnifier
* aren't yet functional. Some of the VB-specific code is still here for 
* reference, but commented out. Take care that some dll function calls, like 
* RMC_AddDataAxis() have some numeric parameters that MUST be passed as decimal
* values or they will GPF. That is because the DLL is expecting to receive
* data type DOUBLE, which is a decimal value. So use 0.0 instead of 0 and
* 100.0 instead of 100 to avoid a GPF.
*
* Keep in mind that Rmchart comes with its own IDE for creating graphs, called
* RMCdesigner.exe . So if cutting and pasting code from this demo into your
* app seems a drag to you, then you can design whatever graph you wish with 
* RMCdesigner.exe, just pointing and clicking away to your heart's content. 
* Then save your design to an .rmc file. This file can then be accessed by
* your FWH xHarbour app, and user data can then be easily plugged into it at 
* runtime.
*
* But if you love working with code, then just go ahead and copy and paste 
* the self-documented demo functions from here and from RmcFuncs.prg into 
* your app...and chart your way down the yellow brick road.
*
* Take special note in this demo of the standard sequence of functions that are
* usually called in creating any graph, such as: 
*
*  RMC_CreateChart(); RMC_AddRegion() ; RMC_AddCaption(); RMC_AddGrid(); etc.
*
* Knowing this pattern can ease your way in coding your own graphs.
*-----------------------------------------------------------------------------
/*
Procedures and functions in this prg:

  // NOTE: Only the first 5 functions are FWH-specific. If you are using some
  // other GUI, then these are probably the only functions you'll need to
  // to adapt to your Windows GUI. However, there are a lot of
  // FWH SysRefresh() and CursorWait() calls sprinkled throughout, plus a few
  // calls to FWH's MsgInfo() and MsgAlert().

  // The main entry into the app...
PROCEDURE Main()

  // Create the app's menu system...
STATIC FUNCTION BuildMenu()

  // Create child window...
STATIC FUNCTION MakeChWnd()

  // Command exiting of the app...
PROCEDURE cmdClose()

  // Exit the app...
EXIT PROCEDURE EndAll()

  // Print a chart...
STATIC FUNCTION cmdPrint()

  // Save a chart's design file...
STATIC FUNCTION cmdSave()
  
  // Set main window to pixels...
STATIC FUNCTION Form_Load()

  // Delete a chart design (and its magnified version too)...
STATIC FUNCTION Form_Unload(nlCancel)

  // Paint/repaint a chart design on main window...
STATIC FUNCTION oWnd_Paint()

  // Paint/repaint a chart design on child window...
STATIC FUNCTION oWndCh_Paint()

  // Activate mouse functions (already built-in for FWH)...
STATIC FUNCTION oWnd_MouseMove(nButton, nShift, nX, nY )
STATIC FUNCTION oWndCh_MouseDown( nButton, nShift, nX, nY )
STATIC FUNCTION Picture3_MouseUp(nButton, nShift, nX , nY )

  // Reset file-wide statics, etc., for new display...
STATIC FUNCTION DoSettings()

  // Demos of 15 specific types of graphs...   (search code:)
STATIC FUNCTION mnSingleBars()                     *sb
STATIC FUNCTION mnGroupedBars()                    *gb
STATIC FUNCTION mnStackedBars()                    *st
STATIC FUNCTION mnFloatingBars()                   *fb
STATIC FUNCTION mnBarsImage()                      *bi
STATIC FUNCTION mnSimpleLine()                     *sl
STATIC FUNCTION mnIndexedLine()                    *il
STATIC FUNCTION AddMovingAverage()                 *ama
STATIC FUNCTION mnMissingData()                    *md
STATIC FUNCTION mnBarsLines()                      *bl
STATIC FUNCTION mnDonut()                          *do
STATIC FUNCTION mnPyramid()                        *py
STATIC FUNCTION mnPie()                            *pi
STATIC FUNCTION mnXYSimple()                       *xys
STATIC FUNCTION mnXY2series()                      *xy2

  // Some utilities...
STATIC FUNCTION VScroll1_Change()
STATIC FUNCTION VScroll1_Scroll()
STATIC FUNCTION mnScroll()
STATIC FUNCTION mnTimer()
STATIC FUNCTION StartTimer()
STATIC FUNCTION TimedWork()

  // Load a chart onto the screen from a preexisting chart file...
STATIC FUNCTION mnFile()
STATIC FUNCTION mnDatastring()
STATIC FUNCTION mnTranspChart()
STATIC FUNCTION mnZoom()
STATIC FUNCTION ShowMagnification( oInfo )  // ..As tRMC_INFO)
STATIC FUNCTION mnMagnifier()
STATIC FUNCTION ShowInfo()  // oInfo IS tRMC_INFO and is file-wide static
                            // and so is not passed as a param.
  // Displays a message with the action number where an error occurred...
  // (user gives number to programmer, who then finds it in this code).
FUNCTION IsError(nError)
STATIC FUNCTION Choose()

  // Either load oInfo with tech graph specs, or reset its values to 0...
STATIC FUNCTION InfoGet(nRegionIndex, nSeriesIndex, nDataIndex, lResetOnly)

  // Special tests of some RMChart functions...
STATIC FUNCTION TestChart(cRMCfile,lFwh)

// Dummy func for FWH Errsysw()
FUNCTION OemToChara() ; Return nil

*/ //------------------- End of Functions List ------------------------------//

#include "FiveWin.ch"
#include "hbdll.ch"
#include "Rmchart.ch"  // Look at this file to see keywords for 174 colors and
#include "DllxHb.ch"   //      other constants.
#include "cstruct.ch"
#include "wintypes.ch"

#define True   1
#define False  0
#define HH_DISPLAY_INDEX  2

#define CLR_RMCBLUE   nRGB(99,148,236)  // = "AliceBlue" (Rmchart demo color)
#define CLR_RMCGOLD   nRGB(248,208,0)   // = "Gold"             "   "    "
#define CLR_RMCBRONZE nRGB(221,204,163) // = "Metallic Bronze"  "   "    "

#define TAB   CHR(9)
#command QUIT => ( PostQuitMessage( 0 ), __Quit() ) // suggested by Enrico

#define DC_CALL_STD          0x0020   // Needed if using xHb's DLLCALL()
                                      // instead of FWH's DLL32.
// FILE-WIDE STATICS...
/* (Note to VB programmers looking at this translation from VB to xHb code:
    In xHarbour, a variable declared as a file-wide static is visible to all
    functions or procedures within the .prg file, but not visible to funcs
    in other .prg's - to which these vars generally are passed as params.
    A var declared as "local" within a function is visible only within that
    function. File-wide statics are declared near the top of the prg ahead of
    the start of the first function or proc within the prg.)
*/
STATIC ;
       aBack     := {}         ,;
       cAppTitle := ""         ,;
       cPath     := ""         ,;
       hXHBdll   := 0          ,;
       hRmcDll   := 0          ,;
       nCtrlId   := 0          ,;
       nWleft    := 0          ,;
       nWtop     := 0          ,;
       oBrush                  ,;
       oWnd                    ,;
       oWndCh                  ,;
       oDlgTst

STATIC ;
       ID_RMC1       := 10001  ,;
       ID_RMC2       := 10002  ,;
       nlAllowChange := 0      ,;
       nlIsZoom      := 0      ,;
       nlIsMagnifier := 0      ,;
       oTimer1                 ,;
       oVScroll1

STATIC ;   // These are all of the tRMC_INFO elements...
    oInfo              , ;
    oInfo_nXPos        , ;
    oInfo_nYPos        , ;
    oInfo_nXMove       , ;
    oInfo_nYMove       , ;
    oInfo_nRegionIndex , ;
    oInfo_nRLeft       , ;
    oInfo_nRTop        , ;
    oInfo_nRRight      , ;
    oInfo_nRBottom     , ;
    oInfo_nSeriesIndex , ;
    oInfo_nDataIndex   , ;
    oInfo_nChartType   , ;
    oInfo_nSLeft       , ;
    oInfo_nSTop        , ;
    oInfo_nSRight      , ;
    oInfo_nSBottom     , ;
    oInfo_nSTop2       , ;
    oInfo_nSBottom2    , ;
    oInfo_nGLeft       , ;
    oInfo_nGTop        , ;
    oInfo_nGRight      , ;
    oInfo_nGBottom     , ;
    oInfo_nGCol        , ;
    oInfo_nGRow        , ;
    oInfo_nData1       , ;
    oInfo_nData2       , ;
    oInfo_nData3       , ;
    oInfo_nData4       , ;
    oInfo_nVirtData1   , ;
    oInfo_nVirtData2   , ;
    oInfo_nVirtData3   , ;
    oInfo_nVirtData4

********************************** C Data Structures ************************

// The following lines setup C structures for oData, oColors, etc. 

// Any array passed as a parameter to an RMChart.dll function must be passed 
// as a C data structure. All of the required C structures are declared at the
// top of the PRG as shown here.

pragma pack(4) 

// Note: must precede "DOUBLE" with "CTYPE_" due to name conflict with Clipper
//       and also with the definition for double border.

typedef struct {;
  CTYPE_DOUBLE nDouble[4];
} DataStructD4

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStructD5

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStructD5b

typedef struct {;
  CTYPE_DOUBLE nDouble[6];
} DataStructD6

typedef struct {;
  CTYPE_DOUBLE nDouble[10];
} DataStructD10

typedef struct {;
  CTYPE_DOUBLE nDouble[10];
} DataStructD10b

typedef struct {;
  CTYPE_DOUBLE nDouble[12];
} DataStructD12

typedef struct {;
  CTYPE_DOUBLE nDouble[20];
} DataStructD20

typedef struct {;
  CTYPE_DOUBLE nDouble[300];
} DataStructD300

typedef struct {;
  CTYPE_DOUBLE nDouble[1000];
} DataStructD1000

typedef struct {;
  CTYPE_LONG nLong[3];
} DataStructL3

typedef struct {;
  CTYPE_LONG nLong[3];
} PointsStructL3

typedef struct {;
  CTYPE_LONG nLong[5];
} ColorStructL5

typedef struct { ;
  CTYPE_LONG   nLong[24]  ;
  CTYPE_DOUBLE nDouble[8] ; 
} tRMC_INFO

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStruct1

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStruct2

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStruct2b

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStruct2c

typedef struct {;
  CTYPE_DOUBLE nDouble[5];
} DataStruct2d

typedef struct {;
  CTYPE_DOUBLE nDouble[10];
} DataStruct4a

typedef struct {;
  CTYPE_DOUBLE nDouble[10];
} DataStruct4b

typedef struct {;
  CTYPE_LONG nLong[10];
} DataStruct4c

typedef struct {;
  CTYPE_LONG nLong[5];
} ColorStruct

*------------------------------- End of C structures setup ---------------
**************************************************************************

PROCEDURE Main()

   cPath  := CurDrive()+":\"+CurDir()
   nWleft := 6
   nWtop  := 3

 // Handle years beyond 2000. But allow for birthdates of 80 yr old employees,
 // so that during 2007 all years from '27 through '99 will be treated as in
 // the 1900's and all years from '00 through '26 will be treated as in 2000's.
 // Epoch base date advances automatically each year. 
   IF YEAR(DATE()) < 2099
      SET EPOCH TO (YEAR( DATE() ) - 80)
     ELSE
      SET EPOCH TO 2000 
   ENDIF

   hRmcDll  := LoadLibrary( "RMCHART.DLL" )

   SETHandle(hRmcDll)  // Send hRmcDll to Rmc4xHb.prg

   SET _3DLOOK ON

   DEFINE BRUSH oBrush COLOR GetSysColor(15)

   DEFINE WINDOW oWnd FROM 3, 6 TO 45, 120 ;
      TITLE "RmChart Demo" ;
      BRUSH oBrush         ;
      MENU  BuildMenu()    ;
      VSCROLL              ;
      //MDI                   // Using MDI interferes with some mouse actions
                              // like tooltips.

   SET MESSAGE OF oWnd TO "RMChart message bar" ;
      CENTERED DATE KEYBOARD 2007

   ACTIVATE WINDOW oWnd ;
     ON INIT( MakeChWnd()       , ;
              ID_RMC1 := 100    , ;
              nCtrlID := ID_RMC1 ;
             )

   oBrush:End()

RETURN
*------------------------------
  // Create the app's main menu system...
STATIC FUNCTION BuildMenu()

   local  oMenu,cRmcFile := "",lOk := .f.
   local  nRegionIndex := 1,nSeriesIndex := 1,nDataIndex := 1,lResetOnly := .f.
   static lHide := .f.,lFwh := .f.

   MENU oMenu 2007
      MENUITEM "&Grid Based" ;
        MESSAGE "Grid based."
      MENU
         MENUITEM   "&Single Bars"  ;
            ACTION  mnSingleBars()  ;
            MESSAGE "Single bars."

         MENUITEM   "&Grouped Bars." ;
            ACTION  mnGroupedBars()  ;
            MESSAGE "Grouped bars."

         MENUITEM   "&Stacked Horizontal Bars" ;
            ACTION  mnStackedBars()            ;
            MESSAGE "Stacked horizontal bars."

         MENUITEM   "&Floating Bars" ;
            ACTION  mnFloatingBars() ;
            MESSAGE "Floating bars"

         MENUITEM   "&Bars - diff. colors and Bkgrnd" ;
            ACTION  mnBarsImage()                     ;
            MESSAGE "Bars with diff. colors and BgImage"

         SEPARATOR
      
         MENUITEM   "&Line with a trend line" ;
            ACTION  mnSimpleLine()            ;
            MESSAGE "Line with a trend line"

         MENUITEM   "&Indexed Line" ;
            ACTION  mnIndexedLine() ;
            MESSAGE "Indexed line"

         MENUITEM   "&Lines with missing data" ;
            ACTION  mnMissingData()            ;
            MESSAGE "Lines with missing data"

         SEPARATOR

         MENUITEM   "&Bars and Line" ;
            ACTION  mnBarsLines()    ;
            MESSAGE "Bars and line"

         SEPARATOR

         MENUITEM   "&Exit" ;
            ACTION  cmdClose()    ;
            MESSAGE "Exit program."
      ENDMENU

      MENUITEM "&Not Grid Based" ;
        MESSAGE "Not Grid based."
      MENU
         MENUITEM   "&Donut with Image" ;
            ACTION  mnDonut()           ;
            MESSAGE "Donut with Image"

         MENUITEM   "&Pyramid"  ;
            ACTION  mnPyramid() ;
            MESSAGE "Pyramid"

         MENUITEM   "&Pie"  ;
            ACTION  mnPie() ;
            MESSAGE "Pie"
      ENDMENU

      MENUITEM "&XYSeries" ;
        MESSAGE "XYseries."
      MENU
         MENUITEM   "&Simple"    ;
            ACTION  mnXYSimple() ;
            MESSAGE "Simple"

         MENUITEM   "&Two series with 2 axes pairs" ;
            ACTION  mnXY2series()                   ;
            MESSAGE "Two series with 2 axes pairs"
      ENDMENU

      MENUITEM "&Miscellaneous" ;
        MESSAGE "Miscellaneous."
      MENU
         MENUITEM   "&Scroll chart" ;
            ACTION  mnScroll()      ;
            MESSAGE "Scroll chart"

         MENUITEM   "&Timer chart - programmers' life expectancy" ;
            ACTION  mnTimer()      ;   
            MESSAGE "Timer chart"

         MENUITEM   "&Draw chart from file" ;
            ACTION  mnFile()                ; 
            MESSAGE "Draw chart from file"

         MENUITEM   "&Draw chart from data string" ;
            ACTION  mnDatastring()                 ; 
            MESSAGE "Draw chart from data string"

         MENUITEM   "&Transparent chart" ;
            ACTION  mnTranspChart()      ; 
            MESSAGE "Transparent chart"

         SEPARATOR

         MENUITEM   "&Zoom"  ;
            ACTION  mnZoom() ;
            MESSAGE "Zoom"

         MENUITEM   "&Magnifier"  ;
            ACTION  mnMagnifier() ; 
            MESSAGE "Magnifier"
      ENDMENU

      MENUITEM "&Tests Menu"
      MENU

         MENUITEM   "&Select Graph File"                         ;
            ACTION   cRmcFile := RTRIM(cGetFile( cPath+"\*.rmc", ;
                                       "Select a graph file" )), ;
                     TestChart(cRmcFile,lFwh )                        ;
            MESSAGE "Select graph file."

         MENUITEM   "S&imple Chart Test"               ;
            ACTION  TestChart(cPath+"\SimpleBar2.rmc",lFwh ) ;
            MESSAGE "Run simple bar chart test."

         MENUITEM   "&4 Regions Test"                  ;
            ACTION  TestChart(cPath+"\4_regions_B.rmc",lFwh ) ;
            MESSAGE "Run 4 regions chart test."

         MENUITEM   "&Hide or Show graph"                      ;
            ACTION  IF(!lHide,(oDlgTst:Hide(),lHide := .t.),    ;
                              (oDlgTst:Show(),SysRefresh(),     ;
                               IF(lFwh,;
                                       RMC_Draw(nCtrlId),;
                                       DLLCall(hRmcDll,DC_CALL_STD,"RMC_DRAW",;
                                               nCtrlId);
                                  ),;
                               lHide := .f.) ;
                       )                                       ;
            MESSAGE "Hide or show graph."

         MENUITEM   "&Show Graph's Tech Info"                  ;
            ACTION ( lOk := MsgYesNo("Is a graph displayed?"),;
                     IF(lOk, (;
                              InfoGet(nRegionIndex, nSeriesIndex, nDataIndex, lResetOnly) , ;
                              ShowInfo() ;
                              ),;
                        );
                    )

      ENDMENU

      MENUITEM "&Help" ;
        MESSAGE "RMChart Help."
      MENU
         MENUITEM   "&RMChart Help" ;
            ACTION  Winexec("HH.EXE Rmchart.chm")   ;
            MESSAGE "Complete RMChart documentation and Help."

      ENDMENU

   ENDMENU  // End of the entire menu system

RETURN oMenu

//*cw------------------------------------------------------------------------//
  // Create child window...
STATIC FUNCTION MakeChWnd()

/* Can't use MDI due to mouse problems. Using a dialog box instead named oWndCh.
   DEFINE WINDOW oWndCh MDICHILD OF oWnd    ;
          FROM 2, 2 TO 37, 110 ;
          STYLE nOr(WS_CHILD) ;
          COLOR "N/W"

   ACTIVATE WINDOW oWndCh
*/

   // Dialog used like a child window by mnMagnifier for ID_RMC2...
   DEFINE DIALOG oWndCh OF oWnd    ;
          FROM 18, 2 TO 37, 110 ;
          STYLE nOr(WS_CHILD) ;
          COLOR "N/W"

   @ 3,5 SAY "This magnifier is not working yet." OF oWndCh COLOR "N/W"

   ACTIVATE DIALOG oWndCh ;
     NOWAIT

   oWndCh:Hide()

   // Dialog used by TestChart()...
   DEFINE DIALOG oDlgTst OF oWnd    ;
          FROM 2, 2 TO 37, 110 ;
          STYLE nOr(WS_CHILD) ;
          COLOR "N/W"

   ACTIVATE DIALOG oDlgTst ;
     NOWAIT

   oDlgTst:Hide()

RETURN nil
//---------------------------------------------------------------------------//
  // Mandate app exit...
PROCEDURE cmdClose()

    IF !EMPTY(oWndCh)
       oWndCh:End()
    ENDIF
    IF !EMPTY(oWnd)
       oBrush:End()
       oWnd:End()    // This automatically forces execution of the EXIT PROC
    ENDIF

RETURN
*--------------------------------------
EXIT PROCEDURE EndAll()

    IF !EMPTY(oWndCh)
       oWndCh:End()
    ENDIF
    IF !EMPTY(oWnd)
       oBrush:End()
       oWnd:End()
    ENDIF

*    MsgInfo("Executing exit procedure.")

     // Always delete the chart when closing the app!!
    RMC_DeleteChart( nCtrlId )

    FreeLibrary( hRmcDll )
    ResAllFree()
    SysWait(.1)
    CursorArrow()
    Close Databases
    Clear Memory

RETURN
*-------------------------------------------

*----------------------------
STATIC FUNCTION cmdPrint()
    If MsgYesNo("Send current chart to the default printer?", "RMChart Demo")
        RMC_Draw2Printer( ID_RMC1 )
    EndIf
RETURN nil
*----------------------------
STATIC FUNCTION cmdSave()
    RMC_Draw2File( ID_RMC1, "RMChartDemo.png" )
    MsgInfo( "Chart was saved as 'RMChartDemo.png' in the current directory" )
RETURN nil
*----------------------------
STATIC FUNCTION Form_Load()
*    oWnd:ScaleMode = 3 // set the scale mode of the picture box to pixel!
RETURN nil
*----------------------------
STATIC FUNCTION Form_Unload(nlCancel)
    // Always delete the chart when unloading the Form!!
    RMC_DeleteChart( ID_RMC1 )
    If nlIsMagnifier = 1
        RMC_DeleteChart( ID_RMC2 )
    EndIf
RETURN nil
*----------------------------
STATIC FUNCTION oWnd_Paint()
    // This is necessary for repaint!
    RMC_Paint( ID_RMC1 )
RETURN nil
*----------------------------
STATIC FUNCTION oWndCh_Paint()
    // This is necessary for repaint!
    RMC_Paint( ID_RMC2 )
RETURN nil
*----------------------------
STATIC FUNCTION SetWndBlocks()

/* If use these codeblocks, then may get GPF's with these errors: 
Couldn't scan: 'hbsetup.ch'
Couldn't scan: 'hboo.ch'
Couldn't scan: 'hbvmpub.h'
Couldn't scan: 'hbapiitm.h'
Couldn't scan: 'hbstack.h'
Couldn't scan: 'thread.h'
Couldn't scan: 'local.h'
Couldn't scan: 'hbvm.h'
// ( The above files are all found in \xHb\include; Copy into special folder: \fwh\include3 and then link in this "include" folder
*/

// Couldn't get these codeblocks to work properly yet - sometimes got GPFs...

oWnd:bMMoved      := {|| oWnd_MouseMove( 0, 0, 0, 0 ) }

oWnd:bLClicked    := {|| nlAllowChange := 1, oWndCh_MouseDown( 1, 0, 0, 0 ), nAllowChange := 0 }
oWnd:bLButtonUp   := {|| Picture3_MouseUp( 1, 0, 0, 0 ) }

oWnd:bRClicked    := {|| oWndCh_MouseDown( 2, 0, 0, 0 ) }
oWnd:bRButtonUp   := nil

oWnd:bMButtonDown := nil
oWnd:bMButtonUp   := nil


RETURN nil
*----------------------------
STATIC FUNCTION UnSetWndBlocks()

nlAllowChange := 0

oWnd:bMMoved      := nil 

oWnd:bLClicked    := nil
oWnd:bLButtonUp   := nil

oWnd:bRClicked    := nil
oWnd:bRButtonUp   := nil

oWnd:bMButtonDown := nil
oWnd:bMButtonUp   := nil


RETURN nil
*----------------------------
STATIC FUNCTION oWnd_MouseMove(nButton, nShift, nX, nY )
    LOCAL nRetVal := 0
    LOCAL aCursorPos := {}
    LOCAL nRegionIndex := 1,nSeriesIndex := 1,nDataIndex := 1,lResetOnly := .f.

    // Defaults:
    IF(EMPTY(nButton), nButton := 0,)
    IF(EMPTY(nShift), nShift := 0,)
    IF(EMPTY(nX), nX := 0, )
    IF(EMPTY(nY), nY := 0, )

    aCursorPos := GetCursorPos()

    nX := aCursorPos[2]
    nY := aCursorPos[1]

    // In case we've added ToolTips, show them
    nRetVal = RMC_ShowToolTips(ID_RMC1, nX, nY)

    // Only necessary for the Zoom and Magnifier demos with VB DC...
    // (This function GPF's in FWH/xHb )
*   RMC_SetMouseClick( ID_RMC1, RMC_MOUSEMOVE, nX, nY, @oInfo )

    // Get oInfo values...
    InfoGet(nRegionIndex, nSeriesIndex, nDataIndex, lResetOnly)


    // If in the magnifier demo...
    If oInfo_nChartType = RMC_MAGNIFIER_MODE
        ShowMagnification() // ...show the magnification chart
    EndIf

RETURN nil
*----------------------------
STATIC FUNCTION oWndCh_MouseDown( nButton, nShift, nX, nY )
    LOCAL nFirst := 0, nLast := 0, nL := 0, nT := 0, nR := 0, nB := 0, X, y
    LOCAL nRegionIndex := 1,nSeriesIndex := 1,nDataIndex := 1,lResetOnly := .f.
    LOCAL aCursorPos := {}

    // Defaults:
    IF(EMPTY(nButton), nButton := 0,)
    IF(EMPTY(nShift), nShift := 0,)
    IF(EMPTY(nX), nX := 0, )
    IF(EMPTY(nY), nY := 0, )

    // Get oInfo values...
    InfoGet(nRegionIndex, nSeriesIndex, nDataIndex, lResetOnly)

    aCursorPos := GetCursorPos()  // An FWH or xHb built-in function.

    nX := aCursorPos[2]
    nY := aCursorPos[1]

    // RMC_SetMouseClick() apparently is only for VB DC, so commented out.
    // We got the oInfo above with InfoGet().

    DO CASE
        Case nButton = 1   // Left Button
            If nShift = 0
                // Get oInfo for the current nX and nY position within the VB Picture-box DC
*               RMC_SetMouseClick( ID_RMC1, RMC_LBUTTONDOWN, nX, nY, @oInfo )
                If nlAllowChange = 1  // If we are in the simple line demo
                    If oInfo_nGCol > 0  // If you've clicked into a grid column
                        // Change the current data to the data corresponding 
                        // to the current nY location...    
                        RMC_SetSeriesSingleData( ID_RMC1, 1, 1, oInfo_nVirtData1, oInfo_nGCol, 0 )
    
                        // Refresh the trend line:
                        // Calc the trend and get the needed X/Y positions 
                        // (nL,nT,nR,nB) for the line...
                        RMC_CalcTrend( ID_RMC1, 1, 1, nFirst, nLast, nL, nT, nR, nB )

                        // Add a CustomLine to show the trend:
                        RMC_CODash( ID_RMC1, 1, nL, nT, nR, nB, ;
                                    RMC_LINE_FLAT_DASH, ;
                                    IIf(nFirst > nLast, ColorRed, ColorGreen), ;
                                    False, 2, RMC_ANCHOR_NONE, ;
                                    RMC_ANCHOR_ARROW_CLOSED )

                        // Draw the "legend" for the trend line:
                        RMC_CODash( ID_RMC1, 2, 470, 11, 500, 11, ;
                                    RMC_LINE_FLAT_DASH, ;
                                    IIf(nFirst > nLast, ColorRed, ColorGreen), ;
                                    False, 2 )

                        RMC_COText( ID_RMC1, 3, " Trend", 505, 5 )
                        
                        RMC_Draw( ID_RMC1 )  //  (re)draw the chart with the new data and the trend line

                    EndIf
                EndIf  
                If oInfo_nChartType = RMC_MAGNIFIER_MODE  // If in the magnifier demo
                    ShowMagnification() // Show the magnification chart

                EndIf
            ElseIf nShift = 1  // Shift
*                RMC_SetMouseClick( ID_RMC1, RMC_SHIFTLBUTTONDOWN, nX, nY, @oInfo )
            ElseIf nShift = 2  // Ctrl
*                RMC_SetMouseClick( ID_RMC1, RMC_CTRLLBUTTONDOWN, nX, nY, @oInfo )
                If oInfo_nChartType >= 0 // No zoom or magnifier mode
                    ShowInfo()         // show the info we got from the DLL
                End If
            EndIf
        Case nButton = 2  // Right Button
            If nShift = 0 
*                RMC_SetMouseClick( ID_RMC1, RMC_RBUTTONDOWN, nX, nY, @oInfo )
            ElseIf nShift = 1   // Shift
*                RMC_SetMouseClick( ID_RMC1, RMC_SHIFTRBUTTONDOWN, nX, nY, @oInfo )
            ElseIf nShift = 2   // Ctrl
*                RMC_SetMouseClick( ID_RMC1, RMC_CTRLRBUTTONDOWN, nX, nY, @oInfo )
            EndIf
    EndCase
*cc
*msginfo("End: oWndCh_MouseDown()")


RETURN nil
*----------------------------
STATIC FUNCTION Picture3_MouseUp(nButton, nShift, nX , nY )
    LOCAL oInfo IS tRMC_INFO

    // Defaults:
    IF(EMPTY(nButton), nButton := 0,)
    IF(EMPTY(nShift), nShift := 0,)
    IF(EMPTY(nX), nX := 0, )
    IF(EMPTY(nY), nY := 0, )

    aCursorPos := GetCursorPos()

    nX := aCursorPos[2]
    nY := aCursorPos[1]

    DO Case
        Case nButton = 1
             If nShift = 0 
                If (nlIsZoom = 1) .Or. (nlIsMagnifier = 1)
*                    RMC_SetMouseClick( ID_RMC1, RMC_LBUTTONUP, nX, nY, @oInfo )
                EndIf
             EndIf
    EndCase
RETURN nil
*----------------------------
STATIC FUNCTION DoSettings()
LOCAL VScroll1_Visible := 0

*    oVScroll1:Visible = False
*    VScroll1_Visible = False

    oWnd:oVScroll:Hide()  // doesn't work

    RMC_DeleteChart( nCtrlId )  // Get rid of any pre-displayed chart.

/* Original VB6 code...
    With oWnd            // Set the size for the main VB6 Picture control
        .Cls
        .Width = 11000
        .Height = 8000
    End With
*/

    UnSetWndBlocks()
 
    IF !EMPTY(oWndCh)
       oWndCh:Hide()  // Hide oWndCh ( which shows the magnification in the Magnifier demo), if visible
    ENDIF
    If nlIsMagnifier = 1 // If the Magnifier was the last active chart
        RMC_DeleteChart( ID_RMC2 ) // Delete the lower chart, which shows the magnification
    EndIf

    IF !EMPTY(oDlgTst)
       oDlgTst:Hide()  // Hide oWndCh ( which shows the magnification in the Magnifier demo), if visible
    ENDIF
 
*    StartTimer()   

    IF !EMPTY(oTimer1)
       oTimer1:nInterval = 0  // Stop the timer, if still running
    ENDIF

    nlAllowChange = 0   // Reset all flags
    nlIsMagnifier = 0
    nlIsZoom = 0

RETURN nil
*sb----------------------------
STATIC FUNCTION mnSingleBars()
    LOCAL oXpoints IS PointsStructL3,;
          oYpoints IS PointsStructL3,;
          nRetVal := 0   ,;
          sLabels := ""  ,;
          sTemp   := ""  ,;
          aData   := {}  
    LOCAL nL :=0, nT :=0, nR := 0, nB := 0, nAverage := 0
    LOCAL oData IS DataStructD5  // C structure built at top of this prg.
    LOCAL cRmcFile := "",nX := 0,nY := 0,sRMCfile := "",nExportOnly := 0
    LOCAL oInfo IS tRMC_INFO

cRMCfile = cPath+"\simplebar2.rmc"
sRMCfile := cRMCfile

IF !EMPTY(oWndCh)
   nX  := oWndCh:nLeft
   nY  := oWndCh:nTop
ENDIF

  // Can use this to test importing a design from an .rmc file. If used, then
  // comment out call to RMC_CreateChart() below...
* nRetVal := RMC_CreateChartFromFile(oWnd:hWnd,ID_RMC1,nX,nY,;
*                                     nExportOnly,sRMCfile )

 
    DoSettings()

*   oWndCh:Show()

    // Note: with xHb instead of VB, cannot use RMC_CreateChartOnDC(). Must
    // use RMC_CreateChart() instead. The "OnDC" version ONLY works with VB.

    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorAzure          , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 20                  , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )
 
   If nRetVal < 0 ; IsError(1) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )


    If nRetVal < 0 ; IsError(2) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************
   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "This is our chart's caption", ;  // sCaption
                 ColorBlue           , ;  // nBackColor
                 ColorYellow         , ;  // nTextColor
                 11                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )


    If nRetVal < 0 ; IsError(3) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorBeige          , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_LABELAXIS ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(4) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 100.0               , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLEDOT    , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 "$"                 , ;  // sUnit
                 "Axis Text"         , ;  // sText
                 ""                  , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )


    If nRetVal < 0 ; IsError(5) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels = "Label A*Label B*Label C*Label D*Label E"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 6                   , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLENONE   , ;  // nLineStyle
                 ""                    ;  // sText
                 )


    If nRetVal < 0 ; IsError(6) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read data values ******

    // Note that because xHarbour arrays start with 1 instead of 0, 
    // the array object below has one more element # than in the VB6 version...

    // First, load data into C structure array object...
    // (in your app, can load this data from database or wherever)
    oData:nDouble[1] := 60.0  // Your data goes into these 5 slots -
    oData:nDouble[2] := 70.0  // but this data is DOUBLE so MUST have decimal
    oData:nDouble[3] := 40.0  // or else app will crash!!
    oData:nDouble[4] := 60.0
    oData:nDouble[5] := 30.0

   // Note: in some cases, xHarbour can pass an actual array by reference to
   // its first element - aData[1] .  But most arrays here seem to actually
   // be objects, thus needing the C structure, and are passed as oData[1].

/* From RMChart.ch - Bar chart styles...
   
   RMC_BAR_FLAT           = 1   (default)
   RMC_BAR_FLAT_GRADIENT1 = 2 
   RMC_BAR_FLAT_GRADIENT2 = 3 
   RMC_BAR_HOVER          = 4 
   RMC_COLUMN_FLAT        = 5 
   RMC_BAR_3D             = 6 
   RMC_BAR_3D_GRADIENT    = 7 
   RMC_COLUMN_3D          = 8 
   RMC_COLUMN_3D_GRADIENT = 9 
   RMC_COLUMN_3D_FLUTED  = 10 

*/

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 5                   , ;  // nDataValuesCount
                 RMC_BARSINGLE       , ;  // nType
                 RMC_BAR_FLAT_GRADIENT2 , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorCornflowerBlue , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

*                 ColorTransparent    , ;  // nColor  - use this for multi-colors automatically assigned


    If nRetVal < 0 ; IsError(7) ; RETURN nil ; EndIf

    // Set third bar's color to Red:
   nRetVal = RMC_SetSeriesColor( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 1                   , ;  // nSeries
                 ColorRed            , ;  // nColor
                 3                     ;  // nIndex - bar # to get color
                 )

    // Add an average line to the chart:

    nAverage := 0.0         // MUST be decimal format because type is DOUBLE 
                            // - otherwise will crash !!

    nL := 10; nT := 50; nR := 150; nB := 80

    // Calc the average
   nRetVal = RMC_CalcAverage( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 1                   , ;  // nSeriesIndex
                 @nAverage           , ;  // nAverage - DOUBLE data type, must have decimal or will crash!
                 @nL                 , ;  // nXstart
                 @nT                 , ;  // nYstart
                 @nR                 , ;  // nXend
                 @nB                   ;  // nYend
                 )

    // Draw the average line
   nRetVal = RMC_CODash( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nCOIndex
                 nL                  , ;  // nXstart
                 nT                  , ;  // nYstart
                 nR                  , ;  // nXend
                 nB                  , ;  // nYend
                 RMC_LINE_FLAT       , ;  // nStyle
                 ColorGreen          , ;  // nColor
                 False               , ;  // nAsSpline
                 2                   , ;  // nLineWidth
                                     , ;  // nStartCap (a type of mark, i.e. a bullet)
                                       ;  // nEndCap (a type of mark, i.e. an arrow)
                 )

    // Add a legend for the average line:
    oXPoints:nLong[1] = 480; oXPoints:nLong[2] = 565; oXPoints:nLong[3] = 565
    oYPoints:nLong[1] = 185; oYPoints:nLong[2] = 185; oYPoints:nLong[3] = 218

   nRetVal := RMC_COLine( ;
                  ID_RMC1            , ;  // nCtrlID
                  2                  , ;  // nCOIndex
                  oXPoints           , ;  // anXpoints  (array in C struct obj)
                  oYPoints           , ;  // anYpoints  (array in C struct obj)
                  3                  , ;  // nPointsCount
                  RMC_LINE_FLAT      , ;  // nStyle
                  ColorGreen         , ;  // nColor
                  0                  , ;  // nAsSpline
                  2                  , ;  // nLineWidth
                  0                  , ;  // nStartCap (a type of mark, i.e. a bullet)
                  RMC_ANCHOR_ARROW_OPEN ; // nEndCap (a type of mark, i.e. an arrow)
                  )

   nRetVal = RMC_COText( ;
                 ID_RMC1             , ;  // nCtrlID
                 3                   , ;  // nCOIndex
                 "Average: " + TRANSFORM(nAverage, "99.99"), ; // sText
                 480                 , ;  // nLeft
                 169                 , ;  // nTop
                                     , ;  // nWidth (optional, as are the following...)
                                     , ;  // nHeight
                                     , ;  // nStyle
                                     , ;  // nBGColor
                                     , ;  // nLineColor
                                     , ;  // nTransparency
                                     , ;  // nLineAlignment
                                     , ;  // nTextColor
                                       ;  // sTextProperties
                 )

   nRetVal = RMC_Paint( ID_RMC1 )
        
   nRetVal = RMC_Draw( ID_RMC1 )
    If nRetVal < 0 ; IsError(8) ; RETURN nil ; EndIf


RETURN nil    // end mnSingleBars()
*gb-----------------------------------
STATIC FUNCTION mnGroupedBars()
    LOCAL ;
          i          := 0   ,;
          nC         := 0   ,;
          nDataCount := 0   ,;
          nRetVal    := 0   ,;
          sLabels    := ""  ,;
          sLegend    := ""  ,;
          aData      := {}  ,;  // redim
          aData2     := {}  ,;
          aPPC       := {}  
    LOCAL oData IS DataStructD5  // C structure built at top of this prg.

    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 597                 , ;  // nWidth
                 447                 , ;  // nHeight
                 ColorAliceBlue      , ;  // nBackColor
                 RMC_CTRLSTYLEFLATSHADOW, ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                                     , ;  // nToolTipwidth
                                       ;  // nBitmapBKColor
                 )
    If nRetVal < 0 ; IsError(9) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 "\OC"               , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(10) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorWhiteSmoke     , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_NONE      ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(11) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 100.0               , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                 ""                  , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )


    If nRetVal < 0 ; IsError(12) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels = "2000*2001*2002*2003*2004"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 6                   , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )


    If nRetVal < 0 ; IsError(13) ; RETURN nil ; EndIf

    //************** Add legend to region 1 *******************************

    sLegend = "Bananas*Apples*Cherries"

   nRetVal = RMC_AddLegend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLegend             , ;  // sLegend
                 RMC_LEGEND_TOP      , ;  // nLegendAlign
                 ColorLightYellow    , ;  // nLegendBackColor
                 RMC_LEGENDRECT      , ;  // nLegendStyle
                 ColorBlack          , ;  // nLegendTextColor
                 8                   , ;  // nLegendFoltSize
                 False                 ;  // nLegendIsBold
                 )


    If nRetVal < 0 ; IsError(14) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read data values (bananas) ******

    // First, load data into C structure array object...
    // (in your app, can load this data from database or wherever)
    oData:nDouble[1] := 30.0    // Your data goes into these 5 slots
    oData:nDouble[2] := 20.0
    oData:nDouble[3] := 40.0
    oData:nDouble[4] := 60.0
    oData:nDouble[5] := 10.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 5                   , ;  // nDataValuesCount
                 RMC_BARGROUP        , ;  // nType
                 RMC_BAR_HOVER       , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorGold           , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(15) ; RETURN nil ; EndIf

    //************** Add Series 2 to region 1 *******************************
    //****** Read data values (apples) ******

    // First, load data into C structure array object...
    // (in your app, can load this data from database or wherever)
    oData:nDouble[1] := 50.0    // Your data goes into these 5 slots
    oData:nDouble[2] := 70.0
    oData:nDouble[3] := 10.0
    oData:nDouble[4] := 40.0
    oData:nDouble[5] := 30.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 5                   , ;  // nDataValuesCount
                 RMC_BARGROUP        , ;  // nType
                 RMC_BAR_HOVER       , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorLightGreen     , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 2                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )


    If nRetVal < 0 ; IsError(16) ; RETURN nil ; EndIf

    //************** Add Series 3 to region 1 *******************************
    //****** Read data values (cherries) ******

    // First, load data into C structure array object...
    // (in your app, can load this data from database or wherever)
    oData:nDouble[1] := 40.0    // Your data goes into these 5 slots
    oData:nDouble[2] := 10.0
    oData:nDouble[3] := 30.0
    oData:nDouble[4] := 20.0
    oData:nDouble[5] := 80.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 5                   , ;  // nDataValuesCount
                 RMC_BARGROUP        , ;  // nType
                 RMC_BAR_HOVER       , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorSalmon         , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 3                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )


    If nRetVal < 0 ; IsError(17) ; RETURN nil ; EndIf
 
   nRetVal = RMC_Draw(ID_RMC1)
    If nRetVal < 0 ; IsError(18) ; RETURN nil ; EndIf

RETURN nil
*st-------------------------------------------------------------
STATIC FUNCTION mnStackedBars()
    LOCAL i := 0
    LOCAL nRetVal := 0
    LOCAL sLabels := ""
    LOCAL sLegend := ""
    LOCAL oData  IS DataStructD6  // ... As Double
 
    DoSettings()
        
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorBisque         , ;  // nBackColor
                 RMC_CTRLSTYLE3DLIGHT, ;  // nCtrlStyle
                 0                   , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 20                  , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(19) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 10                  , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 "this is the footer", ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(20) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************
   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "Example of stacked bars", ;  // sCaption
                 ColorBisque         , ;  // nBackColor
                 ColorBlack          , ;  // nTextColor
                 11                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(21) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorCornsilk       , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(22) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISBOTTOM  , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 50000.0             , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 " $"                , ;  // sUnit
                 "This is an optional axis text" ;  // sText
                                     , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(23) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels = "Label Nr. 1*Label Nr. 2*Label Nr. 3*Label Nr. 4*Label Nr. 5*Label Nr. 6"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 6                   , ;  // ntickCount
                 RMC_LABELAXISLEFT   , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(24) ; RETURN nil ; EndIf
    //************** Add legend to region 1 *******************************

    sLegend = "Apples*Pears*Cherries*Strawberries"

   nRetVal = RMC_AddLegend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLegend             , ;  // sLegend
                 RMC_LEGEND_CUSTOM_UR, ;  // nLegendAlign
                 ColorLightYellow    , ;  // nLegendBackColor
                 RMC_LEGENDRECT      , ;  // nLegendStyle
                 ColorBlue           , ;  // nLegendTextColor
                 8                   , ;  // nLegendFoltSize
                 False                 ;  // nLegendIsBold
                 )

    If nRetVal < 0 ; IsError(25) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************

    //****** Read data values (Apples) ******
    oData:nDouble[1] := 10000.0  // Your data goes into these 6 slots
    oData:nDouble[2] := 10000.0  // These are all DOUBLE so MUST have decimal!!
    oData:nDouble[3] := 16000.0
    oData:nDouble[4] := 12000.0
    oData:nDouble[5] := 20000.0
    oData:nDouble[6] := 10000.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 6                   , ;  // nDataValuesCount
                 RMC_BARSTACKED      , ;  // nType
                 RMC_COLUMN_FLAT     , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorDarkBlue       , ;  // nColor
                 True                , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(26) ; RETURN nil ; EndIf

    // Set CustomText for the ToolTips
    For i = 1 To 6
        RMC_SetCustomToolTipText( ID_RMC1, 1, 1, i , "Item: Apples" + ;
            Chr(13) + Chr(10) + "Value: " + TRANSFORM(oData:nDouble[i], "99,999") )
        SysRefresh()
    Next

    //************** Add Series 2 to region 1 *******************************

    //****** Read data values (Pears) ******
    oData:nDouble[1] :=  5000.0    // Your data goes into these 6 slots
    oData:nDouble[2] :=  7000.0
    oData:nDouble[3] :=  4000.0
    oData:nDouble[4] := 15000.0
    oData:nDouble[5] := 10000.0
    oData:nDouble[6] := 10000.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 6                   , ;  // nDataValuesCount
                 RMC_BARSTACKED      , ;  // nType
                 RMC_COLUMN_FLAT     , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorDarkGreen      , ;  // nColor
                 True                , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )


    If nRetVal < 0 ; IsError(27) ; RETURN nil ; EndIf

    //************** Add Series 3 to region 1 *******************************

    //****** Read data values (Cherries) ******
    oData:nDouble[1] := 10000.0    // Your data goes into these 6 slots
    oData:nDouble[2] :=  3000.0
    oData:nDouble[3] := 12000.0
    oData:nDouble[4] := 10000.0
    oData:nDouble[5] :=  5000.0
    oData:nDouble[6] := 20000.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 6                   , ;  // nDataValuesCount
                 RMC_BARSTACKED      , ;  // nType
                 RMC_COLUMN_FLAT     , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorMaroon         , ;  // nColor
                 True                , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(28) ; RETURN nil ; EndIf

    //************** Add Series 4 to region 1 *******************************

    //****** Read data values (Strawberries) ******
    oData:nDouble[1] :=  5000.0    // Your data goes into these 6 slots
    oData:nDouble[2] :=  9000.0
    oData:nDouble[3] := 12000.0
    oData:nDouble[4] :=  6000.0
    oData:nDouble[5] := 10000.0
    oData:nDouble[6] :=  8000.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 6                   , ;  // nDataValuesCount
                 RMC_BARSTACKED      , ;  // nType
                 RMC_COLUMN_FLAT     , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorDarkGoldenrod  , ;  // nColor
                 True                , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(29) ; RETURN nil ; EndIf
 
    // Activate ToolTips:
   nRetVal = RMC_AddToolTips( ID_RMC1, oWnd:hWnd, 100 )
    
   nRetVal = RMC_Draw( ID_RMC1 )
    If nRetVal < 0 ; IsError(30) ; RETURN nil ; EndIf
 
RETURN nil
*fb----------------------------
STATIC FUNCTION mnFloatingBars()
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sLabels := ""
    LOCAL sLabels2 := ""
    LOCAL sTemp := ""
    LOCAL aData := {}
    LOCAL aData2 := {}
    LOCAL aPPC := {}
    LOCAL oData IS DataStructD12
    LOCAL oXYAxis //As tRMC_XYAXIS
    LOCAL oXYSeries //As tRMC_XYSERIES
 
    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 550                 , ;  // nWidth
                 300                 , ;  // nHeight
                 ColorLightGray      , ;  // nBackColor
                 RMC_CTRLSTYLE3DLIGHT, ;  // nCtrlStyle
                 0                   , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )


    If nRetVal < 0 ; IsError(31) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )


    If nRetVal < 0 ; IsError(32) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************
   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "Birth of a Killer App", ;  // sCaption
                 ColorDefault        , ;  // nBackColor
                 ColorBlack          , ;  // nTextColor
                 11                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )


    If nRetVal < 0 ; IsError(33) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorPaleGoldenrod  , ;  // nGridBackColor
                 True                , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_NONE      ;  // nBiColor
                 )


    If nRetVal < 0 ; IsError(34) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************

    sLabels = "04/01*04/02*04/03*04/04*04/05*04/06*04/07*04/08*04/09*04/10*04/11*04/12*05/01"

   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISBOTTOM  , ;  // nAlignment
                 1.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 13.0                , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 13                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                 sLabels             , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )


    If nRetVal < 0 ; IsError(35) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels2 = "Design*Development*Testing*Bug Fixing*Documentation*Marketing"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels2            , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 6                   , ;  // ntickCount
                 RMC_LABELAXISLEFT   , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(36) ; RETURN nil ; EndIf

    //************** Add legend to region 1 *******************************

    sLegend = "Schedule*Reality"

   nRetVal = RMC_AddLegend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLegend             , ;  // sLegend
                 RMC_LEGEND_CUSTOM_UR, ;  // nLegendAlign
                 ColorLightBlue      , ;  // nLegendBackColor
                 RMC_LEGENDRECT      , ;  // nLegendStyle
                 ColorMediumBlue     , ;  // nLegendTextColor
                 8                   , ;  // nLegendFoltSize
                 False                 ;  // nLegendIsBold
                 )


    If nRetVal < 0 ; IsError(37) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************

    //****** Read data values ******

    oData:nDouble[1] := 1.0    // Your data goes into these 12 slots
    oData:nDouble[2] := 3.0
    oData:nDouble[3] := 4.0
    oData:nDouble[4] := 6.0
    oData:nDouble[5] := 6.0
    oData:nDouble[6] := 4.0
    oData:nDouble[7] := 7.0    
    oData:nDouble[8] := 4.0
    oData:nDouble[9] := 9.0
    oData:nDouble[10] :=  3.0
    oData:nDouble[11] := 10.0
    oData:nDouble[12] :=  3.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 12                  , ;  // nDataValuesCount
                 RMC_FLOATINGBARGROUP, ;  // nType
                 RMC_BAR_HOVER       , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorPaleGreen      , ;  // nColor
                 True                , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )


    If nRetVal < 0 ; IsError(38) ; RETURN nil ; EndIf
    //************** Add Series 2 to region 1 *******************************

    //****** Read data values ******

    oData:nDouble[1] :=  1.0    // Your data goes into these 12 slots
    oData:nDouble[2] :=  0.5
    oData:nDouble[3] :=  1.5
    oData:nDouble[4] := 10.5
    oData:nDouble[5] := 12.0
    oData:nDouble[6] :=  1.0
    oData:nDouble[7] := 12.0    
    oData:nDouble[8] :=  1.0
    oData:nDouble[9] := 12.5
    oData:nDouble[10] :=  0.5
    oData:nDouble[11] :=  2.0
    oData:nDouble[12] := 11.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 12                  , ;  // nDataValuesCount
                 RMC_FLOATINGBARGROUP, ;  // nType
                 RMC_BAR_HOVER       , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorOrangeRed      , ;  // nColor
                 True                , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )


    If nRetVal < 0 ; IsError(39) ; RETURN nil ; EndIf
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )
    If nRetVal < 0 ; IsError(40) ; RETURN nil ; EndIf

RETURN nil
*bi---------------------------------------------------
STATIC FUNCTION mnBarsImage()
    LOCAL nRetVal := 0
    LOCAL sLabels := ""
    LOCAL oData  IS DataStructD5
    LOCAL oColor IS ColorStructL5
    
*    DoSettings()
    
   ID_RMC1 := 100 // per Antonio

    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 500                 , ;  // nHeight
                 ColorTransparent    , ;  // nBackColor
                 RMC_CTRLSTYLEIMAGE  , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 "seasky.jpg"        , ;  // sBgImage 
                 ""                  , ;  // sFontName
                 100                 , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(41) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(42) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorTransparent    , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )


    If nRetVal < 0 ; IsError(43) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISBOTTOM  , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 100.0               , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorChalk          , ;  // nTextColor
                 ColorChalk          , ;  // nLineColor
                 RMC_LINESTYLEDOT    , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                                     , ;  // sLabels
                                       ;  // nLabelAlignment
                 )


    If nRetVal < 0 ; IsError(44) ; RETURN nil ; EndIf
    //************** Add label axis to region 1 *****************************

    sLabels = "Label 1*Label 2*Label 3*Label 4*Label 5"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 5                   , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorYellow         , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorChalk          , ;  // nLineColor
                 RMC_LINESTYLENONE   , ;  // nLineStyle
                 ""                    ;  // sText
                 )


    If nRetVal < 0 ; IsError(45) ; RETURN nil ; EndIf
    //************** Add Series 1 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 50.0    // Your data goes into these 5 slots
    oData:nDouble[2] := 70.0
    oData:nDouble[3] := 40.0
    oData:nDouble[4] := 60.0
    oData:nDouble[5] := 30.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 5                   , ;  // nDataValuesCount
                 RMC_BARSINGLE       , ;  // nType
                 RMC_BAR_FLAT_GRADIENT2 , ;  // nStyle
                 True                , ;  // nIsLucent
                 ColorTransparent    , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )


    If nRetVal < 0 ; IsError(46) ; RETURN nil ; EndIf
    
//    uncomment the following lines to set individual colors for the bars:
/*
    oColor:nLong[1] := ColorChalk    // Your data goes into these 5 slots
    oColor:nLong[2] := ColorPink
    oColor:nLong[3] := ColorGold
    oColor:nLong[4] := ColorRed
    oColor:nLong[5] := ColorGray


    RMC_SetSingleBarColors( ID_RMC1, 1, oColor[1], 5 )
*/ 
    // Lets set some CustomToolTipTexts: (these don't work, don't know why)
    RMC_SetCustomToolTipText( ID_RMC1, 1, 1, 1, ;
                              "First Bar" + Chr(13) + Chr(10) + ;
                              "Value: 50" + Chr(13) + Chr(10) + ;
                              "Color: Blue" )
    RMC_SetCustomToolTipText( ID_RMC1, 1, 1, 2, ;
                              "Second Bar" + Chr(13) + Chr(10) + ;
                              "Value: 70" + Chr(13) + Chr(10) + ;
                              "Color: Green" )
    RMC_SetCustomToolTipText( ID_RMC1, 1, 1, 3, ;
                              "Third Bar" + Chr(13) + Chr(10) + ;
                              "Value: 40" + Chr(13) + Chr(10) + ;
                              "Color: Red" )
    RMC_SetCustomToolTipText( ID_RMC1, 1, 1, 4, ;
                              "Fourth Bar" + Chr(13) + Chr(10) + ;
                              "Value: 60" + Chr(13) + Chr(10) + ;
                              "Color: Yellow" )
    // Last bar gets no CustomText, so default ToolTipText (=Value) is used.
    
    // Switch ToolTips on
    RMC_AddToolTips( ID_RMC1, oWnd:hWnd, 100 )
*    RMC_SetToolTipWidth( ID_RMC1, 100 )    // Alternate way to switch on TT.
 
    nRetVal = RMC_Draw( ID_RMC1 )
    If nRetVal < 0 ; IsError(47) ; RETURN nil ; EndIf

RETURN nil
*sl----------------------------
STATIC FUNCTION mnSimpleLine()
LOCAL nFirst := 0, nLast := 0, nL := 0, nT := 0, nR := 0, nB := 0
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL oData IS DataStructD20  // ... As Double
    LOCAL aData2 := {}
    LOCAL aPPC := {}
 
*    DoSettings()

    ID_RMC1 := 100

    nlAllowChange = True    // nlIsMagnifier changes with mouse click
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorAliceBlue      , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )


    If nRetVal < 0 ; IsError(48) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -6                  , ;  // nHeight
                 ""                  , ; // sFooter
                 False                 ;  // nShowBorder
                 )

//               "Click with the left mousebutton into the grid!\C10", ; // sFooter

    If nRetVal < 0 ; IsError(49) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************
   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "Simple Line"       , ;  // sCaption
                 ColorAquamarine     , ;  // nBackColor
                 ColorBlack          , ;  // nTextColor
                 10                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(50) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorBeige          , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(51) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 100.0               , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                                     , ;  // sLabels
                                     ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(52) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels = ""

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 20                  , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(53) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 15.0    // Your data goes into these 20 slots
    oData:nDouble[2] := 25.0
    oData:nDouble[3] := 30.0
    oData:nDouble[4] := 22.0
    oData:nDouble[5] := 75.0
    oData:nDouble[6] := 45.0
    oData:nDouble[7] := 65.0    
    oData:nDouble[8] := 75.0
    oData:nDouble[9] := 40.0
    oData:nDouble[10] := 35.0
    oData:nDouble[11] := 20.0
    oData:nDouble[12] := 45.0
    oData:nDouble[13] := 80.0
    oData:nDouble[14] := 90.0    
    oData:nDouble[15] := 70.0
    oData:nDouble[16] := 65.0
    oData:nDouble[17] := 25.0
    oData:nDouble[18] := 10.0
    oData:nDouble[19] := 30.0
    oData:nDouble[20] := 25.0

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 20                  , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_LINE_AREA, ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorBlue           , ;  // nColor
                 RMC_SYMBOL_POINT    , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_DEFAULT  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(54) ; RETURN nil ; EndIf

   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )
    
    
    // Now add a trend line:
    nFirst := 0.0; nLast := 0.0; nL := 0; nT := 0; nR := 0; nB := 0

    // Calc the trend and get the needed X/Y positions (nL,nT,nR,nB) for the line
   nRetVal = RMC_CalcTrend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 1                   , ;  // nSeriesIndex
                 @nFirst             , ;  // nFirstValue - DOUBLE
                 @nLast              , ;  // nLastValue  - DOUBLE
                 @nL                 , ;  // nXstart
                 @nT                 , ;  // nYstart
                 @nR                 , ;  // nXend
                 @nB                 , ;  // nYend
                                       ;  // sHighLowIndex - byref
                 )
    
    // Add a CustomLine to show the trend:
   nRetVal = RMC_CODash( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nCOIndex
                 nL                  , ;  // nXstart
                 nT                  , ;  // nYstart
                 nR                  , ;  // nXend
                 nB                  , ;  // nYend
                 RMC_LINE_FLAT_DASH  , ;  // nStyle
                 IIf(nFirst > nLast, ColorRed, ColorGreen) , ;  // nColor
                 False               , ;  // nAsSpline
                 2                   , ;  // nLineWidth
                 RMC_ANCHOR_NONE     , ;  // nStartCap (a type of mark, i.e. a bullet)
                 RMC_ANCHOR_ARROW_CLOSED ;  // nEndCap (a type of mark, i.e. an arrow)
                 )
    
    // Draw the "legend" for the trend line:
   nRetVal = RMC_CODash( ;
                 ID_RMC1             , ;  // nCtrlID
                 2                   , ;  // nCOIndex
                 470                  , ;  // nXstart
                 11                  , ;  // nYstart
                 500                  , ;  // nXend
                 11                  , ;  // nYend
                 RMC_LINE_FLAT_DASH  , ;  // nStyle
                 IIf(nFirst > nLast, ColorRed, ColorGreen) , ;  // nColor
                 False               , ;  // nAsSpline
                 2                   , ;  // nLineWidth
                                     , ;  // nStartCap (a type of mark, i.e. a bullet)
                                       ;  // nEndCap (a type of mark, i.e. an arrow)
                 )

   nRetVal = RMC_COText( ;
                 ID_RMC1             , ;  // nCtrlID
                 3                   , ;  // nCOIndex
                 " Trend"            , ;  // sText
                 505                 , ;  // nLeft
                 5                   , ;  // nTop
                                     , ;  // nWidth (optional, as are the following...)
                                     , ;  // nHeight
                                     , ;  // nStyle
                                     , ;  // nBGColor
                                     , ;  // nLineColor
                                     , ;  // nTransparency
                                     , ;  // nLineAlignment
                                     , ;  // nTextColor
                                       ;  // sTextProperties
                 )
    
   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(55) ; RETURN nil ; EndIf
 
RETURN nil
*il--------------------------------------------------
STATIC FUNCTION mnIndexedLine()
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sCaption := ""
    LOCAL sLabels  := ""
    LOCAL sLegend  := ""
 
    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorPaleGreen      , ;  // nBackColor
                 RMC_CTRLSTYLEFLATSHADOW , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(56) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 "data on a weekly basis, source: www.yahoo.com" , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(57) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************

    sCaption = "Performance of DOW JONES, DAX and NASDAQ from January 2000 to end of June 2004"

   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sCaption            , ;  // sCaption
                 ColorPaleGreen      , ;  // nBackColor
                 ColorDarkBlue       , ;  // nTextColor
                 9                   , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(58) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorLightBlue      , ;  // nGridBackColor
                 True                , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(59) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 0.0                 , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorDarkBlue       , ;  // nTextColor
                 ColorSlateGray      , ;  // nLineColor
                 RMC_LINESTYLEDOT    , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 " %"                , ;  // sUnit
                 "2nd January 2000 = 100%" , ;  // sText
                                     , ;  // sLabels
                                     ;  // nLabelAlignment
                 )

    //************** Add label axis to region 1 *****************************

    sLabels = "2000*2001*2002*2003*2004"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 5                   , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorDarkBlue       , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorDarkSlateGray  , ;  // nLineColor
                 RMC_LINESTYLEDOT    , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(61) ; RETURN nil ; EndIf

    //************** Add legend to region 1 *******************************

    sLegend = "DOW JONES*DAX*NASDAQ"

   nRetVal = RMC_AddLegend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLegend             , ;  // sLegend
                 RMC_LEGEND_CUSTOM_UR, ;  // nLegendAlign
                 ColorPaleTurquoise  , ;  // nLegendBackColor
                 RMC_LEGENDRECT      , ;  // nLegendStyle
                 ColorDarkBlue       , ;  // nLegendTextColor
                 8                   , ;  // nLegendFoltSize
                 False                 ;  // nLegendIsBold
                 )

    If nRetVal < 0 ; IsError(62) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 0                   , ;  // nFirstDataValue
                 0                   , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE_INDEXED    , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorBlue           , ;  // nColor
                 RMC_SYMBOL_NONE     , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(64) ; RETURN nil ; EndIf

    //****** Read data values from file ******
    //****** Read points per selected column and load into the above line series ******

/*
Format of dow00-04.csv file (column headings are not in the file)...
DATE,     OPEN,    HIGH,    LOW,     CLOSE,   VOLUME,  CLOSE
28-Jun-04,10377.52,10505.16,10228.71,10282.83,13568200,10282.83
21-Jun-04,10417.82,10530.01,10284.24,10371.84,14316400,10371.84
14-Jun-04,10401.23,10471.84,10283.48,10416.41,12982000,10416.41

We will read data from the 7th column only, and using sLines code "-1", will
start from the bottom column record (the oldest) and work our way up to the 
first record (the most recent), and load that data into the nSeries graph line.
*/
                 // Here's were we read the data from file and load into graph...
   nRetVal = RMC_SetSeriesDataFile( ;
                 ID_RMC1         , ;  // nCtrlID
                 1               , ;  // nRegion
                 1               , ;  // nSeries - where the data will be placed automatically
                 "dow00-04.csv"  , ;  // sFilename
                 "-1"            , ;  // sLines - # of lines (rows) to be read ( -1 means start with last line and read all lines back to the top)
                 "7"             , ;  // sFields - no(s) of fields (cols) to be read
                 ","             , ;  // sFieldDelimiter
                                   ;  // nYdata - if 1, data goes to Y axis instead of default x axis
                 ) 

    //************** Add Series 2 to region 1 *******************************
   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 0                   , ;  // nFirstDataValue
                 0                   , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE_INDEXED    , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorCrimson        , ;  // nColor
                 RMC_SYMBOL_NONE     , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(66) ; RETURN nil ; EndIf

    //****** Read points per column from the next file and load above ******
   nRetVal = RMC_SetSeriesDataFile( ;
                 ID_RMC1         , ;  // nCtrlID
                 1               , ;  // nRegion
                 2               , ;  // nSeries - where the data will be placed automatically
                 "dax00-04.csv"  , ;  // sFilename
                 "-1"            , ;  // sLines - # of lines (rows) to be read ( -1 means start with last line and read all lines back to the top)
                 "7"             , ;  // sFields - no(s) of fields (cols) to be read
                 ","             , ;  // sFieldDelimiter
                                   ;  // nYdata - if 1, data goes to Y axis instead of default x axis
                 ) 

    //************** Add Series 3 to region 1 *******************************
   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 0                   , ;  // nFirstDataValue
                 0                   , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE_INDEXED    , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorBlack          , ;  // nColor
                 RMC_SYMBOL_NONE     , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(68) ; RETURN nil ; EndIf

    //****** Read points per column from the next file and load above ******
   nRetVal = RMC_SetSeriesDataFile( ;
                 ID_RMC1         , ;  // nCtrlID
                 1               , ;  // nRegion
                 3               , ;  // nSeries - where the data will be placed automatically
                 "nasdaq00-04.csv"  , ;  // sFilename
                 "-1"            , ;  // sLines - # of lines (rows) to be read ( -1 means start with last line and read all lines back to the top)
                 "7"             , ;  // sFields - no(s) of fields (cols) to be read
                 ","             , ;  // sFieldDelimiter
                                   ;  // nYdata - if 1, data goes to Y axis instead of default x axis
                 ) 
 
     // Add some CustomObjects
   nRetVal = RMC_COText( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nCOIndex
                 "09/11/2001"        , ;  // sText
                 287                 , ;  // nLeft
                 117                 , ;  // nTop
                 80                  , ;  // nWidth (optional, as are the following params...)
                 22                  , ;  // nHeight
                 RMC_BOX_NONE        , ;  // nStyle
                 ColorLightGreen     , ;  // nBGColor
                 0                   , ;  // nLineColor
                 150                 , ;  // nTransparency
                 0                   , ;  // nLineAlignment
                 0                   , ;  // nTextColor
                 "CB"                  ;  // sTextProperties
                 )

   nRetVal = RMC_CODash( ;
                 ID_RMC1             , ;  // nCtrlID
                 2                   , ;  // nCOIndex
                 327                 , ;  // nXstart
                 141                 , ;  // nYstart
                 250                 , ;  // nXend
                 225                 , ;  // nYend
                 RMC_LINE_FLAT       , ;  // nStyle
                 ColorLightGreen     , ;  // nColor
                 False               , ;  // nAsSpline
                 2                   , ;  // nLineWidth
                 0                   , ;  // nStartCap (a type of mark, i.e. a bullet)
                 RMC_ANCHOR_ARROW_OPEN ;  // nEndCap (a type of mark, i.e. an arrow)
                 )

   nRetVal = RMC_CODash( ;
                 ID_RMC1             , ;  // nCtrlID
                 3                   , ;  // nCOIndex
                 327                 , ;  // nXstart
                 141                 , ;  // nYstart
                 250                 , ;  // nXend
                 275                 , ;  // nYend
                 RMC_LINE_FLAT       , ;  // nStyle
                 ColorLightGreen     , ;  // nColor
                 False               , ;  // nAsSpline
                 2                   , ;  // nLineWidth
                 0                   , ;  // nStartCap (a type of mark, i.e. a bullet)
                 RMC_ANCHOR_ARROW_OPEN ;  // nEndCap (a type of mark, i.e. an arrow)
                 )

   nRetVal = RMC_CODash( ;
                 ID_RMC1             , ;  // nCtrlID
                 4                   , ;  // nCOIndex
                 327                 , ;  // nXstart
                 141                 , ;  // nYstart
                 250                 , ;  // nXend
                 347                 , ;  // nYend
                 RMC_LINE_FLAT       , ;  // nStyle
                 ColorLightGreen     , ;  // nColor
                 False               , ;  // nAsSpline
                 2                   , ;  // nLineWidth
                 0                   , ;  // nStartCap (a type of mark, i.e. a bullet)
                 RMC_ANCHOR_ARROW_OPEN ;  // nEndCap (a type of mark, i.e. an arrow)
                 )
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(69) ; RETURN nil ; EndIf

RETURN nil
*md----------------------------
STATIC FUNCTION mnMissingData()
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nDateCount := 0
    LOCAL nRetVal := 0
    LOCAL sLabels := ""
    LOCAL sTemp := ""
    LOCAL sCaption := ""
    LOCAL aXPos := {}
    LOCAL aYPos := {}
    LOCAL aData := {}
    LOCAL aDate := {}
    LOCAL aPPC := {}
    LOCAL oPPC IS DataStructL3
    LOCAL oData IS DataStructD300
    LOCAL sFileName := "" 
    LOCAL sLines    := "" 
    LOCAL sFields   := ""
    LOCAL sFieldDelimiter := "" 
     
    DoSettings()


 
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 597                 , ;  // nWidth
                 447                 , ;  // nHeight
                 ColorAliceBlue      , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(72) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 "\OC"               , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(73) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************

   sCaption := "DAX on a weekly base with two moving averages and different ToolTips"

   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sCaption            , ;  // sCaption
                 ColorDefault        , ;  // nBackColor
                 ColorDarkBlue       , ;  // nTextColor
                 9                   , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(74) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorWhiteSmoke     , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_NONE      ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(75) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************

    sTemp = "2000**2400**2800**3200**3600**4000**4400**4800**5200**5600**6000**6400**6800**7200**7600**8000"

   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 2000.0              , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 8000.0              , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 31                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                 sTemp               , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(76) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels = "2000*2001*2002*2003*2004*2005*2006"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 7                   , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(77) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************

    oPPC:nLong[1] := 52

    //****** Read data values ******
   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 0           , ;  // nFirstDataValue  // oData[1] 
                 0                 , ;  // nDataValuesCount  // 357
                 oPPC[1]             , ;  // nFirstPPCValue
                 1                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorNavy           , ;  // nColor
                 RMC_SYMBOL_NONE     , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(78) ; RETURN nil ; EndIf

    //************** Add Series 1 Data  *************************************

    nRetVal = RMC_SetSeriesDataFile( ;
                 ID_RMC1         , ;  // nCtrlID
                 1               , ;  // nRegion
                 1               , ;  // nSeries - where the data will be placed automatically
                 "dax00-04.csv"  , ;  // sFilename
                 "-1"            , ;  // sLines - # of lines (rows) to be read ( -1 means start with last line and read all lines back to the top)
                 "5"             , ;  // sFields - no(s) of fields (cols) to be read
                 ","             , ;  // sFieldDelimiter
                                   ;  // nYdata - if 1, data goes to Y axis instead of default x axis
                 ) 
    
    // Because we need them for calculating the moving averages, we must read
    // the stock market closing values into an array.
    // (Otherwise we simply could have used function RMC_SetSeriesDataFile() 
    // for this next step.)
   nDataCount = XHB_ReadDataFromFile( ;   // An app function replacing obsolete Rmc function.
                    @aData           , ;  // aData
                    "dax00-04.csv"   , ;  // sFileName
                    "-1,1"           , ;  // sLines
                    "5"              , ;  // sFields
                    ","              , ;  // sFieldDelimiter
                                     , ;  // lnReverse
                                       ;  // lnGetStringData
                    )
    // This xHb replacement function is in RMC4XHB.prg

    If nDataCount < 1 ; IsError(70) ; RETURN nil; Endif

    FOR i := 1 TO 300
      oData:nDouble[i] := 0.0
      SysRefresh()
    NEXT
    // Convert aData to oData...
    FOR i := 1 TO nDataCount
      oData:nDouble[i] := aData[i]
      SysRefresh()
    NEXT

    // And we need the date values from the file for building our Custom 
    // ToolTips (see below):
   nDateCount = XHB_ReadDataFromFile( ;  // replaces RMC_ReadStringFromFile()
                    @aDate           , ;  // aData
                    "dax00-04.csv"   , ;  // sFileName
                    "-1,1"           , ;  // sLines
                    "1"              , ;  // sFields
                    ","              , ;  // sFieldDelimiters
                                     , ;  // lnReverse
                    1                  ;  // lnGetStringData
                    )
    // This xHb replacement function is in RMC4XHB.prg

    If nDateCount < 1 ; IsError(71) ; RETURN nil; Endif


    // Build CustomToolTipTexts for the first series and add them
    For i = 1 To nDataCount // Number of closing values
        sTemp = "Date: " + aDate[i] + Chr(13) + Chr(10) + "Close: " + ;
                TRANSFORM( aData[i], "9999.99" ) 
        RMC_SetCustomToolTipText( ID_RMC1, 1, 1, i, sTemp )
        SysRefresh()
    Next
    
    //************** Add Series 2 and Series 3 to region 1 *******************************

   AddMovingAverage( aData, 20, ColorRed, nDataCount )   // Add a moving average, which comprises 20 data points ...

   AddMovingAverage( aData, 50, ColorGreen, nDataCount ) // ... and one which comprises 50 data points
    
    //************** Add CustomObjects *******************************
   nRetVal = RMC_CODash( ID_RMC1, 1, 74, 69, 193, 69, RMC_LINE_FLAT, ColorRed,;
                         0, 2, RMC_ANCHOR_ARROW_OPEN, RMC_ANCHOR_NONE )
   nRetVal = RMC_COText( ID_RMC1, 2, "Period = 20", 195, 61, 0, 0, ;
                         RMC_BOX_NONE, ColorDefault, ColorBlue, 255, ;
                         RMC_LINE_HORIZONTAL, ColorBlack, "08BC" )

   nRetVal = RMC_CODash( ID_RMC1, 3, 125, 94, 193, 94, RMC_LINE_FLAT, ;
                         ColorGreen, 0, 2, RMC_ANCHOR_ARROW_OPEN, ;
                         RMC_ANCHOR_NONE )
   nRetVal = RMC_COText( ID_RMC1, 4, "Period = 50", 195, 87, 0, 0, ;
                         RMC_BOX_NONE, ColorDefault, ColorBlue, 255, ;
                         RMC_LINE_HORIZONTAL, ColorBlack, "08BC" )

    sTemp = "Move the mouse pointer over the blue line to see the CustomToolTips."
    sTemp = sTemp + Chr(13) + Chr(10) + "Both average lines have standard ToolTips."
   nRetVal = RMC_COText( ID_RMC1, 5, sTemp, 300, 50, 250, 65, ;
                         RMC_BOX_GRADIENTH_SHADOW, ColorPowderBlue, ColorPowderBlue, 255, ;
                         RMC_LINE_HORIZONTAL, ColorBlack, "09C" )

    // Activate the ToolTips:
   nRetVal = RMC_AddToolTips( ID_RMC1, oWnd:hWnd, 100 )
        
    // Draw the chart
   nRetVal = RMC_Draw( ID_RMC1 )
    If nRetVal < 0 ; IsError(79) ; RETURN nil ; EndIf

 
RETURN nil
*ama----------------------------
  // Called by mnMissingData()...
STATIC FUNCTION AddMovingAverage( aData, nPeriod, nColor, nDataCount )

    LOCAL i := 0, X := 0
    LOCAL nCount, nRetVal, y := 0, z := 0
    LOCAL aData1 := {}
    LOCAL oLineSeries //As tRMC_LINESERIES
    LOCAL aPPC := {},nCnt := 0
    LOCAL oData1 IS DataStructD300    
    LOCAL oPPC IS DataStructL3

    nCount = LEN(aData)
    aData1 := ARRAY(nCount)
    AFILL(aData1,0.0)

    For i = 1 To nCount
        If i < nPeriod    // At beginning, no data yet for building the average
            aData1[i] = 0.000001 //RMC_NO_DATA - the "NoData" Symbol only works in VB
        Else  // where i = nPeriod or more... (we're past the beginning period)
            y := (i - nPeriod+1)  // beginning of time slice
            z := i   //- 1        // end of time slice
            For X := y To z       // X is for each day within the time slice
                aData1[i] := aData1[i] + aData[X]
                SysRefresh()
            Next

            // If nPeriod is 20 days, then aData1[i] has an accumulation of
            // 20 days worth of closing market prices up to and including the
            // date represented by i. We divide this total by nPeriod to get
            // the multi-days moving-average price for that day...

            aData1[i] := aData1[i] / nPeriod
        EndIf
        SysRefresh()
    Next

    FOR i := 1 TO 300
      oData1:nDouble[i] := 0.0
      SysRefresh()
    NEXT
    // Convert aData1 to oData1...
    FOR i := 1 TO nDataCount
      oData1:nDouble[i] := aData1[i]
      SysRefresh()
    NEXT

    oPPC:nLong[1] := 52

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData1[1]           , ;  // nFirstDataValue
                 nDataCount          , ;  // nDataValuesCount
                 oPPC[1]             , ;  // nFirstPPCValue
                 1                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_SPLINE   , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 nColor              , ;  // nColor
                                     , ;  // nSymbol
                                     , ;  // nWhichDataAxis
                                     , ;  // nValueLabelOn
                                       ;  // nHatchMode
                 )

RETURN nil
*bl----------------------------
STATIC FUNCTION mnBarsLines()

    LOCAL nRetVal := 0
    LOCAL sCaption := ""
    LOCAL sLabels := ""
    LOCAL oData IS DataStructD10
 
    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 670                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorCornflowerBlue , ;  // nBackColor
                 RMC_CTRLSTYLEFLATSHADOW , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(80) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 10                  , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 "data source: F.A.Z" , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(81) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************

   sCaption := "The world's 10 biggest industrial companies 2003"

   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sCaption            , ;  // sCaption
                 ColorCoral          , ;  // nBackColor
                 ColorFloralWhite    , ;  // nTextColor
                 12                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(82) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorAzure          , ;  // nGridBackColor
                 True                , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(83) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 100000.0            , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 250000.0            , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 9                   , ;  // nFontsize
                 ColorCornsilk       , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 "$ "                , ;  // sUnit
                 "Total turnover in Mill. Dollar" , ;  // sText
                                     , ;  // sLabels
                                     ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(84) ; RETURN nil ; EndIf

    //************** Add second data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISRIGHT   , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 0.0                 , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 0                  , ;  // nTickCount
                 0                   , ;  // nFontsize
                 0       , ;  // nTextColor
                 0          , ;  // nLineColor
                 0  , ;  // nLinestyle
                 2                   , ;  // nDecimalDigits
                 " %"                , ;  // sUnit
                 "Net operating margin" , ;  // sText
                                     , ;  // sLabels
                                     ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(85) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************

    sLabels := "Exxon Mobil*Royal Dutch / Shell*BP*General Motors*Daimler Chrysler*" + ;
             "Ford Motor*Toyota Motor*General Electric*TOTAL*Chevron Texaco"

   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLabels             , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 10                  , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorCornsilk       , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(86) ; RETURN nil ; EndIf
    //************** Add Series 1 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 242365.0    // Your data goes into these 10 slots
    oData:nDouble[2] := 235598.0
    oData:nDouble[3] := 232571.0
    oData:nDouble[4] := 185524.0
    oData:nDouble[5] := 170457.0
    oData:nDouble[6] := 164196.0
    oData:nDouble[7] := 149321.0    
    oData:nDouble[8] := 132797.0
    oData:nDouble[9] := 130067.0
    oData:nDouble[10] := 119703.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 10                  , ;  // nDataValuesCount
                 RMC_BARSINGLE       , ;  // nType
                 RMC_BAR_FLAT_GRADIENT2 , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorGold           , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(87) ; RETURN nil ; EndIf

    //************** Add Series 2 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 8.9    // Your data goes into these 10 slots
    oData:nDouble[2] := 4.1
    oData:nDouble[3] := 4.4
    oData:nDouble[4] := 2.1
    oData:nDouble[5] := 0.3
    oData:nDouble[6] := 0.3
    oData:nDouble[7] := 5.9
    oData:nDouble[8] := 11.3
    oData:nDouble[9] := 6.7
    oData:nDouble[10] := 6.0

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 10                  , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                 RMC_LINE_CABLE      , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorGreen          , ;  // nColor
                 RMC_SYMBOL_BULLET   , ;  // nSymbol
                 2                   , ;  // nWhichDataAxis
                 RMC_VLABEL_DEFAULT  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(88) ; RETURN nil ; EndIf
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(89) ; RETURN nil ; EndIf
 
RETURN nil
*do----------------------------
STATIC FUNCTION mnDonut()
    LOCAL nRetVal := 0
    LOCAL sLegend := ""
    LOCAL sTemp := ""
    LOCAL aData := {}
    LOCAL oColor IS ColorStructL5
    LOCAL oData IS DataStructD4

    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorTransparent    , ;  // nBackColor
                 RMC_CTRLSTYLEIMAGETILED , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 "paper.jpg"                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(90) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(91) ; RETURN nil ; EndIf

    //************** Add legend to region 1 *******************************

    sLegend = "Apples*Citrons*Bananas*Cherries"

   nRetVal = RMC_AddLegend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLegend             , ;  // sLegend
                 RMC_LEGEND_ONVLABELS, ;  // nLegendAlign
                 ColorGainsboro      , ;  // nLegendBackColor
                 RMC_LEGENDNORECT    , ;  // nLegendStyle
                 ColorBlue           , ;  // nLegendTextColor
                 8                   , ;  // nLegendFoltSize
                 False                 ;  // nLegendIsBold
                 )

    If nRetVal < 0 ; IsError(92) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read color values ******

    oColor:nLong[1] := ColorLightGreen    // Your data goes into these 5 slots
    oColor:nLong[2] := ColorYellow
    oColor:nLong[3] := ColorGoldenrod
    oColor:nLong[4] := ColorCrimson
    oColor:nLong[5] := ColorDefault

    //****** Read data values ******

    oData:nDouble[1] := 40.0    // Your data goes into these 4 slots
    oData:nDouble[2] := 30.0
    oData:nDouble[3] := 60.0
    oData:nDouble[4] := 20.0

   nRetVal = RMC_AddGridlessSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 4                   , ;  // nDataValuesCount
                 oColor[1]           , ;  // nFirstColorValue
                 4                   , ;  // ncolorValuesCount
                 RMC_DONUT_GRADIENT  , ;  // nStyle
                 RMC_FULL            , ;  // nAlignment
                 0                   , ;  // nExplodemode
                 False               , ;  // nIsLucent
                 RMC_VLABEL_TWIN     , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF  , ;  // nHatchMode
                 0                     ;  // nStartAngle
                 )

    If nRetVal < 0 ; IsError(93) ; RETURN nil ; EndIf

    sTemp := "With CustomObjects you can place text wherever you want!"    

*   RMC_COText( ID_RMC1, 1, "With CustomObjects you can place text wherever you want!",;
*               230, 175, 140, 100, RMC_BOX_NONE, 0, 0, 0, 0, ColorRed, "12C" )
   nRetVal = RMC_COText( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nCOIndex
                 sTemp               , ;  // sText
                 230                 , ;  // nLeft
                 175                 , ;  // nTop
                 140                 , ;  // nWidth (optional, as are the following...)
                 100                 , ;  // nHeight
                 RMC_BOX_NONE        , ;  // nStyle
                 0                   , ;  // nBGColor
                 0                   , ;  // nLineColor
                 0                   , ;  // nTransparency
                 0                   , ;  // nLineAlignment
                 ColorRed            , ;  // nTextColor
                 "12C"                 ;  // sTextProperties
                 )
     
   nRetVal = RMC_Draw( ID_RMC1 )
    If nRetVal < 0 ; IsError(94) ; RETURN nil ; EndIf
    
RETURN nil
*py----------------------------
STATIC FUNCTION mnPyramid()
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL sLegend := ""
    LOCAL aData := {}
    LOCAL oData IS DataStructD4
 
    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 10                  , ;  // nTop
                 10                  , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorTransparent    , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 ColorDefault          ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(95) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(96) ; RETURN nil ; EndIf

    //************** Add legend to region 1 *******************************

    sLegend = "Apples*Bananas*Pears*Cherries"

   nRetVal = RMC_AddLegend( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sLegend             , ;  // sLegend
                 RMC_LEGEND_ONVLABELS, ;  // nLegendAlign
                 ColorDefault        , ;  // nLegendBackColor
                 RMC_LEGENDRECTSHADOW, ;  // nLegendStyle
                 ColorDefault        , ;  // nLegendTextColor
                 8                   , ;  // nLegendFoltSize
                 False                 ;  // nLegendIsBold
                 )

    If nRetVal < 0 ; IsError(97) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 30.25    // Your data goes into these 4 slots
    oData:nDouble[2] := 26.75
    oData:nDouble[3] := 15.89
    oData:nDouble[4] := 46.23

   nRetVal = RMC_AddGridlessSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 4                   , ;  // nDataValuesCount
                 0                   , ;  // nFirstColorValue
                 0                   , ;  // ncolorValuesCount
                 RMC_PYRAMIDE3       , ;  // nStyle
                 RMC_FULL            , ;  // nAlignment
                 0                   , ;  // nExplodemode
                 False               , ;  // nIsLucent
                 RMC_VLABEL_DEFAULT  , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF  , ;  // nHatchMode
                 0                     ;  // nStartAngle
                 )

    If nRetVal < 0 ; IsError(98) ; RETURN nil ; EndIf
 
   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(99) ; RETURN nil ; EndIf

RETURN nil
*pi----------------------------
   // A semicircular pie chart (half pie) with custom text, tooltips and watermark...
STATIC FUNCTION mnPie()
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL oData IS DataStructD5
    LOCAL oColor IS ColorStructL5
 
    DoSettings()
 
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 10                  , ;  // nTop
                 10                  , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorTransparent    , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 ColorDefault          ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(100) ; RETURN nil ; EndIf
    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(101) ; RETURN nil ; EndIf
    //************** Add Series 1 to region 1 *******************************
    //****** Read color values ******

    oColor:nLong[1] := ColorMaroon    // Your data goes into these 5 slots
    oColor:nLong[2] := ColorMediumBlue
    oColor:nLong[3] := ColorCrimson
    oColor:nLong[4] := ColorDefault
    oColor:nLong[5] := ColorDefault

    // Colors to use if doing RMC_FULL
*    oColor:nLong[1] := ColorMagenta
*    oColor:nLong[4] := ColorGold
*    oColor:nLong[5] := ColorDarkCyan

    //****** Read data values ******

    oData:nDouble[1] := 80.0 //45   // Your data goes into these 5 slots
    oData:nDouble[2] := 50.0
    oData:nDouble[3] := 60.0
    oData:nDouble[4] := 30.0
    oData:nDouble[5] := 0.0 // 40.0

   nRetVal = RMC_AddGridlessSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 4                   , ;  // nDataValuesCount  //5 - if full circle
                 oColor[1]           , ;  // nFirstColorValue
                 4                   , ;  // ncolorValuesCount // 5
                 RMC_PIE_3D_GRADIENT , ;  // nStyle
                 RMC_HALF_TOP        , ;  // nAlignment
                 0                   , ;  // nExplodemode  //2 - segment to explode
                 False               , ;  // nIsLucent
                 RMC_VLABEL_NONE     , ;  // nValueLabelOn  // _TWIN
                 RMC_HATCHBRUSH_OFF  , ;  // nHatchMode
                 0                     ;  // nStartAngle
                 )

*                 RMC_HALF_TOP        , ;  // nAlignment  - half circle above
*                 RMC_FULL            , ;  // nAlignment  - full circle


    If nRetVal < 0 ; IsError(102) ; RETURN nil ; EndIf
    //************** Add CustomObjects *******************************

    sTemp = "This is a 3D pie with semicircle alignment, tooltips, a custom text" + Chr(10) + Chr(13) + "and a discreet watermark."
*    sTemp = "This is a 3D pie with tooltips and custom text."

   nRetVal = RMC_COText( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nCOIndex
                 sTemp               , ;  // sText
                 100                 , ;  // nLeft
                 270                 , ;  // nTop  // 400 - if full circle
                 400                 , ;  // nWidth (optional, as are the following...)
                 50                  , ;  // nHeight
                 RMC_BOX_3D_SHADOW   , ;  // nStyle
                 ColorMoccasin       , ;  // nBGColor
                 ColorDefault        , ;  // nLineColor
                 0                   , ;  // nTransparency
                 RMC_LINE_HORIZONTAL , ;  // nLineAlignment
                 ColorMaroon         , ;  // nTextColor
                 "09C"                 ;  // sTextProperties
                 )

    If nRetVal < 0 ; IsError(103) ; RETURN nil ; EndIf

   nRetVal = RMC_SetWatermark( ;
                 "RMChart"           , ;  // sWatermark
                 ColorAutumnOrange   , ;  // nColor
                 25                  , ;  // nLucentValue
                 1                   , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )
    
    // Switch ToolTips on
   nRetVal = RMC_AddToolTips( ID_RMC1, oWnd:hWnd, 100 )
    
   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(104) ; RETURN nil ; EndIf

RETURN nil
*xys----------------------------
STATIC FUNCTION mnXYSimple()
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL aData := {}
    LOCAL aData2 := {}
    LOCAL oData IS DataStructD10
    LOCAL oData2 IS DataStructD10b

    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorSteelBlue      , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(105) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(106) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************
   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "Simple XY chart"   , ;  // sCaption
                 ColorAliceBlue      , ;  // nBackColor
                 ColorBlack          , ;  // nTextColor
                 10                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(107) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorDarkBlue       , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(108) ; RETURN nil ; EndIf

    //************** Add first X axis to region 1 *****************************
    sTemp := "X Axis"

   nRetVal = RMC_AddXAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_XAXISBOTTOM     , ;  // nAlignment
                 0.0                 , ;  // nMinvalue
                 100.0               , ;  // nMaxvalue
                 11                  , ;  // nTickcount
                 8                   , ;  // nFontsize
                 ColorBlanchedAlmond , ;  // nTextcolor
                 ColorWhite          , ;  // nLinecolor
                 RMC_LINESTYLENONE   , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 @sTemp              , ;  // sText
                                     , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(109) ; RETURN nil ; EndIf

    //************** Add first Y axis to region 1 *****************************
   nRetVal = RMC_AddYAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_YAXISLEFT       , ;  // nAlignment
                 0.0                 , ;  // nMinvalue
                 100.0               , ;  // nMaxvalue
                 11                  , ;  // nTickcount
                 8                   , ;  // nFontsize
                 ColorBlanchedAlmond , ;  // nTextcolor
                 ColorBlack          , ;  // nLinecolor
                 RMC_LINESTYLENONE   , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "Y Axis"            , ;  // sText
                                     , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(110) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read X-data values ******

    oData:nDouble[1] := 10.0    // Your data goes into these 10 slots
    oData:nDouble[2] := 20.0
    oData:nDouble[3] := 30.0
    oData:nDouble[4] := 40.0
    oData:nDouble[5] := 50.0
    oData:nDouble[6] := 60.0
    oData:nDouble[7] := 70.0
    oData:nDouble[8] := 80.0
    oData:nDouble[9] := 90.0
    oData:nDouble[10] := 10.0

    //****** Read Y-data values ******

    oData2:nDouble[1] := 10.0    // Your data goes into these 10 slots
    oData2:nDouble[2] := 30.0
    oData2:nDouble[3] := 50.0
    oData2:nDouble[4] := 70.0
    oData2:nDouble[5] := 90.0
    oData2:nDouble[6] := 70.0
    oData2:nDouble[7] := 50.0
    oData2:nDouble[8] := 30.0
    oData2:nDouble[9] := 10.0
    oData2:nDouble[10] := 10.0

   nRetVal = RMC_AddXYSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstXDataValue
                 10                  , ;  // nDataXValuesCount
                 oData2[1]           , ;  // nFirstYDataValue
                 10                  , ;  // nDataYValuesCount
                 ColorWhiteSmoke     , ;  // nColor
                 RMC_XY_LINE_DASH    , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 RMC_SYMBOL_STAR     , ;  // nSymbol
                 RMC_XAXISBOTTOM     , ;  // nWhichXAxis
                 RMC_YAXISLEFT       , ;  // nWhichYAxis
                 RMC_VLABEL_NONE       ;  // nValueLabelOn
                 )

    If nRetVal < 0 ; IsError(111) ; RETURN nil ; EndIf
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

    nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(112) ; RETURN nil ; EndIf

RETURN nil
*xy2----------------------------
STATIC FUNCTION mnXY2series()
    LOCAL nRetVal  := 0
    LOCAL sCaption := ""
    LOCAL sTemp    := ""
    LOCAL aData    := {}
    LOCAL aData2   := {}
    LOCAL aPPC     := {}
    LOCAL oData  IS DataStructD5
    LOCAL oData2 IS DataStructD5b

    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 600                 , ;  // nWidth
                 450                 , ;  // nHeight
                 ColorAliceBlue      , ;  // nBackColor
                 RMC_CTRLSTYLEFLATSHADOW , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(113) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(114) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************

    sCaption = "Two XY series aligned to 2 different XY-axes pairs"

   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sCaption            , ;  // sCaption
                 ColorBlue           , ;  // nBackColor
                 ColorAntiqueWhite   , ;  // nTextColor
                 10                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(115) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorBeige          , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                                       ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(116) ; RETURN nil ; EndIf

    //************** Add first X axis to region 1 *****************************
   nRetVal = RMC_AddXAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_XAXISBOTTOM     , ;  // nAlignment
                 0.0                 , ;  // nMinvalue
                 100.0               , ;  // nMaxvalue
                 11                  , ;  // nTickcount
                 8                   , ;  // nFontsize
                 ColorBlue           , ;  // nTextcolor
                 ColorBlue           , ;  // nLinecolor
                 RMC_LINESTYLEDOT    , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "First X axis"      , ;  // sText
                 ""                  , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(117) ; RETURN nil ; EndIf

    //************** Add first Y axis to region 1 *****************************
   nRetVal = RMC_AddYAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_YAXISLEFT       , ;  // nAlignment
                 0.0                 , ;  // nMinvalue
                 100.0               , ;  // nMaxvalue
                 11                  , ;  // nTickcount
                 8                   , ;  // nFontsize
                 ColorBlue           , ;  // nTextcolor
                 ColorBlue           , ;  // nLinecolor
                 RMC_LINESTYLEDOT    , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "First Y Axis"      , ;  // sText
                 ""                  , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(118) ; RETURN nil ; EndIf

    //************** Add second X axis to region 1 *****************************
   nRetVal = RMC_AddXAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_XAXISTOP        , ;  // nAlignment
                 0.0                 , ;  // nMinvalue
                 10.0                , ;  // nMaxvalue
                 5                   , ;  // nTickcount
                 8                   , ;  // nFontsize
                 ColorCoral          , ;  // nTextcolor
                 ColorCoral          , ;  // nLinecolor
                 RMC_LINESTYLEDASH   , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "Second X axis"     , ;  // sText
                 ""                  , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(119) ; RETURN nil ; EndIf

    //************** Add second Y axis to region 1 *****************************
   nRetVal = RMC_AddYAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_YAXISRIGHT      , ;  // nAlignment
                 0.0                 , ;  // nMinvalue
                 10.0                , ;  // nMaxvalue
                 5                   , ;  // nTickcount
                 8                   , ;  // nFontsize
                 ColorCoral          , ;  // nTextcolor
                 ColorCoral          , ;  // nLinecolor
                 RMC_LINESTYLEDASH   , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "Second Y Axis"     , ;  // sText
                 ""                  , ;  // sLabels
                                       ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(120) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read X-data values ******

    oData:nDouble[1] := 20.0    // Your data goes into these 5 slots
    oData:nDouble[2] := 30.0
    oData:nDouble[3] := 60.0
    oData:nDouble[4] := 70.0
    oData:nDouble[5] := 90.0

    //****** Read Y-data values ******

    oData2:nDouble[1] := 40.0    // Your data goes into these 5 slots
    oData2:nDouble[2] := 20.0
    oData2:nDouble[3] := 70.0
    oData2:nDouble[4] := 10.0
    oData2:nDouble[5] := 60.0

   nRetVal = RMC_AddXYSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstXDataValue
                 5                   , ;  // nDataXValuesCount
                 oData2[1]           , ;  // nFirstYDataValue
                 5                   , ;  // nDataYValuesCount
                 ColorDarkBlue       , ;  // nColor
                 RMC_XY_SYMBOL       , ;  // nStyle
                 0                   , ;  // nLineStyle
                 RMC_SYMBOL_BULLET   , ;  // nSymbol
                 RMC_XAXISBOTTOM     , ;  // nWhichXAxis
                 RMC_YAXISLEFT       , ;  // nWhichYAxis
                 RMC_VLABEL_NONE       ;  // nValueLabelOn
                 )

    If nRetVal < 0 ; IsError(121) ; RETURN nil ; EndIf

    //************** Add Series 2 to region 1 *******************************
    //****** Read X-data values ******

    oData:nDouble[1] := 2.5    // Your data goes into these 5 slots
    oData:nDouble[2] := 4.5
    oData:nDouble[3] := 5.5
    oData:nDouble[4] := 7.5
    oData:nDouble[5] := 1.0

    //****** Read Y-data values ******

    oData2:nDouble[1] := 7.5    // Your data goes into these 5 slots
    oData2:nDouble[2] := 5.5
    oData2:nDouble[3] := 5.5
    oData2:nDouble[4] := 2.5
    oData2:nDouble[5] := 5.0

   nRetVal = RMC_AddXYSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstXDataValue
                 5                   , ;  // nDataXValuesCount
                 oData2[1]           , ;  // nFirstYDataValue
                 5                   , ;  // nDataYValuesCount
                 ColorCoral          , ;  // nColor
                 RMC_XY_SYMBOL       , ;  // nStyle
                 0                   , ;  // nLineStyle
                 RMC_SYMBOL_DIAMOND  , ;  // nSymbol
                 RMC_XAXISTOP        , ;  // nWhichXAxis
                 RMC_YAXISRIGHT      , ;  // nWhichYAxis
                 RMC_VLABEL_DEFAULT    ;  // nValueLabelOn
                 )

    If nRetVal < 0 ; IsError(122) ; RETURN nil ; EndIf
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(123) ; RETURN nil ; EndIf

RETURN nil
*----------------------------
STATIC FUNCTION VScroll1_Change()
    LOCAL nIndex := 0
    
*    With VScroll1
*        nIndex = .Value
        nIndex = oVScroll1:Value
*    End With
    RMC_SetSeriesDataRange( ID_RMC1, 1, 1, nIndex, nIndex + 20 )
    RMC_SetSeriesDataRange( ID_RMC1, 1, 2, nIndex, nIndex + 20 )

    RMC_Draw( ID_RMC1 )

RETURN nil
*----------------------------
STATIC FUNCTION VScroll1_Scroll()
    LOCAL nIndex := 0
   
*    With VScroll1
*        nIndex = .Value
        nIndex = oVScroll1:Value
*    End With
    RMC_SetSeriesDataRange( ID_RMC1, 1, 1, nIndex, nIndex + 20 )
    RMC_SetSeriesDataRange( ID_RMC1, 1, 2, nIndex, nIndex + 20 )

    RMC_Draw( ID_RMC1 )

RETURN nil
*----------------------------
STATIC FUNCTION mnScroll()
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL aData := {}
    LOCAL aData2 := {}
    LOCAL aPPC := {}
    LOCAL oData IS DataStructD1000 // Note: original VB6 had 5000 data points,
                               // whereas this version has 1000 to save memory.
                               // (Unknown if that might be an issue with a
                               // C structure, so took conservative approach.)
 
    // Shows the use of RMC_SetSeriesDataRange() in conjunction with a scroll bar.
    // Setting of the data range for both series happens in above scroll events VScroll1_Change()
    // and VScroll1_Scroll()
 
    DoSettings()
 
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 650                 , ;  // nWidth
                 500                 , ;  // nHeight
                 ColorDarkTurquoise  , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(124) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(125) ; RETURN nil ; EndIf

    //************** Add caption to region 1 *******************
   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "Random Data"       , ;  // sCaption
                 ColorDefault        , ;  // nBackColor
                 ColorBlack          , ;  // nTextColor
                 13                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    If nRetVal < 0 ; IsError(126) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorLightSkyBlue   , ;  // nGridBackColor
                 True                , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_NONE      ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(127) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISBOTTOM  , ;  // nAlignment
                 7000.0              , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 12000.0             , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "Data axis for the line series\11" , ;  // sText
                 ""                  , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(128) ; RETURN nil ; EndIf

    //************** Add second data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISBOTTOM  , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 30000.0             , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 0                   , ;  // nTickCount
                 0                   , ;  // nFontsize
                 0                   , ;  // nTextColor
                 0                   , ;  // nLineColor
                 0                   , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 "Data axis for the bar series\11" , ;  // sText
                 ""                  , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(129) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************
   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ""                  , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 21                  , ;  // ntickCount
                 RMC_LABELAXISLEFT   , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(130) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    aData := ARRAY(1000)  // Originally 5000

    // Get 1000 random data values...
    For i = 1 To 1000     // Originally 5000
*        aData[i] = RMC_RND( 10000, 28000 )    // Get 1000 random data values
                   // Using xHarbour's random number generator...
        aData[i] = HB_RandomInt( 10000, 28000 ) + .001  
        // MUST add .001 here or will GPF because data must be DOUBLE datatype
        // (with a decimal).

        SysRefresh()
    Next

    aData[1] = 3000.001                       // Mark first ...
    aData[1000] = 3000.001                 // and last data point

    FOR i := 1 TO 1000
      oData:nDouble[i] := 0.0
      SysRefresh()
    NEXT
    // Convert aData to oData...
    FOR i := 1 TO LEN(aData)
      oData:nDouble[i] := aData[i]
      SysRefresh()
    NEXT

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 1000                , ;  // nDataValuesCount
                 RMC_BARSINGLE       , ;  // nType
                 RMC_BAR_HOVER       , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorLightGoldenrod , ;  // nColor
                 True                , ;  // nIsHorizontal
                 2                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(131) ; RETURN nil ; EndIf
    
   RMC_SetSeriesDataRange( ID_RMC1, 1, 1, 1, 21 ) // Set initial data range

    //************** Add Series 2 to region 1 *******************************

    For i = 1 To 1000
        aData[i] = HB_RandomInt(8000, 11000) + .001  // Get 1000 random data values
        SysRefresh()                  // see note above about purpose of .001
    Next

    aData[1] = 11500.001                      // Mark first ...
    aData[1000] = 11500.001                // and last data point

    FOR i := 1 TO 1000
      oData:nDouble[i] := 0.0
      SysRefresh()
    NEXT
    // Convert aData to oData...
    FOR i := 1 TO LEN(aData)
      oData:nDouble[i] := aData[i]
      SysRefresh()
    NEXT

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 1000                , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                                     , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorRed            , ;  // nColor
                 RMC_SYMBOL_POINT_SMALL , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE     , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(132) ; RETURN nil ; EndIf

   RMC_SetSeriesDataRange( ID_RMC1, 1, 2, 1, 21 )  // Set initial data range
    
    nRetVal = RMC_Draw( ID_RMC1 )

/*    How should this be handled in FWH ???  (from original VB6 code... )
    With VScroll1
        .Top = 100
        .Left = 9860
        .Height = 7500
        .Min = 1
        .Max = 4980
        .LargeChange = 21
        .Visible = True
    End With
*/        

    If nRetVal < 0 ; IsError(133) ; RETURN nil ; EndIf

RETURN nil
*--------------------------------------------------------
  // See animated life expectancy chart for software programmers!!!...
STATIC FUNCTION mnTimer()
    LOCAL i := 0
    LOCAL nC := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL aData := {}
    LOCAL oData IS DataStructD20  // ... As Double
    
    DoSettings()
    
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nTop
                 0                   , ;  // nLeft
                 597                 , ;  // nWidth
                 447                 , ;  // nHeight
                 ColorBlack          , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )


    If nRetVal < 0 ; IsError(134) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 2                   , ;  // nLeft
                 2                   , ;  // nTop
                 -2                  , ;  // nWidth
                 -2                  , ;  // nHeight
                 "\OC"                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(135) ; RETURN nil ; EndIf

    //************** Add Caption ******************************

   nRetVal = RMC_AddCaption( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 "Software Developers' Life Expectancy" , ;  // sCaption
                 ColorBlue           , ;  // nBackColor
                 ColorAntiqueWhite   , ;  // nTextColor
                 10                  , ;  // nFontSize
                 True                  ;  // nIsBold
                 )

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorBlack          , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_NONE      ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(136) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 150.0               , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 8                   , ;  // nTickCount
                 7                   , ;  // nFontsize
                 ColorLimeGreen      , ;  // nTextColor
                 ColorDarkGreen      , ;  // nLineColor
                 RMC_LINESTYLEDOT    , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                 ""                  , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(137) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************
    sTemp = ""
   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sTemp               , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 20                  , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorDarkGreen      , ;  // nLineColor
                 RMC_LINESTYLESOLID  , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(138) ; RETURN nil ; EndIf
    
    // Get 20 random values between 100 and 600 for the initial line
    aData := ARRAY(20)

    For i = 1 To 20
**      aData(i) = RMC_RND( 100, 600 )     // Original version
        aData[i] = HB_RandomInt( 20, 120 )
        aData[i] := aData[i] + .01   // Force it to a DOUBLE to prevent
        SysRefresh()                 // crash in RMC_AddLineSeries()
    Next

    FOR i := 1 TO 20
      oData:nDouble[i] := 0.0
      SysRefresh()
    NEXT
    // Convert aData to oData...
    FOR i := 1 TO 20
      oData:nDouble[i] := aData[i]
      SysRefresh()
    NEXT

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 20                  , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                 RMC_LINE_FLAT       , ;  // nStyle
                 RMC_LSTYLE_LINE     , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorLimeGreen      , ;  // nColor
                 RMC_SYMBOL_NONE     , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE     , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(139) ; RETURN nil ; EndIf
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(140) ; RETURN nil ; EndIf
    
   StartTimer()
    
RETURN nil
*----------------------------
STATIC FUNCTION StartTimer()
    LOCAL i     := 0
    LOCAL nData := 0
    LOCAL nCnt  := 0
    
    IF EMPTY(oTimer1)
       DEFINE TIMER oTimer1   ;
         INTERVAL 500         ;   // 1 second = 500
         ACTION( TimedWork() );
       OF oWnd

       ACTIVATE TIMER oTimer1
    ENDIF

    If oTimer1:nInterval = 0 
       RETURN nil
    Endif

RETURN nil
*----------------------------
STATIC FUNCTION TimedWork()
LOCAL nData := 0.0
STATIC nCnt := 0

    For i = 2 To 20

        // Get data...
        RMC_GetData( ID_RMC1, 1, 1, i, @nData )

        // shift it one position to the left...
        RMC_SetSeriesSingleData( ID_RMC1, 1, 1, nData, i - 1 )

        SysRefresh()
    Next

    // and set a new random value on position 20
    RMC_SetSeriesSingleData( ID_RMC1, 1, 1, HB_RandomInt(20, 120)+.01, 20 )
        // MUST add .01 here or will GPF because data must be DOUBLE datatype
        // (with a decimal).

    // redraw the chart
    RMC_Draw( ID_RMC1 )

    nCnt++

    SysRefresh()

    IF nCnt = 10
       oTimer1:Deactivate()
       RELEASE TIMER oTimer1
       nCnt := 0            // Don't forget this, or else timer will only
    ENDIF                   // turn off once! (because nCnt is static here)

RETURN nil
*----------------------------
STATIC FUNCTION mnFile()
   LOCAL nRetVal := 0
    
   DoSettings()
    
   nRetVal = RMC_CreateChartFromFile( ;
                 oWnd:hWnd           , ;  // nParentHandl
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nX
                 0                   , ;  // nY
                 0                   , ;  // nExportOnly
                 "4_regions.rmc"       ;  // sRMCFile
                 )

    If nRetVal < 0 ; IsError(141) ; RETURN nil ; EndIf
    
   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(142) ; RETURN nil ; EndIf

RETURN nil
*----------------------------
STATIC FUNCTION mnDatastring()
    LOCAL sTemp := ""
    LOCAL nRetVal := 0
    
    DoSettings()
    
    sTemp = sTemp + "00003650|00004450|000051|000061|000071|00008-6697831|00009400|00011Tahoma|100011"
    sTemp = sTemp + "|1000310|1000410|10005-5|10006-5|1000910|100101|100111|100121|100131|100181|1002"
    sTemp = sTemp + "00|100217|1002215|100238|100272|100331|100341|100358|100378|100411|100482|100492"
    sTemp = sTemp + "|10051-6751336|10052-15132304|10053-983041|100541|100558|10056-16777077|10057-16"
    sTemp = sTemp + "777077|100586|10060-16777077|10061-1468806|100622|10180data source: www.federalr"
    sTemp = sTemp + "eserve.gov + www.ecb.int|10181Prime Rates in USA und Euroland|10183 %|101871999*"
    sTemp = sTemp + "2000*2001*2002*2003*2004*2005*2006|110011|1100221|110035|1100434|110052|110063|1"
    sTemp = sTemp + "10073|1100970|1101312|110171|11019-16744448|1102115|110221|1102396|110262|110521"
    sTemp = sTemp + "2|110534.75*4.75*4.75*4.75*4.75*5*5*5.25*5.25*5.25*5.5*5.5*5.5*5.75*6*6*6.5*6.5*"
    sTemp = sTemp + "6.5*6.5*6.5*6.5*6.5*6.5*5.5*5.5*5*4.5*4*3.75*3.75*3.5*3*2.5*2*1.75*1.75*1.75*1.7"
    sTemp = sTemp + "5*1.75*1.75*1.75*1.75*1.75*1.75*1.75*1.25*1.25*1.25*1.25*1.25*1.25*1.25*1*1*1*1*"
    sTemp = sTemp + "1*1*1*1*1*1*1*1*1*1*1.25*1.5*1.75*2*2.25*2.25*2.5*2.75*2.75*3*3.25*3.25*3.5*3.75"
    sTemp = sTemp + "*3.75*4*4.25*4.5*4.5*4.75*4.75*5*5.25*5.25*5.25*5.25*5.25*5.25*5.25|120011|12002"
    sTemp = sTemp + "21|120035|1200434|120052|120063|120073|1200950|1201312|120171|12019-2448096|1202"
    sTemp = sTemp + "115|120221|1202396|120262|1205212|120533*3*3*2.5*2.5*2.5*2.5*2.5*2.5*2.5*3*3*3*3"
    sTemp = sTemp + ".25*3.5*3.75*3.75*4.25*4.25*4.5*4.5*4.75*4.75*4.75*4.75*4.75*4.75*4.75*4.5*4.5*4"
    sTemp = sTemp + ".5*4.25*3.75*3.75*3.25*3.25*3.25*3.25*3.25*3.25*3.25*3.25*3.25*3.25*3.25*3.25*3."
    sTemp = sTemp + "25*2.75*2.75*2.75*2.5*2.5*2.5*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*"
    sTemp = sTemp + "2*2*2*2*2*2.25*2.25*2.25*2.5*2.5*2.5*2.75*2.75*3*3*3.25*3.25*3.5|010011|010054|0"
    sTemp = sTemp + "100721|01014-16744448|010222|01024216*287|01025109*109|010272|010283|010012|0100"
    sTemp = sTemp + "51|01010295|01011102|010191|01026USA (Federal Funds Rate)|010013|010054|0100721|"
    sTemp = sTemp + "01014-10496|010222|01024260*287|01025192*192|010272|010283|010014|010051|0101029"
    sTemp = sTemp + "5|01011185|010191|01026Euroland (Prime Rate)"

   nRetVal = RMC_CreateChartFromFile( ;
                 oWnd:hWnd           , ;  // nParentHandl
                 ID_RMC1             , ;  // nCtrlID
                 0                   , ;  // nX
                 0                   , ;  // nY
                 0                   , ;  // nExportOnly
                 sTemp                 ;  // sRMCFile
                 )
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(143) ; RETURN nil ; EndIf

RETURN nil
*----------------------------
STATIC FUNCTION mnTranspChart()
    LOCAL i          := 0
    LOCAL nC         := 0
    LOCAL nDataCount := 0
    LOCAL nRetVal    := 0
    LOCAL sTemp      := ""
    LOCAL aData      := {}
    LOCAL aData2     := {}
    LOCAL aPPC       := {}
    LOCAL oData IS DataStructD4
 
    // We don't clear the PictureBox this time before painting, so it will be 
    // painted over a probably underlying chart, which shows the "real" 
    // transparency of this chart.
 
    If nlIsMagnifier = 1   // If the Magnifier was the last active chart...
        RMC_DeleteChart( ID_RMC2 )      // delete that 2nd chart that shows 
    EndIf                               // the magnification.
 
*    oTimer1:nInterval = 0       // Stop the timer, if still running
    IF !EMPTY(oWndCh)
       oWndCh:Hide() //:Visible    = False   // Hide oWndCh (Magnifier), if visible
    ENDIF

    nlAllowChange     = False   // Reset all flags
    nlIsMagnifier     = False
    nlIsZoom          = False
 
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 185                 , ;  // nTop
                 115                 , ;  // nLeft
                 250                 , ;  // nWidth
                 200                 , ;  // nHeight
                 ColorTransparent    , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 "Tahoma"            , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 ColorTransparent      ;  // nBitmapBKColor
                 )


    If nRetVal < 0 ; IsError(144) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -5                  , ;  // nHeight
                 "\OC"                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(145) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 ColorTransparent    , ;  // nGridBackColor
                 False               , ;  // nAsGradient
                 0                   , ;  // nLeft
                 0                   , ;  // nTop
                 0                   , ;  // nWidth
                 0                   , ;  // nHeight
                 RMC_BICOLOR_NONE      ;  // nBiColor
                 )

    If nRetVal < 0 ; IsError(146) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
    sTemp = " "
   nRetVal = RMC_AddDataAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 RMC_DATAAXISLEFT    , ;  // nAlignment
                 0.0                 , ;  // nMinValue -DOUBLE so MUST have decimal!!
                 100.0               , ;  // nMaxValue -DOUBLE so MUST have decimal!!
                 11                  , ;  // nTickCount
                 8                   , ;  // nFontsize
                 ColorBlack          , ;  // nTextColor
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLENONE   , ;  // nLinestyle
                 0                   , ;  // nDecimalDigits
                 ""                  , ;  // sUnit
                 ""                  , ;  // sText
                 sTemp               , ;  // sLabels
                 RMC_TEXTCENTER        ;  // nLabelAlignment
                 )

    If nRetVal < 0 ; IsError(147) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************
    sTemp = ""
   nRetVal = RMC_AddLabelAxis( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 sTemp               , ;  // sLabels (separated by asterisk)
                 1                   , ;  // nCount
                 4                   , ;  // ntickCount
                 RMC_LABELAXISBOTTOM , ;  // nAlignment
                 8                   , ;  // nFontSize
                 ColorBlack          , ;  // ntextColor
                 RMC_TEXTCENTER      , ;  // nTextAlignment
                 ColorBlack          , ;  // nLineColor
                 RMC_LINESTYLENONE   , ;  // nLineStyle
                 ""                    ;  // sText
                 )

    If nRetVal < 0 ; IsError(148) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 70.0    // Your data goes into these 4 slots
    oData:nDouble[2] := 20.0
    oData:nDouble[3] := 80.0
    oData:nDouble[4] := 30.0

   nRetVal = RMC_AddBarSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 4                   , ;  // nDataValuesCount
                 RMC_BARSINGLE       , ;  // nType
                 RMC_COLUMN_FLAT     , ;  // nStyle
                 False               , ;  // nIsLucent
                 ColorMaroon         , ;  // nColor
                 False               , ;  // nIsHorizontal
                 1                   , ;  // nWhichAxis
                 RMC_VLABEL_NONE     , ;  // nValuelabelOn
                 1                   , ;  // nPointsPerColumn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(149) ; RETURN nil ; EndIf

    //************** Add Series 2 to region 1 *******************************
    //****** Read data values ******

    oData:nDouble[1] := 30.0    // Your data goes into these 4 slots
    oData:nDouble[2] := 70.0
    oData:nDouble[3] := 40.0
    oData:nDouble[4] := 80.0

   nRetVal = RMC_AddLineSeries( ;
                 ID_RMC1             , ;  // nCtrlID
                 1                   , ;  // nRegion
                 oData[1]            , ;  // nFirstDataValue
                 4                   , ;  // nDataValuesCount
                 0                   , ;  // nFirstPPCValue
                 0                   , ;  // nPPCValuesCount
                 RMC_LINE            , ;  // nType
                 RMC_LINE_CABLE_SHADOW , ;  // nStyle
                 RMC_LSTYLE_SPLINE   , ;  // nLineStyle
                 False               , ;  // nIsLucent
                 ColorMediumBlue     , ;  // nColor
                 RMC_SYMBOL_NONE     , ;  // nSymbol
                 1                   , ;  // nWhichDataAxis
                 RMC_VLABEL_NONE     , ;  // nValueLabelOn
                 RMC_HATCHBRUSH_OFF    ;  // nHatchMode
                 )

    If nRetVal < 0 ; IsError(150) ; RETURN nil ; EndIf
 
   nRetVal = RMC_SetWatermark( ;
                 RMC_USERWM          , ;  // sWatermark
                 RMC_USERWMCOLOR     , ;  // nColor
                 RMC_USERWMLUCENT    , ;  // nLucentValue
                 RMC_USERWMALIGN     , ;  // nAlignment
                 RMC_USERFONTSIZE      ;  // nFontSize
                 )

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(151) ; RETURN nil ; EndIf

RETURN nil
*------------------------------------------------------------------
STATIC FUNCTION mnZoom()
    LOCAL nRetVal := 0
    LOCAL sTemp := ""
    LOCAL aData := {}
    LOCAL aPPC := {}
    LOCAL oPPC IS DataStructL3
    
    DoSettings()
    
*    oWnd:MousePointer = 11  // ???
 
    //************** Create the chart **********************
   nRetVal = RMC_CreateChart( ;
                 oWnd:hWnd           , ;  // nParentHandle
                 ID_RMC1             , ;  // nCtrlID
                 10                  , ;  // nTop
                 10                  , ;  // nLeft
                 650                 , ;  // nWidth
                 500                 , ;  // nHeight
                 0                   , ;  // nBackColor
                 RMC_CTRLSTYLEFLAT   , ;  // nCtrlStyle
                 False               , ;  // nExportOnly
                 ""                  , ;  // sBgImage
                 ""                  , ;  // sFontName
                 0                   , ;  // nToolTipwidth
                 0                     ;  // nBitmapBKColor
                 )

    If nRetVal < 0 ; IsError(152) ; RETURN nil ; EndIf

    //************** Add Region 1 *****************************
   nRetVal = RMC_AddRegion( ;
                 ID_RMC1             , ;  // nCtrlID
                 5                   , ;  // nLeft
                 5                   , ;  // nTop
                 -5                  , ;  // nWidth
                 -70                 , ;  // nHeight
                 ""                  , ;  // sFooter
                 False                 ;  // nShowBorder
                 )

    If nRetVal < 0 ; IsError(153) ; RETURN nil ; EndIf

    //************** Add grid to region 1 *****************************
   nRetVal = RMC_AddGrid(ID_RMC1, 1)

    If nRetVal < 0 ; IsError(154) ; RETURN nil ; EndIf

    //************** Add data axis to region 1 *****************************
   nRetVal = RMC_AddDataAxis( ID_RMC1, 1, RMC_DATAAXISLEFT, 0.0, 0.0, 11 )

    If nRetVal < 0 ; IsError(155) ; RETURN nil ; EndIf

    //************** Add label axis to region 1 *****************************
    sTemp = "2000*2001*2002*2003*2004*2005*2006"
   nRetVal = RMC_AddLabelAxis( ID_RMC1, 1, sTemp, 1, 7, RMC_LABELAXISBOTTOM, 8, 0, RMC_TEXTCENTER )

    If nRetVal < 0 ; IsError(156) ; RETURN nil ; EndIf

    //************** Add Series 1 to region 1 *******************************

    oPPC:nLong[1] := 254
    
   nRetVal = RMC_AddLineSeries( ID_RMC1, 1, 0, 0, oPPC[1], 1, RMC_LINE, RMC_LINE_FASTLINE, RMC_LSTYLE_LINE, False, ;
                                    ColorGreen)
    If nRetVal < 0 ; IsError(157) ; RETURN nil ; EndIf
                                   // was: "dax00-06d.csv" but we don't have it
   nRetVal = RMC_SetSeriesDataFile( ID_RMC1, 1, 1, "dax00-04.csv", "-1,0", "3", ",", 0 )

    If nRetVal < 0 ; IsError(158) ; RETURN nil ; EndIf

    //************** Add Series 2 to region 1 *******************************
   nRetVal = RMC_AddLineSeries( ID_RMC1, 1, 0, 0, oPPC[1], 1, RMC_LINE, RMC_LINE_FASTLINE, RMC_LSTYLE_LINE, False,;
                                    ColorRed)
    If nRetVal < 0 ; IsError(159) ; RETURN nil ; EndIf

   nRetVal = RMC_SetSeriesDataFile( ID_RMC1, 1, 2, "dax00-04.csv", "-1,0", "4", ",", 0)

    If nRetVal < 0 ; IsError(160) ; RETURN nil ; EndIf

    //************** Add Series 3 to region 1 *******************************
   nRetVal = RMC_AddLineSeries( ID_RMC1, 1, 0, 0, oPPC[1], 1, RMC_LINE, RMC_LINE_FASTLINE, RMC_LSTYLE_LINE, False,;
                                    ColorBlue)
    If nRetVal < 0 ; IsError(161) ; RETURN nil ; EndIf

   nRetVal = RMC_SetSeriesDataFile( ID_RMC1, 1, 3, "dax00-04.csv", "-1,0", "7", ",", 0)

    If nRetVal < 0 ; IsError(162) ; RETURN nil ; EndIf

   nRetVal = RMC_AddLegend( ID_RMC1, 1, "High*Low*Close", RMC_LEGEND_TOP)

    If nRetVal < 0 ; IsError(163) ; RETURN nil ; EndIf

    sTemp = "Draw a rectangle with the left mouse button pressed around the area, "
    sTemp = sTemp + "which shall be zoomed, then release the button." + Chr(13) + Chr(10) + "With a right mouse button click (backwards) and a Shift+"
    sTemp = sTemp + "right mouse button click (forwards) you can browse between multiple zoom states." + Chr(13) + Chr(10)
    sTemp = sTemp + "The middle mouse button redraws the original (unzoomed) chart."

   nRetVal = RMC_COText( ID_RMC1, 1, sTemp, 35, 435, 610, 60, RMC_BOX_FLAT_SHADOW, 0, ;
                         0, 0, RMC_LINE_HORIZONTAL, 0, "00C" )
    If nRetVal < 0 ; IsError(164) ; RETURN nil ; EndIf

   nRetVal = RMC_Zoom( ID_RMC1, RMC_ZOOM_INTERNAL, ColorRed, ColorBlue, 100 )

    If nRetVal < 0 ; IsError(165) ; RETURN nil ; EndIf

   nRetVal = RMC_Draw( ID_RMC1 )

    If nRetVal < 0 ; IsError(166) ; RETURN nil ; EndIf
    
    nlIsZoom = True
    
*    oWnd:MousePointer = 0  // ???
    
 
*IsError:
*    oWnd:MousePointer = 0

RETURN nil
*-------------------------------------------------
STATIC FUNCTION ShowMagnification()  // ..As tRMC_INFO)
    LOCAL nFirst := 0, nLast := 0, nFirstCol := 0, nLastCol := 0, ;
          nColIndex := 0, nOldColIndex := 0
    LOCAL nCount := 0, nFirstHLObject := 0, y := 0, i := 0, z := 0
    LOCAL aPointsPerCol := {}
    LOCAL oInfo2

    oInfo2 := oInfo
    
    // Called from oWnd_MouseMove() and oWndCh_MouseDown()
    
    If oInfo_nChartType = RMC_MAGNIFIER_MODE  // If in magnifier mode (=rectangle gets moved)
        If oInfo_nData1 <> 0    // If rectangle is over the HighLow series
            nFirst = RMC_GetLowPart(oInfo_nData1)   // Get first data index, which is covered by the rect
            nLast = RMC_GetHighPart(oInfo_nData1)   // Get last data index, which is covered by the rect

            RMC_SetSeriesDataRange( ID_RMC2, 1, 1, nFirst, nLast )

            // To keep it simple, we could now set the label axis to one column and show the HighLow bars evenly spread
            // in this column, as it is always done, when using the internal zooming mode (check example "Zoom").
            // Uncomment the next four lines to see the chart:

            // RMC_SetLAXTickCount( ID_RMC2, 1, 1 )  // only one column on the label axis
            // RMC_SetLAXLabelsRange( ID_RMC2, 1, 0, 0 ) // show no labels
            // RMC_Draw( ID_RMC2 )                     // draw the magnified area chart
            
            // But we want to show the HighLow objects in the column(s) of the label axis, where they belong to.
            // so we must check each HighLow object for it//s column index, and we must count, how many objects belong
            // to each column:

            nCount = ((nLast - nFirst) + 1) / 4  // How many HighLow objects do we have (one object has 4 data points!)

            // nFirst is always the first one of the four data points, which build one HighLow object
            nFirstHLObject = INT(nFirst / 4) + 1    // So we can calculate, what's the index of the first HighLow object

            For i = 1 To nCount                  // For each HighLow object
                RMC_GetInfo( ID_RMC1, @oInfo2, 1, 1, nFirstHLObject + (i - 1) ) // Get the tRMC_INFO structure
                nColIndex = oInfo2_nGCol // ColumnIndex of the HighLow object
                If nFirstCol = 0 
                   nFirstCol = nColIndex // Mark the first label for the label axis
                EndIf
                If nColIndex > nOldColIndex         // New ColumnIndex?
                    y = y + 1                       // Incr Column count
                    If y = 1 
                       aPointsPerCol := {1} //ReDim aPointsPerCol(1 To 1)     // (Re)Dimension the PointsPerColumn-Array
                    Else
                       aPointsPerCol := {y} //ReDim Preserve aPointsPerCol(1 To y)
                    EndIf
                    nOldColIndex = nColIndex
                EndIf

                aPointsPerCol[y] = aPointsPerCol[y] + 1 // Increment the counter for the PointsPerColumn for this Column
                SysRefresh()

            Next

            nLastCol = nColIndex                  // Mark the last label for the label axis

            RMC_SetLAXTickCount( ID_RMC2, 1, y )  // Set the number of columns
            RMC_SetSeriesPPColumnArray( ID_RMC2, 1, 1, aPointsPerCol[1], y ) // set the PointsPerColumn
            RMC_SetLAXLabelsRange( ID_RMC2, 1, nFirstCol, nLastCol ) // Set the range for the labels on the label axis
            RMC_Draw( ID_RMC2 )            // Draw the magnified area chart
        
        Else
           
            // Rectangle does not cover the HighLow series, so set data range to zero
            RMC_SetSeriesDataRange( ID_RMC2, 1, 1, 0, 0 )

        EndIf

        RMC_Draw( ID_RMC2 )

    EndIf
RETURN nil
*mag----------------------------
STATIC FUNCTION mnMagnifier()
    LOCAL nRetVal  := 0
    LOCAL sTemp    := ""
    LOCAL aData    := {}
    LOCAL aPPC     := {}

/*  Original VB6 code...
    oVScroll1:Visible = False
    With oWnd               // For the upper chart
        .Cls
        .MousePointer = 11
        .Width = 12000
        .Height = 3800
    End With
    With oWndCh               // For the lower chart ( = Magnification )
        .Left = 100
        .Top = 3900
        .Width = 12000
        .Height = 4300
        .Visible = True
    End With
*/

    SetWndBlocks()

    oWndCh:Show()

    If nlIsMagnifier = 1   // If the Magnifier was the last active chart
        RMC_DeleteChart( ID_RMC2 ) // Delete the lower chart, which shows the magnification
    EndIf

    IF !EMPTY(oTimer1)    
       oTimer1:nInterval = 0    // Stop the timer, if still running
    ENDIF
    nlAllowChange = False   // Reset all flags
    nlIsMagnifier = False
    nlIsZoom = False


    //-------------- Create the chart ----------------------
   nRetVal = RMC_CreateChart( oWnd:hWnd, ID_RMC1, 0, 0, 800, 250, 0, RMC_CTRLSTYLEFLAT )

    If nRetVal < 0 ; IsError(167) ; RETURN nil ; EndIf

    //-------------- Add Region 1 -----------------------------
   nRetVal = RMC_AddRegion( ID_RMC1, 5, 5, -150, -5 )

    If nRetVal < 0 ; IsError(168) ; RETURN nil ; EndIf

    //-------------- Add grid to region 1 -----------------------------
   nRetVal = RMC_AddGrid( ID_RMC1, 1 )

    If nRetVal < 0 ; IsError(169) ; RETURN nil ; EndIf

    //-------------- Add data axis to region 1 -----------------------------
   nRetVal = RMC_AddDataAxis( ID_RMC1, 1, RMC_DATAAXISLEFT, 0.0, 0.0, 11 )

    If nRetVal < 0 ; IsError(170) ; RETURN nil ; EndIf

    //-------------- Add label axis to region 1 -----------------------------

    sTemp = "2000*2001*2002*2003*2004*2005*2006"

   nRetVal = RMC_AddLabelAxis( ID_RMC1, 1, sTemp, 1, 7 )

    If nRetVal < 0 ; IsError(171) ; RETURN nil ; EndIf

    //-------------- Add Series 1 to region 1 -------------------------------
    aPPC := {}
    AADD(aPPC, 254)
    
   nRetVal = RMC_AddHighLowSeries( ID_RMC1, 1, 0, 0, aPPC[1], 1 )

    If nRetVal < 0 ; IsError(172) ; RETURN nil ; EndIf
                                   // was: "dax00-06d.csv" but we don't have it
   nRetVal = RMC_SetSeriesDataFile( ID_RMC1, 1, 1, "dax00-04.csv", "-1,0", "2-5", ",", 0 )

    If nRetVal < 0 ; IsError(173) ; RETURN nil ; EndIf

    sTemp = "Click with the left mouse button onto the chart and move the blue rectangle over the HighLow series. "
    sTemp = sTemp + "The magnification of this area is shown in the lower chart control." + Chr(13) + Chr(10) + Chr(13) + Chr(10)
    sTemp = sTemp + "Shift + right mouse click enlarges the rectangle, Shift + left mouse click makes it smaller."

   nRetVal = RMC_COText( ID_RMC1, 1, sTemp, 660, 10, 120, 220, RMC_BOX_FLAT_SHADOW, 0, ;
                         0, 0, RMC_LINE_HORIZONTAL, 0, "00C" )


   nRetVal = RMC_Magnifier( ID_RMC1, True, 20, ColorBlue, 0, 100 )

    nlIsMagnifier = True
    
    //-------------- Create a second chart for the magnifier ---------------
   nRetVal = RMC_CreateChart( oWndCh:hWnd, ID_RMC2, 0, 0, 800, 300 )

    //-------------- Add Region 1 -----------------------------
   nRetVal = RMC_AddRegion( ID_RMC2, 5, 5, -5, -5 )

    //-------------- Add grid to region 1 -----------------------------
   nRetVal = RMC_AddGrid( ID_RMC2, 1 )

    //-------------- Add data axis to region 1 -----------------------------
   nRetVal = RMC_AddDataAxis( ID_RMC2, 1, RMC_DATAAXISLEFT, 0.0, 0.0, 11, 8 )

    //-------------- Add label axis to region 1 -----------------------------

    sTemp = "2000*2001*2002*2003*2004*2005*2006"

   nRetVal = RMC_AddLabelAxis( ID_RMC2, 1, sTemp, 1, 7 )

    //nRetVal = RMC_AddLabelAxis( ID_RMC2, 1, "", 0, 0, RMC_LABELAXISBOTTOM, 8, 0, RMC_TEXTCENTER, 0, RMC_LINESTYLENONE, "" )
    
   nRetVal = RMC_AddHighLowSeries( ID_RMC2, 1, 0, 0, 0, 0 )

   nRetVal = RMC_SetSeriesDataFile( ID_RMC2, 1, 1, "dax00-06d.csv", "-1,0", "2-5", ",", 0 )
    
    
*  oWnd:MousePointer = 0  // ???  from original VB6 code

   nRetVal = RMC_Draw( ID_RMC1 )  // Draw the upper chart

*IsError:
*    oWnd:MousePointer = 0  // from original VB6 code

RETURN nil
*----------------------------
  // Problems with this...
STATIC FUNCTION ShowInfo()  // As tRMC_INFO
    // Is called from Sub oWndCh_MouseDown() every time you click with the 
    // left mousebutton onto the dialog box...
    LOCAL sInfo := ""
*    LOCAL CRLF  := ""
    LOCAL sTab := ""
    
*    CRLF = Chr(13) + Chr(10)
    sTab = Chr(9)
    
    sInfo = sInfo + "Info about the mousepointer:" + CRLF
    sInfo = sInfo + "------------------------------" + CRLF
    sInfo = sInfo + "X position: " + sTab + STR(oInfo_nXPos) + CRLF;
                  + "Y position: " + sTab + STR(oInfo_nYPos)
    If oInfo_nRegionIndex > 0 
        sInfo = sInfo + CRLF + CRLF + "Info about the region:" + CRLF
        sInfo = sInfo + "------------------------------" + CRLF
        sInfo = sInfo + "Regionindex:" + sTab + STR(oInfo_nRegionIndex) + CRLF;
                      + "Left position:" + sTab + STR(oInfo_nRLeft) + CRLF;
                      + "Top position:" + sTab + STR(oInfo_nRTop) + CRLF;
                      + "Right position:" + sTab + STR(oInfo_nRRight) + CRLF;
                      + "Bottom position:" + sTab + STR(oInfo_nRBottom)
    EndIf
    If oInfo_nRegionIndex < 0  // Special case: this is a CustomObject
      sInfo = sInfo + CRLF + CRLF + "Info about the CustomObject:" + CRLF
      sInfo = sInfo + "------------------------------" + CRLF
      sInfo = sInfo + "Index:" + sTab + sTab + STR(Abs(oInfo_nRegionIndex)) + CRLF;
                    + "Type:" + sTab + sTab + Choose(oInfo_nChartType, "Text", "Box", "Circle", "Line", "Image", "Symbol", "Polygon") + CRLF;
                    + "Left position:" + sTab + STR(oInfo_nRLeft) + CRLF;
                    + "Top position:" + sTab + STR(oInfo_nRTop) + CRLF;
                    + "Right position:" + sTab + STR(oInfo_nRRight) + CRLF;
                    + "Bottom position:" + sTab + STR(oInfo_nRBottom)
    EndIf
    If oInfo_nGLeft + oInfo_nGRight > 0 
        sInfo = sInfo + CRLF + CRLF + "Info about the grid:" + CRLF
        sInfo = sInfo + "------------------------------" + CRLF
        sInfo = sInfo + "Left position:" + sTab + STR(oInfo_nGLeft) + CRLF;
                      + "Top position:" + sTab + STR(oInfo_nGTop) + CRLF;
                      + "Right position:" + sTab + STR(oInfo_nGRight) + CRLF;
                      + "Bottom position:" + sTab + STR(oInfo_nGBottom) + CRLF
        If oInfo_nGCol > 0 
*            Select Case oInfo_nChartType
             Do Case
                Case oInfo_nChartType = RMC_BARSINGLE .or. ;
                     oInfo_nChartType = RMC_HIGHLOW  // To RMC_HIGHLOW

                    sInfo = sInfo + "Column:" + sTab + sTab + STR(oInfo_nGCol) + CRLF;
                                  + "Row:" + sTab + sTab + STR(oInfo_nGRow)
                Case oInfo_nChartType = RMC_XYCHART
                    sInfo = sInfo + "Sector-index of 1. axes pair:" + sTab + Str(oInfo_nGCol)
                    If oInfo_nGRow > 0 
                        sInfo = sInfo + CRLF + "Sector-index of 2. axes pair:" + sTab + Str(oInfo_nGRow)
                    EndIf
             EndCase
        EndIf
    EndIf
    If oInfo_nSeriesIndex > 0 
        sInfo = sInfo + CRLF + CRLF + "Info about the series:" + CRLF
        sInfo = sInfo + "------------------------------" + CRLF
        sInfo = sInfo + "Seriesindex:" + sTab + STR(oInfo_nSeriesIndex) + CRLF
        sInfo = sInfo + "Dataindex:" + sTab + STR(oInfo_nDataIndex) + CRLF
        If oInfo_nChartType = RMC_GRIDLESS 
        Else
            sInfo = sInfo + "Left position:" + sTab + STR(oInfo_nSLeft) + CRLF;
                          + "Top position:" + sTab + STR(oInfo_nSTop) + CRLF;
                          + "Right position:" + sTab + STR(oInfo_nSRight) + CRLF;
                          + "Bottom position:" + sTab + STR(oInfo_nSBottom) + CRLF
            If oInfo_nChartType = RMC_HIGHLOW 
                sInfo = sInfo + "Y-pos. Open point:" + sTab + STR(oInfo_nSTop2) + CRLF;
                              + "Y-pos. Close point:" + sTab + STR(oInfo_nSBottom2) + CRLF
            EndIf
        EndIf
*        Select Case oInfo_nChartType
        DO Case // oInfo_nChartType
            Case oInfo_nChartType = RMC_BARSINGLE .or. ;
                 oInfo_nChartType = RMC_BARGROUP .or. ;
                 oInfo_nChartType = RMC_LINE .or. ;
                 oInfo_nChartType = RMC_AREA .or. ;
                 oInfo_nChartType = RMC_VOLUMEBAR .or. ;
                 oInfo_nChartType = RMC_AREA_STACKED

                  sInfo = sInfo + "Data value:" + sTab + TRANSFORM(oInfo_nData1, "0.00") + CRLF

            Case oInfo_nChartType = RMC_BARSTACKED .or. ;
                 oInfo_nChartType = RMC_BARSTACKED100 .or. ;
                 oInfo_nChartType = RMC_LINE_INDEXED .or. ;
                 oInfo_nChartType = RMC_AREA_INDEXED .or. ;
                 oInfo_nChartType = RMC_GRIDLESS .or. ;
                 oInfo_nChartType = RMC_AREA_STACKED100

                  sInfo = sInfo + "Absolut data value:" + sTab + TRANSFORM(oInfo_nData1, "0.00") + CRLF
                  sInfo = sInfo + "Percent data value:" + sTab + " " + TRANSFORM(oInfo_nData2, "0.00") + CRLF

            Case oInfo_nChartType = RMC_FLOATINGBAR .or. ;
                 oInfo_nChartType = RMC_FLOATINGBARGROUP

                  sInfo = sInfo + "Starting data:" + sTab + TRANSFORM(oInfo_nData1, "0.00") + CRLF
                  sInfo = sInfo + "Length data:" + sTab + " " + TRANSFORM(oInfo_nData2, "0.00") + CRLF

            Case oInfo_nChartType = RMC_XYCHART

                  sInfo = sInfo + "X-data value:" + sTab + TRANSFORM(oInfo_nData1, "0.00") + CRLF
                  sInfo = sInfo + "Y-data value:" + sTab + TRANSFORM(oInfo_nData2, "0.00") + CRLF

            Case oInfo_nChartType = RMC_HIGHLOW

                sInfo = sInfo + "Open data:" + sTab + TRANSFORM(oInfo_nData1, "0.00") + CRLF
                sInfo = sInfo + "High data:" + sTab + TRANSFORM(oInfo_nData2, "0.00") + CRLF
                sInfo = sInfo + "Low data:" + sTab + TRANSFORM(oInfo_nData3, "0.00") + CRLF
                sInfo = sInfo + "Close data:" + sTab + TRANSFORM(oInfo_nData4, "0.00") + CRLF

        EndCase
    EndIf
    If oInfo_nGLeft + oInfo_nGRight > 0 
        sInfo = sInfo + CRLF + CRLF + "Data value, which is correspondent" + CRLF;
                                      + "to this X/Y location:" + CRLF
        sInfo = sInfo + "------------------------------" + CRLF
        If oInfo_nChartType = RMC_XYCHART
            sInfo = sInfo + "X-data value of 1. axes pair: " + sTab + LTrim(TRANSFORM(oInfo_nVirtData1, "0.00")) + CRLF
            sInfo = sInfo + "Y-data value of 1. axes pair: " + sTab + LTrim(TRANSFORM(oInfo_nVirtData2, "0.00")) + CRLF
            If oInfo_nVirtData3 <> 0 .And. oInfo_nVirtData4 <> 0 
                sInfo = sInfo + "X-data value of 2. axes pair: " + sTab + LTrim(TRANSFORM(oInfo_nVirtData3, "0.00")) + CRLF
                sInfo = sInfo + "Y-data value of 2. axes pair: " + sTab + LTrim(TRANSFORM(oInfo_nVirtData4, "0.00")) + CRLF
            EndIf
        Else
            sInfo = sInfo + "Data value of the 1. data-axis: " + LTrim(TRANSFORM(oInfo_nVirtData1, "0.00")) + CRLF
            If oInfo_nVirtData2 <> 0 
                sInfo = sInfo + "Data value of the 2. data-axis: " + sTab + LTrim(TRANSFORM(oInfo_nVirtData2, "0.00")) + CRLF
            EndIf
        EndIf
    EndIf

*   MsgBox sInfo, vbInformation, "RMChart Demo"   // original VB6 code

    MsgInfo( sInfo, "RMChart Demo" )

RETURN nil
*----------------------------
FUNCTION IsError(nError)
   DEFAULT nError := 0

   MsgAlert( "An error occurred at: "+LTRIM(STR(nError)) +CRLF+;
             "Please make a note of this number." )

   // Each error number can be traced to a specific place in this prg.

RETURN nil
*----------------------------
STATIC FUNCTION Choose()
LOCAL cChoice := "",aItems := {},oDlg

   aItems := {"Text", "Box", "Circle", "Line", "Image", "Symbol", "Polygon"}

   DEFINE DIALOG oDlg FROM 0,0 TO 20,50 OF oWnd ;
      TITLE "Select Chart Type"

   @ 1,1 LISTBOX oLbx VAR cChoice ITEMS aItems SIZE 20,20 OF oDlg

   @ 15,5 BUTTON oBtn PROMPT "Okay" OF oDlg ;
     ACTION (oDlg:End() )

   ACTIVATE DIALOG oDlg CENTERED

RETURN cChoice
//*ig----------------- End of original RMCDemo functions --------------------//
  // Either load oInfo with tech graph specs, or reset its values to 0...
STATIC FUNCTION InfoGet(nRegionIndex, nSeriesIndex, nDataIndex, lResetOnly)
    LOCAL nRet := 0,aCursorPos := {},nX := 0,nY := 0

    IF(EMPTY(lResetOnly), lResetOnly := .f., )

    oInfo IS tRMC_INFO  

    IF(EMPTY(nRegionIndex), nRegionIndex := 1, )
    IF(EMPTY(nSeriesIndex), nSeriesIndex := 1, )
    IF(EMPTY(nDataIndex),   nDataIndex   := 1, )

    oInfo:nLong[1]    := 0 //    nXPos        
    oInfo:nLong[2]    := 0 //    nYPos        
    oInfo:nLong[3]    := 0 //    nXMove       
    oInfo:nLong[4]    := 0 //    nYMove       
    oInfo:nLong[5]    := 0 //    nRegionIndex 
    oInfo:nLong[6]    := 0 //    nRLeft       
    oInfo:nLong[7]    := 0 //    nRTop        
    oInfo:nLong[8]    := 0 //    nRRight      
    oInfo:nLong[9]    := 0 //    nRBottom     
    oInfo:nLong[10]   := 0 //    nSeriesIndex 
    oInfo:nLong[11]   := 0 //    nDataIndex   
    oInfo:nLong[12]   := 0 //    nChartType   
    oInfo:nLong[13]   := 0 //    nSLeft       
    oInfo:nLong[14]   := 0 //    nSTop        
    oInfo:nLong[15]   := 0 //    nSRight      
    oInfo:nLong[16]   := 0 //    nSBottom     
    oInfo:nLong[17]   := 0 //    nSTop2       
    oInfo:nLong[18]   := 0 //    nSBottom2    
    oInfo:nLong[19]   := 0 //    nGLeft       
    oInfo:nLong[20]   := 0 //    nGTop        
    oInfo:nLong[21]   := 0 //    nGRight      
    oInfo:nLong[22]   := 0 //    nGBottom     
    oInfo:nLong[23]   := 0 //    nGCol        
    oInfo:nLong[24]   := 0 //    nGRow        
    oInfo:nDouble[1] := 0.0 //  nData1       
    oInfo:nDouble[2] := 0.0 //  nData2       
    oInfo:nDouble[3] := 0.0 //  nData3       
    oInfo:nDouble[4] := 0.0 //  nData4       
    oInfo:nDouble[5] := 0.0 //  nVirtData1   
    oInfo:nDouble[6] := 0.0 //  nVirtData2   
    oInfo:nDouble[7] := 0.0 //  nVirtData3   
    oInfo:nDouble[8] := 0.0 //  nVirtData4   

    IF !lResetonly
       nRet := RMC_GetINFO( nCtrlID, @oInfo, nRegionIndex, nSeriesIndex, ;
                            nDataIndex )

       aCursorPos := GetCursorPos() // This is an FWH or xHb built-in function.

       nX := aCursorPos[2]
       nY := aCursorPos[1]

       oInfo:nLong[1] := nX
       oInfo:nLong[2] := nY

    ENDIF
/*
    In the VB version, data in oInfo could be conveniently referred to as
    oInfo:nXPos or oInfo:nChartType.  That is not directly possible here due to
    the nature of the C structure for oInfo that we're using here. Obviously, 
    it's inconvenient here to refer to oInfo data as oInfo:nLong[1] or 
    oInfo:nLong[23] because we might have no idea what data those numeric 
    identifiers represented. So to solve that problem and gain the same 
    convenience as in the VB version, below we load each of the oInfo data 
    elements into a file-wide variable that we can easily refer to similar 
    to the VB example: we can now use oInfo_nXPos or oInfo_nChartType exactly 
    as oInfo:nXPos or oInfo:nChartType are used in the VB version.
    
*/
    // These vars are all file-wide statics...
    oInfo_nXPos        :=     oInfo:nLong[1]    
    oInfo_nYPos        :=     oInfo:nLong[2]    
    oInfo_nXMove       :=     oInfo:nLong[3]    
    oInfo_nYMove       :=     oInfo:nLong[4]    
    oInfo_nRegionIndex :=     oInfo:nLong[5]    
    oInfo_nRLeft       :=     oInfo:nLong[6]    
    oInfo_nRTop        :=     oInfo:nLong[7]    
    oInfo_nRRight      :=     oInfo:nLong[8]    
    oInfo_nRBottom     :=     oInfo:nLong[9]    
    oInfo_nSeriesIndex :=     oInfo:nLong[10]   
    oInfo_nDataIndex   :=     oInfo:nLong[11]   
    oInfo_nChartType   :=     oInfo:nLong[12]   
    oInfo_nSLeft       :=     oInfo:nLong[13]   
    oInfo_nSTop        :=     oInfo:nLong[14]   
    oInfo_nSRight      :=     oInfo:nLong[15]   
    oInfo_nSBottom     :=     oInfo:nLong[16]   
    oInfo_nSTop2       :=     oInfo:nLong[17]   
    oInfo_nSBottom2    :=     oInfo:nLong[18]   
    oInfo_nGLeft       :=     oInfo:nLong[19]   
    oInfo_nGTop        :=     oInfo:nLong[20]   
    oInfo_nGRight      :=     oInfo:nLong[21]   
    oInfo_nGBottom     :=     oInfo:nLong[22]   
    oInfo_nGCol        :=     oInfo:nLong[23]   
    oInfo_nGRow        :=     oInfo:nLong[24]   
    oInfo_nData1       :=     oInfo:nDouble[1] 
    oInfo_nData2       :=     oInfo:nDouble[2] 
    oInfo_nData3       :=     oInfo:nDouble[3] 
    oInfo_nData4       :=     oInfo:nDouble[4] 
    oInfo_nVirtData1   :=     oInfo:nDouble[5] 
    oInfo_nVirtData2   :=     oInfo:nDouble[6] 
    oInfo_nVirtData3   :=     oInfo:nDouble[7] 
    oInfo_nVirtData4   :=     oInfo:nDouble[8] 

RETURN nil
//*tc----------------- End of InfoGet() ----------------------------------------//
  // Special tests of some RMChart functions...
STATIC FUNCTION TestChart(cRMCfile,lFwh)
LOCAL ;
      cFarProc    := ""              ,;
      lOk         := .f.             ,;
      lSB         := .f.             ,;
      nExportOnly := 0               ,;
      nPrintHdc   := 0               ,;
      nHeight     := 0               ,;
      nParentHndl := oDlgTst:hWnd    ,;
      nRet        := 0               ,;
      nWidth      := 0               ,;
      nX          := 0               ,;
      nY          := 0               ,;
      sRMCfile    := cRMCfile

LOCAL aRMC_CAPTION := {},nRegion := 1,aCaption := {},aData := {}

LOCAL nBackColor := CLR_HGRAY,nTextColor := CLR_BLACK,nFontSize := 10,;
      nIsBold := 1,sText := "TEST CAPTION",cVer := "xHb",l4B := .f.

LOCAL sCaption := "TEST CAPTION    ",;
      nTitelBackColor := CLR_HGRAY  ,;
      nTitelTextColor := CLR_BLACK  ,;
      nTitelFontSize  := 14         ,;
      nTitelIsBold    := 1

// Data structures needed by Rmchart functions...
LOCAL oData1  IS DataStruct1   // C structure built at top of this prg.
LOCAL oData2  IS DataStruct2   //     "        "        "         "
LOCAL oData2b IS DataStruct2b  //     "        "        "         "
LOCAL oData2c IS DataStruct2c  //     "        "        "         "
LOCAL oData2d IS DataStruct2d  //     "        "        "         "
LOCAL oData4a IS DataStruct4a  //     "        "        "         "
LOCAL oData4b IS DataStruct4b  //     "        "        "         "
LOCAL oData4c IS DataStruct4c  //     "        "        "         "
LOCAL oColors IS ColorStruct   //     "        "        "         "
// It is the use of these C data structures that requires using xHarbour's
// DllCall() function (and DllxHb commands) instead of FWH's DLL32 commands.

DEFAULT lFwh := .f.  // for GetProcAddress() below

/*
"Simplebar2.rmc" and "4_regions_B.rmc" are designs with no data. They are used
to show how to import a predesigned graph into your program and then load your
data into it at runtime...
*/

UnSetWndBlocks()

RMC_DeleteChart( nCtrlId )  // Get rid of any pre-displayed chart.
RMC_DeleteChart( ID_RMC1 )  // Get rid of any pre-displayed chart.

IF cRMCfile = cPath+"\4_regions_B.rmc"
   l4B := .t.
ELSE
   l4B := .f.
ENDIF
IF cRMCfile = cPath+"\SimpleBar2.rmc"
   lSB := .t.
ELSE
   lSB := .f.
ENDIF

oDlgTst:Show()

MsgGet("Caption","Enter graph caption:",@sCaption)

IF !EMPTY(oDlgTst)
   nCtrlId := oDlgTst:hWnd   // Changed below!!
   nX      := 0 //oDlgTst:nLeft
   nY      := 0 //oDlgTst:nTop
ENDIF

*nCtrlId := nParentHndl  // force it to oWnd:hWnd

nRet := RMC_GetChartSizeFromFile(   ;
       sRMCFile,                     ;
       @nWidth,                      ;
       @nHeight  )

/*cc
      // See results...
      msginfo(nRet,"2: nRet ")
      msginfo(nWidth,"nWidth")
      msginfo(nHeight,"nHeight")
*/

/* 
 // Test if we're able to find the func in the dll...

IF lFwh
 // FWH version...
 cFarProc = GetProcAddress( hRmcDll,;
                           "RMC_CREATECHARTFROMFILE",;
                           .t., 7 ,7 ,7 ,7, 7, 2 )
ELSE
 // cHb version... 
 cFarProc = GetProcAddress( hRmcDll,;
                           "RMC_CREATECHARTFROMFILE" )
ENDIF

// Note: with either version, the function name is case sensitive. How does
// the app know to use the xHb version instead of FWH? - Unknown, because the
// calling syntax is identical.
msginfo(cFarProc,"cFarProc")
*/

/*
nRet := RMC_CreateChartFromFile(     ;
        nParentHndl,                 ;
        nCtrlId,                     ;
        nX,                          ;
        nY,                          ;
        nExportOnly,                 ;
        sRMCfile )
*/

nRet := DLLCALL(hRmcDll,DC_CALL_STD, ;
             "RMC_CREATECHARTFROMFILE",oDlgTst:hWnd,nCtrlId,nX,nY,;
                                     nExportOnly,sRMCfile )

       // ...so must use the verbose version instead...
nRet := RMC_AddCaption(                   ; // the function to call via DLL32
      nCtrlId,                           ;
      nRegion,                           ;
      sCaption,                          ;
      nTitelBackColor,                   ;
      nTitelTextColor,                   ;
      nTitelFontSize,                    ;
      nTitelIsBold )

*cc  
*msginfo(nRet,"nRet - RMC_AddCaption")  // nRet should be 0 if func accessed ok


// Now enter your data onto the various graphs...

   // First, load data into C structure array object...
   // (in your app, can load this data from database or wherever)
   oData1:nDouble[1] := 30.0    // Your data goes into these 5 slots
   oData1:nDouble[2] := 50.0
   oData1:nDouble[3] := 20.0
   oData1:nDouble[4] := 70.0
   oData1:nDouble[5] := 60.0

   oData2:nDouble[1] := 20.0    // Your data goes into these 5 slots
   oData2:nDouble[2] := 10.0
   oData2:nDouble[3] := 15.0
   oData2:nDouble[4] := 25.0
   oData2:nDouble[5] := 30.0

   oData2b:nDouble[1] := 25.0    // Your data goes into these 5 slots
   oData2b:nDouble[2] := 30.0
   oData2b:nDouble[3] := 10.0
   oData2b:nDouble[4] := 20.0
   oData2b:nDouble[5] := 15.0

   oData2c:nDouble[1] := 10.0    // Your data goes into these 5 slots
   oData2c:nDouble[2] := 20.0
   oData2c:nDouble[3] := 40.0
   oData2c:nDouble[4] := 20.0
   oData2c:nDouble[5] := 30.0

   oData2d:nDouble[1] := 40.0    // Your data goes into these 5 slots
   oData2d:nDouble[2] := 30.0
   oData2d:nDouble[3] := 20.0
   oData2d:nDouble[4] := 30.0
   oData2d:nDouble[5] := 20.0

   oData4a:nDouble[1] := 240.0    // Your data goes into these 10 slots
   oData4a:nDouble[2] := 225.0
   oData4a:nDouble[3] := 215.0
   oData4a:nDouble[4] := 200.0
   oData4a:nDouble[5] := 175.0
   oData4a:nDouble[6] := 160.0
   oData4a:nDouble[7] := 145.0
   oData4a:nDouble[8] := 130.0
   oData4a:nDouble[9] := 120.0
   oData4a:nDouble[10] := 110.0

   oData4b:nDouble[1] := 8.3    // Your data goes into these 10 slots
   oData4b:nDouble[2] := 9.2
   oData4b:nDouble[3] := 7.0
   oData4b:nDouble[4] := 5.6
   oData4b:nDouble[5] := 6.5
   oData4b:nDouble[6] := 3.5
   oData4b:nDouble[7] := 4.5
   oData4b:nDouble[8] := 6.8
   oData4b:nDouble[9] := 4.2
   oData4b:nDouble[10] := 8.0

   oData4c:nLong[1] := 1    // Your data goes into these 10 slots
   oData4c:nLong[2] := 1
   oData4c:nLong[3] := 1
   oData4c:nLong[4] := 1
   oData4c:nLong[5] := 1
   oData4c:nLong[6] := 1
   oData4c:nLong[7] := 1
   oData4c:nLong[8] := 1
   oData4c:nLong[9] := 1
   oData4c:nLong[10] := 1

// Now enter your colors for the piechart...

   // First, load data into C structure array object...
   oColors:nLong[1] := CLR_HRED
   oColors:nLong[2] := CLR_HBLUE
   oColors:nLong[3] := CLR_YELLOW
   oColors:nLong[4] := CLR_HCYAN
   oColors:nLong[5] := CLR_HMAGENTA

/* FWH's DLL32 command doesn't work for some Rmchart functions because can't 
   pass either aData or oData, unlike xHb's DLLCall(). Thus command DLLxHb 
   has been created offering the same syntax as FWH's commands DLL32 or DLL, 
   but it uses the xHb function DLLCall() instead of FWH's CallDll() or 
   CallDll32(). To use this command DLLxHb, DLLxHb.ch must be included at top 
   of the prg.
*/

IF lSB .OR. l4b
   // To enter data into either the singlebars2 graph or the 4_regions_B graph,
   // first region...
  nRet := RMC_AddBarSeries(; // the RMChart.dll function to call (not case sensitive here).
      nCtrlId,             ; // Control ID
      1,                   ; // nRegion - graph region
      oData1[1],           ; // @nFirstDataValue - data array (passed as a structure)
      5,                   ; // nDataValuesCount - length of data
      0,                   ; // nType - bar type
      IF(l4B,6,3),         ; // nStyle - bar style (l4B means using "4_RegionsB.rmc" )
      0,                   ; // nIsLucent - opaque = 0; transparent = 1
      nRGB(99,148,236),    ; // nColor - bar color - use CLR_color or nRGB()
      0,                   ; // nIsHorizontal = 1; 0 = vertical
      0,                   ; // nWhichDataAxis
      0,                   ; // nValueLabelOn - 1 = yes; 0 = no
      0,                   ; // nPointsPerColumn
      0 )                    // nHatchMode

   // OR could use this function instead to just enter the data...
/*
  nRet := RMC_SetSeriesData(   ;
          nCtrlId,             ; // Control ID
          1,                   ; // nRegion - graph region
          1,                   ; // nSeries 
          oData1[1],           ; // @nFirstDataValue - data array (passed as a structure)
          5,                   ; // nDataValuesCount - length of data
          0 )                    // Optional nYdata
*/

ENDIF // lSB or l4b

   // Note that Rmchart has functions for zooming in or magnifying graph data,
   // which require display in a second child window.

/*---------------- Reference section (from Rmchart.ch), for your convenience...
   Rmchart constants for types of bar charts:
 
   RMC_BARSINGLE          = 1  (default)
   RMC_BARGROUP           = 2 
   RMC_BARSTACKED         = 3 
   RMC_BARSTACKED100      = 4 
   RMC_FLOATINGBAR        = 5 
   RMC_FLOATINGBARGROUP   = 6 
   
   Constants for available Rmchart bar styles:
   
   RMC_BAR_FLAT           = 1   (default)
   RMC_BAR_FLAT_GRADIENT1 = 2 
   RMC_BAR_FLAT_GRADIENT2 = 3 
   RMC_BAR_HOVER          = 4 
   RMC_COLUMN_FLAT        = 5 
   RMC_BAR_3D             = 6 
   RMC_BAR_3D_GRADIENT    = 7 
   RMC_COLUMN_3D          = 8 
   RMC_COLUMN_3D_GRADIENT = 9 
   RMC_COLUMN_3D_FLUTED  = 10 
   
   Colors:
      Can use standard Clipper CLR_color constants or nRGB() color specs, i.e.:
   
   nRGB(99,148,236)       = "AliceBlue" (an Rmchart demo color)
   nRGB(248,208,0)        = "Gold"             "      "    "
   nRGB(221,204,163)      = "Metallic Bronze"  "      "    "

   Pie Chart Styles:
   RMC_PIE_FLAT = 51 
   RMC_PIE_GRADIENT = 52 
   RMC_PIE_3D = 53 
   RMC_PIE_3D_GRADIENT = 54 
*/ //---------------

IF l4B  // Data entry for the 4-regions-on-one-chart example...
   // Must invoke the DLLxHb command for these (as provided by rmc4xhb.prg), 
   // because FWH's DLL32 command won't work for oData[1], etc.     

   // Note: the code for first graph of the 4-regions demo is located in this
   //       function in a section above the preceding reference section.


  nRet := RMC_SetSeriesData(   ;
          nCtrlId,             ; // Control ID
          2,                   ; // nRegion - graph region
          1,                   ; // nSeries 
          oData2[1],           ; // @nFirstDataValue - data array (passed as a structure)
          5,                   ; // nDataValuesCount - length of data
          0 )                    // Optional nYdata

  nRet := RMC_SetSeriesData(   ;
          nCtrlId,             ; // Control ID
          2,                   ; // nRegion - graph region
          2,                   ; // nSeries 
          oData2b[1],          ; // @nFirstDataValue - data array (passed as a structure)
          5,                   ; // nDataValuesCount - length of data
          0 )                    // Optional nYdata

  nRet := RMC_SetSeriesData(   ;
          nCtrlId,             ; // Control ID
          2,                   ; // nRegion - graph region
          3,                   ; // nSeries 
          oData2c[1],          ; // @nFirstDataValue - data array (passed as a structure)
          5,                   ; // nDataValuesCount - length of data
          0 )                    // Optional nYdata

  nRet := RMC_SetSeriesData(   ;
          nCtrlId,             ; // Control ID
          2,                   ; // nRegion - graph region
          4,                   ; // nSeries 
          oData2d[1],          ; // @nFirstDataValue - data array (passed as a structure)
          5,                   ; // nDataValuesCount - length of data
          0 )                    // Optional nYdata

       // Enter pie chart data...

/*        // If you just want to set the data...
  nRet := RMC_SetSeriesData(   ;
          nCtrlId,             ; // Control ID
          3,                   ; // nRegion - graph region
          1,                   ; // nSeries 
          oData1[1],            ; // @nFirstDataValue - data array (passed as a structure)
          5,                   ; // nDataValuesCount - length of data
          0 )                    // Optional nYdata
*/
          // Or, if you want to set data AND also change elements like colors...
  nRet := RMC_AddGridlessSeries( ; 
          nCtrlID,             ; // nCtrlID - container window handle
          3,                   ; // nRegion (this chart has 4 regions)
          oData1[1],            ; // @nFirstDataValue
          5,                   ; // nDataValuesCount
          oColors[1],          ; // @nFirstColorElement
          5,                   ; // nColorElementsCount
          RMC_PIE_3D_GRADIENT, ; // nStyle
          0,                   ; // nPieAlignment
          3,                   ; // nExplodemode
          0,                   ; // nIsLucent
          1,                   ; // nValueLabelOn
          0,                   ; // nHatchMode
          0 )                    // nStartAngle


   // Chart region 4: combo bar chart overlaid with line graph...

          // First, the bar chart (could use RMC_SetSeriesData() for this)...
  nRet := RMC_AddBarSeries(    ; // the RMChart.dll function to call
          nCtrlId,             ; // Control ID
          4,                   ; // nRegion - graph region
          oData4a[1],          ; // @nFirstDataValue - data array (passed as a structure)
          10,                  ; // nDataValuesCount - length of data
          0,                   ; // nType - bar type
          3,                   ; // nStyle - bar style
          0,                   ; // nIsLucent - opaque = 0; transparent = 1
          CLR_RMCGOLD,         ; // nColor - bar color - use CLR_color or nRGB()
          0,                   ; // nIsHorizontal = 1; 0 = vertical
          0,                   ; // nWhichDataAxis
          0,                   ; // nValueLabelOn - 1 = yes; 0 = no
          0,                   ; // nPointsPerColumn
          0 )                    // nHatchMode

          //Now, overlay the line graph
  nRet := RMC_AddLineSeries(   ; 
          nCtrlID,             ;                      
          4,                   ; // nRegion - graph region
          oData4b[1],          ; // @nFirstDataValue - data array (passed as a structure)
          10,                  ; // nDataValuesCount - length of data
          oData4c[1],          ; // @nFirstPPCValue  - array
          10,                  ; // nPPCValuesCount
          RMC_LINE,            ; // nChartType
          RMC_LINE_CABLE,      ; // nStyle
          RMC_LSTYLE_LINE,     ; // nLineStyle
          0,                   ; // nIsLucent - opaque = 0; transparent = 1
          CLR_GREEN,           ; // nColor - line color - use CLR_color or nRGB()
          0,                   ; // nChartSymbol
          2,                   ; // nWhichDataAxis (to which connected)
          1,                   ; // nValueLabelOn - 1 = yes; 0 = no
          0 )                    // nHatchMode

ENDIF

// Now let's display the graph on the dialog oDlgTst...

nRet := RMC_Draw(nCtrlId)  
RMC_SetSeriesColor( nCtrlID, 1, 1, CLR_RED , 3 )
RMC_Draw( nCtrlID )


lOk := MsgYesNo("Do you want to print the graph?")

IF lOk

  nPrintHdc := GetPrintDC(oWnd)

  nRet := RMC_Draw2Printer(    ;
      nCtrlID,                 ; // the chart's control ID
      nPrintHdc,               ; // printer's device context handle
      0,                       ; // nLeft
      0,                       ; // nTop
      165,                     ; // nWidth
      127,                     ; // nHeight
      RMC_EMF                  ; // use default nType 1 (see Rmchart docs).
      ) 

ENDIF // lOk


RETURN nil
//-------------------------- end TestChart() --------------------------------//

// Dummy func for FWH Errsysw()
FUNCTION OemToChara() ; Return nil

//---------------------------------------------------------------------------//
