Page 2 of 3

Posted: Sat Feb 23, 2008 4:06 am
by Baldrick
Thought I might just throw a little simple sample code on here using this lib to give some ppl's an idea for using. ( Obviouly you will need ABBKLAUS's lib intsalled & the dll to use it. ) fwiw, the included csv files are an output extract from a little Db app project I am working on for myself atm.

Download files here < Link removed as sample is now included in lib download.

Regards,
Baldrick :mrgreen:

Posted: Mon Feb 25, 2008 5:09 pm
by Xombie
ABBKlaus,

Sure. I took your last example and changed it slightly.

Code: Select all

;XIncludeFile "RMChart.pbi"
;RMC_Init()

#ID_WINDOW = 1
#ID_CHART  = 1
#ID_REGION = 1
#ID_CONT1  = 1
#ID_PANEL1 = 2

Procedure MyCallback(hwnd, CBMSG, CBWPARAM, CBLPARAM)
  Protected *TINFO.RMC_INFO
  Protected CBCTL.w,CBCTLMSG.w
  Protected Text$
  Static z.l
 
  CBCTL = PeekW(@CBWPARAM+0)
  CBCTLMSG = PeekW(@CBWPARAM+2)
 
  Select CBMSG
    Case #WM_RBUTTONDOWN  ; right mouse button was clicked
      ; CBLPARAM holds always the X/Y-position within the dialog,
      ; even you've clicked onto the chart
      Text$="X-Pos in the dialog:"+Str(PeekW(@CBLPARAM+0))+Chr(13)
      Text$+"Y-Pos in the dialog:"+Str(PeekW(@CBLPARAM+2))
      MessageRequester("RMChart",Text$,0)
    Case #WM_COMMAND
      Select CBCTL
        Case #ID_CHART                     ;message from the chart control
          Select CBCTLMSG                  ;identify the message
            Case #RMC_LBUTTONDOWN          ;left mouse button
              z = 1                        ;set flag for left mouse button pressed
            Case #RMC_LBUTTONUP
              z = 0                        ;reset the flag for left mouse button pressed
            Case #RMC_CTRLRBUTTONDOWN      ;Ctrl and right mouse button
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              Text$="X-Pos in the chart:"+Str(*TINFO\nXPos)+Chr(13)
              Text$+"Y-Pos in the chart:"+Str(*TINFO\nYPos)
              MessageRequester("RMChart",Text$,0)
            Case #RMC_MOUSEMOVE            ;mouse was moved in the chart control
              Debug "#RMC_MOUSEMOVE"
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              If z                         ;if the left mouse button is pressed
                ;move the chart control within your dialog
                RMC_SetCtrlPos(#ID_CHART,*TINFO\nXMove,*TINFO\nYMove,1)
              EndIf
          EndSelect
      EndSelect
  EndSelect
 
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

Procedure PBMain()
  If OpenWindow(#ID_WINDOW, 0, 0, 800, 600, "RMCHART.DLL", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(#ID_WINDOW))
      ContainerGadget(#ID_CONT1, 8, 8, 800-24, 600-40, #PB_Container_Raised)
         PanelGadget(#ID_PANEL1,0,0,800,600)
         AddGadgetItem (#ID_PANEL1, -1, "Panel 1")
         CloseGadgetList()
      CloseGadgetList()
    EndIf
    If RMC_CreateChart(GadgetID(#ID_PANEL1), #ID_CHART, 0, 0, 800, 600) = #RMC_NO_ERROR
      RMC_AddRegion(#ID_CHART, 5, 5, -5, -5,"Test")
      RMC_AddGrid(#ID_CHART, #ID_REGION)
      RMC_AddXAxis(#ID_CHART, #ID_REGION, #RMC_XAXISBOTTOM)
      RMC_AddYAxis(#ID_CHART, #ID_REGION, #RMC_YAXISLEFT)
      RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
      RMC_SetCaptionBGColor(#ID_CHART,#ID_REGION,0)
      RMC_Draw(#ID_CHART)
    EndIf
   
    SetWindowCallback(@MyCallback())
   
    Repeat
     Event=WaitWindowEvent()
     
     Select Event
       Case #PB_Event_Gadget
         ;Debug "Gadget "+Str(EventGadget())
         Select EventGadget()
         EndSelect
     EndSelect
    Until Event=#PB_Event_CloseWindow
   
    CloseWindow(#ID_WINDOW)
   
  EndIf
EndProcedure

PBMain()

DataSection
LabX: Data.d 10,20,20,30,40,50,60,70,80,90
LabY: Data.d 10,20,30,30,30,40,90,65,80,10
EndDataSection
So the panel gadget is in the container gadget - which is how my program is currently set up.

Posted: Mon Feb 25, 2008 5:38 pm
by Xombie
Hah! I think I have it. I messed around with the callback a bit and when I set the callback on the panel itself, I noticed it worked if the mouse was in the header area. Then I thought, "Oh - I bet the container part of the panel gadget has it's own handle." So, I did a quick search on the forum and found a post by srod that confirmed it - http://www.purebasic.fr/english/viewtopic.php?t=28479

So I used the handle of the tab itself when creating the chart and I got my events back :)

Posted: Tue Feb 26, 2008 12:28 am
by ABBKlaus
Xombie wrote:So I used the handle of the tab itself when creating the chart and I got my events back :)
Thanks,
i added yours (with srods enhancement) and baldricks Rainguage Chartmaker Test to the sources.
Download see first post.

Posted: Wed Apr 09, 2008 7:03 pm
by ABBKlaus
small update :
Apr 9th 2008 RMChart Library V1.01 for PB4.10
- fixed missing parameter 'ExportOnly' in RMC_CreateChartOnDC
see first post for more details

Posted: Fri Apr 11, 2008 4:28 pm
by Xombie
ABBKlaus,

Do you know how I can hide and show the chart without resizing it?

Posted: Mon Jan 05, 2009 7:31 pm
by ABBKlaus
updated RMChart to work with PB4.30X86.

Download see first post.

Posted: Sun Feb 08, 2009 8:36 pm
by localmotion34
Since I struggled with this control for the last 2 days, I figure Id post an easy way to get an image from the control WITHOUT having to draw and draw and draw all over again.

Code: Select all

Global RMChartHandle.l= FindWindowEx_(ParentHwndID,0,"RMC","")

;;Need to find a child window of the parent with the "RMC" szClassName

Procedure GetRMChartImage(RMCharHandle.l) ;HWND of the chart
  Protected RMrect.RECT
  getwindowrect_(RMCharHandle,@RMrect.RECT) ;get the rect
  RMwidth= RMrect\right-RMrect\left  ;;calculate the sizes
  RMheight=RMrect\bottom-RMrect\top
  RMImage.l=CreateImage(#PB_Any,RMwidth, RMheight) ;create an image
  If RMImage
    IMGhdc=StartDrawing(ImageOutput(RMImage))  use the hdc of the new image
      RMDC.l=GetDC_(RMCharHandle) ;get chart dc
      BitBlt_(IMGhdc,0,0,RMwidth, RMheight,RMDC,0,0,#SRCCOPY) ;just copy all
    StopDrawing()
    ReleaseDC_(RMCharHandle, RMDC)
    ProcedureReturn RMImage ;BOOM-there's our new freaking image
  Else
    ProcedureReturn 0
  EndIf 
EndProcedure 

Now if you have multiple charts on the same window, this will always return the FIRST one. If someone can kindly tell us HOW to actually find the RMChart Hwnd that Windows uses without having to use FindWindowEx, i'd appreciate it.

Posted: Sun Feb 08, 2009 9:49 pm
by ABBKlaus
here“s a better solution that finds all RMC-childwindows :

Code: Select all

Global NewList RMC_Handle.l()
Procedure RMC_Enum(hwnd,lparam)
  Protected classname.s=Space(512)
  
  result=GetClassName_(hwnd,@classname,Len(classname))
  If result And classname="RMC"
    idchild = GetWindowLong_(hwnd,#GWL_ID)
    ;Debug "RMC-ID : "+Str(idchild)
    ;Debug "RMC-Handle : "+Str(hwnd)
    AddElement(RMC_Handle())
    RMC_Handle()=hwnd
  EndIf
  ProcedureReturn 1 ; 1= Continue / 0= stop enumeration
EndProcedure

Procedure.l RMC_EnumWindows()
  ClearList(RMC_Handle())
  EnumChildWindows_(WindowID(#ID_WINDOW),@RMC_Enum(),0)
  ProcedureReturn ListSize(RMC_Handle())
EndProcedure

Code: Select all

    Count = RMC_EnumWindows()
    If Count
      Debug "Found "+Str(Count)+" RMC-Windows"
      ForEach RMC_Handle()
        Debug "RMC-Handle = "+Str(RMC_Handle())
      Next
    Else
      Debug "No RMC-Windows found"
    EndIf

Re: RMChart UserLib V4.12 for PB4.30

Posted: Mon Apr 05, 2010 9:29 pm
by ABBKlaus
Update : RMChart version 1.01 for PureBasic 4.5x x86

Regards Klaus

Re: RMChart UserLib V4.12

Posted: Fri May 20, 2011 11:52 pm
by IdeasVacuum
Playing with the ContainerGadget-in-PanelGadget example, I replaced the Container with a ScrollAreaGadget. Chart looks fine until a scroll bar is used, whereupon it becomes completely scrambled. So, I plonked RMC_Draw(#ID_CHART) on case of the ScrollArea being the EventGadget. This isn't a great idea though as it's easy to lock-up trying to scroll. Also, let's say you have scrolled all the way to the bottom right - the redraw takes you back to top left!

Code: Select all

;XIncludeFile "RMChart.pbi"
;RMC_Init()

#ID_WINDOW = 1
#ID_CHART  = 1
#ID_REGION = 1
#ID_CONT1  = 1
#ID_PANEL1 = 2

Procedure MyCallback(hWnd, CBMSG, CBWPARAM, CBLPARAM)
  Protected *TINFO.RMC_INFO
  Protected CBCTL.w,CBCTLMSG.w
  Protected Text$
  Static z.l
 
  CBCTL = PeekW(@CBWPARAM+0)
  CBCTLMSG = PeekW(@CBWPARAM+2)
 
  Select CBMSG
    Case #WM_RBUTTONDOWN  ; right mouse button was clicked
      ; CBLPARAM holds always the X/Y-position within the dialog,
      ; even you've clicked onto the chart
      Text$="X-Pos in the dialog:"+Str(PeekW(@CBLPARAM+0))+Chr(13)
      Text$+"Y-Pos in the dialog:"+Str(PeekW(@CBLPARAM+2))
      MessageRequester("RMChart",Text$,0)
    Case #WM_COMMAND
      Select CBCTL
        Case #ID_CHART                     ;message from the chart control
          Select CBCTLMSG                  ;identify the message
            Case #RMC_LBUTTONDOWN          ;left mouse button
              z = 1                        ;set flag for left mouse button pressed
            Case #RMC_LBUTTONUP
              z = 0                        ;reset the flag for left mouse button pressed
            Case #RMC_CTRLRBUTTONDOWN      ;Ctrl and right mouse button
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              Text$="X-Pos in the chart:"+Str(*TINFO\nXPos)+Chr(13)
              Text$+"Y-Pos in the chart:"+Str(*TINFO\nYPos)
              MessageRequester("RMChart",Text$,0)
            Case #RMC_MOUSEMOVE            ;mouse was moved in the chart control
              Debug "#RMC_MOUSEMOVE"
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              If z                         ;if the left mouse button is pressed
                ;move the chart control within your dialog
                RMC_SetCtrlPos(#ID_CHART,*TINFO\nXMove,*TINFO\nYMove,1)
              EndIf
          EndSelect
      EndSelect
  EndSelect
 
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

Procedure PBMain()
  If OpenWindow(#ID_WINDOW, 0, 0, 800, 600, "RMCHART.DLL", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)

           PanelGadget(#ID_PANEL1,0,0,800,600)
        AddGadgetItem (#ID_PANEL1, -1, "Panel 1")
        ScrollAreaGadget(#ID_CONT1, 8, 8, 750, 550, 1200, 1200, 10, #PB_ScrollArea_Flat)
        CloseGadgetList()

    If RMC_CreateChart(GadgetID(#ID_CONT1), #ID_CHART, 10, 10, 1000, 1000) = #RMC_NO_ERROR
      RMC_AddRegion(#ID_CHART, 5, 5, -5, -5,"Test")
      RMC_AddGrid(#ID_CHART, #ID_REGION)
      RMC_AddXAxis(#ID_CHART, #ID_REGION, #RMC_XAXISBOTTOM)
      RMC_AddYAxis(#ID_CHART, #ID_REGION, #RMC_YAXISLEFT)
      RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
      RMC_SetCaptionBGColor(#ID_CHART,#ID_REGION,0)
      RMC_Draw(#ID_CHART)
    EndIf

;     If RMC_CreateChartFromFile(GadgetID(#ID_CONT1), #ID_CHART, 5, 5,#False,sChartDefinition) = #RMC_NO_ERROR
;           RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
;     EndIf
   
    SetWindowCallback(@MyCallback())
   
    Repeat
     Event=WaitWindowEvent()
     
     Select Event
       Case #PB_Event_Gadget
         ;Debug "Gadget "+Str(EventGadget())
         Select EventGadget()
                Case #ID_CONT1: RMC_Draw(#ID_CHART)
         EndSelect
     EndSelect
    Until Event=#PB_Event_CloseWindow
   
    CloseWindow(#ID_WINDOW)
   
  EndIf
EndProcedure

PBMain()

DataSection
LabX: Data.d 10,20,20,30,40,50,60,70,80,90
LabY: Data.d 10,20,30,30,30,40,90,65,80,10
EndDataSection
Has someone hit this issue before and found a solution? I was thinking that for the app I'm working on, the graph will not be dynamic so I could export it as an image and then load the image into an ImageGadget instead........

I noticed also that RMChart does not seem to be alive in the outside world any more - the website has 'gone' and many links to the download are broken. Has the author stopped development?

Re: RMChart UserLib V4.12

Posted: Sat May 21, 2011 7:33 am
by RASHAD
Hello Mate

Code: Select all

;XIncludeFile "RMChart.pbi"
;RMC_Init()

#ID_WINDOW = 1
#ID_CHART  = 1
#ID_REGION = 1
#ID_CONT1  = 1
#ID_PANEL1 = 2

Procedure MyCallback(hWnd, CBMSG, CBWPARAM, CBLPARAM)
  Protected *TINFO.RMC_INFO
  Protected CBCTL.w,CBCTLMSG.w
  Protected Text$
  Static z.l

  CBCTL = PeekW(@CBWPARAM+0)
  CBCTLMSG = PeekW(@CBWPARAM+2)

  Select CBMSG
    Case #WM_RBUTTONDOWN  ; right mouse button was clicked
      ; CBLPARAM holds always the X/Y-position within the dialog,
      ; even you've clicked onto the chart
      Text$="X-Pos in the dialog:"+Str(PeekW(@CBLPARAM+0))+Chr(13)
      Text$+"Y-Pos in the dialog:"+Str(PeekW(@CBLPARAM+2))
      MessageRequester("RMChart",Text$,0)
    Case #WM_COMMAND
      Select CBCTL
        Case #ID_CHART                     ;message from the chart control
          Select CBCTLMSG                  ;identify the message
            Case #RMC_LBUTTONDOWN          ;left mouse button
              z = 1                        ;set flag for left mouse button pressed
            Case #RMC_LBUTTONUP
              z = 0                        ;reset the flag for left mouse button pressed
            Case #RMC_CTRLRBUTTONDOWN      ;Ctrl and right mouse button
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              Text$="X-Pos in the chart:"+Str(*TINFO\nXPos)+Chr(13)
              Text$+"Y-Pos in the chart:"+Str(*TINFO\nYPos)
              MessageRequester("RMChart",Text$,0)
            Case #RMC_MOUSEMOVE            ;mouse was moved in the chart control
              Debug "#RMC_MOUSEMOVE"
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              If z                         ;if the left mouse button is pressed
                ;move the chart control within your dialog
                RMC_SetCtrlPos(#ID_CHART,*TINFO\nXMove,*TINFO\nYMove,1)
              EndIf
          EndSelect
      EndSelect
  EndSelect

  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

Procedure PBMain()
  If OpenWindow(#ID_WINDOW, 0, 0, 800, 600, "RMCHART.DLL", #PB_Window_SystemMenu|#PB_Window_SizeGadget| #PB_Window_MinimizeGadget|#PB_Window_TitleBar| #PB_Window_MaximizeGadget| #PB_Window_ScreenCentered)

        PanelGadget(#ID_PANEL1,0,0,800,600)
        AddGadgetItem (#ID_PANEL1, -1, "Panel 1")
        ScrollAreaGadget(#ID_CONT1, 8, 8, 750, 550, 1200, 1200, 10, #PB_ScrollArea_Flat)
        CreateImage(0,4,4)
        ImageGadget(10,0,0,1000,1000,ImageID(0))
        CloseGadgetList()
        CloseGadgetList()

    If RMC_CreateChart(GadgetID(#ID_CONT1), #ID_CHART, 10, 10, 1000, 1000) =  #RMC_NO_ERROR
      RMC_AddRegion(#ID_CHART, 5, 5, -5, -5,"Test")
      RMC_AddGrid(#ID_CHART, #ID_REGION)
      RMC_AddXAxis(#ID_CHART, #ID_REGION, #RMC_XAXISBOTTOM)
      RMC_AddYAxis(#ID_CHART, #ID_REGION, #RMC_YAXISLEFT)
      RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
      RMC_SetCaptionBGColor(#ID_CHART,#ID_REGION,0)
      RMC_Draw2Clipboard (#ID_CHART,RMC_BMP)
      FreeImage(0)
      GetClipboardImage(0)
      ClearClipboard()
      SetGadgetState(10,ImageID(0))
      
      ;RMC_Draw(#ID_CHART)
    EndIf

;     If RMC_CreateChartFromFile(GadgetID(#ID_CONT1), #ID_CHART, 5, 5,#False,sChartDefinition) = #RMC_NO_ERROR
;           RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
;     EndIf
   
    SetWindowCallback(@MyCallback())
   
    Repeat
     Event=WaitWindowEvent()     
     Select Event         
       Case #PB_Event_CloseWindow
         Quit = 1
         
       Case #PB_Event_Gadget
         ;Debug "Gadget "+Str(EventGadget())
         Select EventGadget()
           Case #ID_CONT1
             
         EndSelect
     EndSelect
    Until Quit = 1
   
    CloseWindow(#ID_WINDOW)
   
  EndIf
EndProcedure

PBMain()

DataSection
LabX: Data.d 10,20,20,30,40,50,60,70,80,90
LabY: Data.d 10,20,30,30,30,40,90,65,80,10
EndDataSection


Re: RMChart UserLib V4.12

Posted: Sat May 21, 2011 12:47 pm
by IdeasVacuum
Hi Rashad

Thanks for the code, I had already figured out that I could do it that way and it suites my requirements absolutely fine. RMChart is a very nice lib. I hope it's not going to disappear.

Re: RMChart UserLib V4.12

Posted: Sat May 21, 2011 4:28 pm
by RASHAD
@IdeasVacuum Hi :D
Sorry mate as usual I do not read carefully
Accept my apology

Next is a workable snippet using your code ( Windows Callback )

Code: Select all

;XIncludeFile "RMChart.pbi"
;RMC_Init()

#ID_WINDOW = 1
#ID_CHART  = 1
#ID_REGION = 1
#ID_CONT1  = 1
#ID_PANEL1 = 2


Procedure MyCallback(hWnd, CBMSG, CBWPARAM, CBLPARAM)
  Protected *TINFO.RMC_INFO
  Protected CBCTL.w,CBCTLMSG.w
  Protected Text$
  Static z.l

  CBCTL = PeekW(@CBWPARAM+0)
  CBCTLMSG = PeekW(@CBWPARAM+2)

  Select CBMSG
    Case #WM_RBUTTONDOWN  ; right mouse button was clicked
      ; CBLPARAM holds always the X/Y-position within the dialog,
      ; even you've clicked onto the chart
      Text$="X-Pos in the dialog:"+Str(PeekW(@CBLPARAM+0))+Chr(13)
      Text$+"Y-Pos in the dialog:"+Str(PeekW(@CBLPARAM+2))
      MessageRequester("RMChart",Text$,0)
    Case #WM_COMMAND
      Select CBCTL
        Case #ID_CHART                     ;message from the chart control
          Select CBCTLMSG                  ;identify the message
            ;Case #RMC_LBUTTONDOWN          ;left mouse button
              ;z = 1                        ;set flag for left mouse button pressed
            ;Case #RMC_LBUTTONUP
              ;z = 0                        ;reset the flag for left mouse button pressed
            Case #RMC_CTRLRBUTTONDOWN      ;Ctrl and right mouse button
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
              Text$="X-Pos in the chart:"+Str(*TINFO\nXPos)+Chr(13)
              Text$+"Y-Pos in the chart:"+Str(*TINFO\nYPos)
              MessageRequester("RMChart",Text$,0)
            Case #RMC_MOUSEMOVE            ;mouse was moved in the chart control
              Debug "#RMC_MOUSEMOVE"
              *TINFO = CBLPARAM            ;CBLPARAM holds a pointer to a tRMC_INFO structure
             ; If z                         ;if the left mouse button is pressed
                ;move the chart control within your dialog
                RMC_SetCtrlPos(#ID_CHART,*TINFO\nXMove,*TINFO\nYMove,0)
             ; EndIf
          EndSelect
      EndSelect
  EndSelect

  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

Procedure PBMain()
  If OpenWindow(#ID_WINDOW, 0, 0, 800, 600, "RMCHART.DLL", #PB_Window_SystemMenu|#PB_Window_SizeGadget| #PB_Window_MinimizeGadget|#PB_Window_TitleBar| #PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)

        PanelGadget(#ID_PANEL1,0,0,800,600)
        AddGadgetItem (#ID_PANEL1, -1, "Panel 1")        
        hWnd = ScrollAreaGadget(#ID_CONT1, 8, 8, 750, 550, 1200, 1200, 10, #PB_ScrollArea_Flat)
        chWnd = GetWindow_(hWnd,#GW_CHILD)
        CloseGadgetList()        
        CloseGadgetList()

    If RMC_CreateChart(chWnd, #ID_CHART, 10, 10, 1000, 1000) = #RMC_NO_ERROR
      RMC_AddRegion(#ID_CHART, 5, 5, -5, -5,"Test")
      RMC_AddGrid(#ID_CHART, #ID_REGION)
      RMC_AddXAxis(#ID_CHART, #ID_REGION, #RMC_XAXISBOTTOM)
      RMC_AddYAxis(#ID_CHART, #ID_REGION, #RMC_YAXISLEFT)
      RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
      RMC_SetCaptionBGColor(#ID_CHART,#ID_REGION,0)
      RMC_Draw(#ID_CHART)
    EndIf

;     If RMC_CreateChartFromFile(GadgetID(#ID_CONT1), #ID_CHART, 5, 5,#False,sChartDefinition) = #RMC_NO_ERROR
;           RMC_AddXYSeries(#ID_CHART, #ID_REGION, ?LabX, 10, ?LabY, 10, #Black, #RMC_XY_LINE, #RMC_LSTYLE_SPLINE,0,0,0,0)
;     EndIf
   
    SetWindowCallback(@MyCallback())
   
    Repeat
     Event=WaitWindowEvent()
     
     Select Event
       Case #PB_Event_Gadget
         ;Debug "Gadget "+Str(EventGadget())
         Select EventGadget()
                Case #ID_CONT1
         EndSelect
     EndSelect
    Until Event=#PB_Event_CloseWindow
   
    CloseWindow(#ID_WINDOW)
   
  EndIf
EndProcedure

PBMain()

DataSection
LabX: Data.d 10,20,20,30,40,50,60,70,80,90
LabY: Data.d 10,20,30,30,30,40,90,65,80,10
EndDataSection
Edit :Code improved

Re: RMChart UserLib V4.12

Posted: Sat May 21, 2011 10:09 pm
by IdeasVacuum
...That's another top-notch Rashad solution! The comments are much appreciated too, easy to follow. I'm sure a lot of people will be delighted when they need to use this lib and discover your code Rashad, thank you for taking the time to do it.