Page 1 of 3

RMChart UserLib V4.12

Posted: Mon Feb 11, 2008 7:43 pm
by ABBKlaus
RMChart is a simple to use and really lightweight developer tool to create a various range of modern looking business charts - and it's freeware.
Current Version : V1.01

Download : http://www.purebasicpower.de/?RMChart

RMChart : http://www.rmchart.com

Know problems :
- CloseWindow() should be called before program ends
- with enabled tooltips for datapoints the RMC_INFO structure in the callback will be empty
Image

Posted: Mon Feb 11, 2008 8:49 pm
by srod
Looks very nice Klaus. Thank you very much.

Posted: Mon Feb 11, 2008 9:51 pm
by Baldrick
I have a little project I made a few months back & haven't yet gotten around to releasing. I am atm using ".csv" for export to spreadsheets so people can make up whatever charts they want, but this looks like it may be that I need to add a few more charts to my program as a standard feature. I will have a serious play with this.

Posted: Wed Feb 13, 2008 8:34 pm
by Andre
Now also added to the DLL and UserLibs sections on www.PureArea.net :D

Posted: Thu Feb 14, 2008 6:17 am
by Amundo
Thanks ABBKlaus!


And thanks as well, Andre.

Posted: Thu Feb 14, 2008 12:32 pm
by ABBKlaus
Andre wrote:Now also added to the DLL and UserLibs sections on www.PureArea.net :D
Thanks, you´re doing a great job there :D

Posted: Thu Feb 14, 2008 12:40 pm
by Dare
Yetta great release!

Thanks ABBKlaus.




@Baldrick

When I saw this guess what sprang to mind? :D

Posted: Thu Feb 14, 2008 12:59 pm
by Baldrick
Dare wrote:@Baldrick

When I saw this guess what sprang to mind?
Yep, you are spot on. :D
It's just that I am up to my neck in another app atm which I want to get running asap priority. ( That company I walked away from a few months ago I now hear rumours that they are in trouble with qualified personell as the last 2 "qualified" guys have just walked on them a few weeks back, so kinda wanna be ready to do it my way if they willing to swallow their pride & call me.. :twisted: )

Posted: Thu Feb 14, 2008 3:06 pm
by BriceManuel
This is the most impressive user contribution since eGrid :!:

Posted: Thu Feb 21, 2008 9:13 am
by Baldrick
Great Lib, I did have a small problem with it this afternoon when it kept crashing on me. This was because of the simplest tiniest little thing: You MUST call a CloseWindow(#Win) prior to ending, else it will simply lock up.
Had me buggered for quite a while this afternoon trying to work this simple thing out... :oops:

Code: Select all

   #Title="Test" 
   #Flags_Main=#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered 
   #Width=650 
   #Height=580 

Enumeration 
   #Window_0 
EndEnumeration 

Enumeration 1
   #Chart_1 
EndEnumeration 

Enumeration 1
   #Region_1  
EndEnumeration 

Procedure Make_Chart_1() 
   If RMC_CreateChart(WindowID(#Window_0),#Chart_1,10,10,#width-20,#Height-20,9935799)=#RMC_NO_ERROR 
    If RMC_AddRegion(#Chart_1,10,10,-5,-5)=#RMC_NO_ERROR  
     If RMC_AddGrid(#Chart_1,1,16711808,1)=#RMC_NO_ERROR   
      RMC_Draw(#Chart_1) 
      ProcedureReturn 1 
     EndIf 
    EndIf 
   EndIf  
EndProcedure 

Procedure Open_WindowMain() 
   If OpenWindow(#Window_0,0,0,#Width,#Height,#Title,#Flags_Main) 
    If Make_Chart_1() 
     ProcedureReturn 1 
    EndIf 
   EndIf 
EndProcedure 

   If Open_WindowMain()=0  
    End 
   EndIf 
   
   Repeat 
    Ev.l=WaitWindowEvent() 
     If Ev=#PB_Event_CloseWindow 
      Select EventWindow() 
       Case #Window_0 
        Quit.l=1 
      EndSelect 
     EndIf 
   Until Quit 
   ;End ;uncomment this & program will crash 
   CloseWindow(#Window_0) ; comment this out & program will crash 

Posted: Thu Feb 21, 2008 3:11 pm
by ABBKlaus
Thanks Baldrick, i have added some known problems to the first post.

Posted: Fri Feb 22, 2008 9:05 pm
by Xombie
Howdy,

What about when you nest a chart within a container gadget and then a panel gadget? I seem to lose events when I do that. The WM_COMMAND check doesn't work.

Posted: Fri Feb 22, 2008 11:37 pm
by ABBKlaus
Xombie wrote:What about when you nest a chart within a container gadget and then a panel gadget? I seem to lose events when I do that. The WM_COMMAND check doesn't work.
Did you tried the other way around ?
First create the panelgadget and then the containergadget :

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))
      PanelGadget(#ID_PANEL1,0,0,800,600)
        AddGadgetItem (#ID_PANEL1, -1, "Panel 1")
        ContainerGadget(#ID_CONT1, 8, 8, 800-24, 600-40, #PB_Container_Raised)
        CloseGadgetList()
    EndIf
    If RMC_CreateChart(GadgetID(#ID_CONT1), #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

Posted: Fri Feb 22, 2008 11:49 pm
by Xombie
Thanks for the quick reply!

Unfortunately, this is just a part of a much larger program so doing it this way wouldn't work well in my situation.

What's the issue in this situation? Or, I mean, what causes the problem? Why does a container work in a panel gadget but not a panel gadget in a container? Knowing that will help me create a work-around. I'm thinking at the moment that I will probably have to just go without one or the other or may even both and just do a mass hide/show rather than relying on the container/panel to show and hide everything.

In fact... I think someone had some grouping code around here... (goes off to hunt)

Thanks again!

Posted: Sat Feb 23, 2008 12:09 am
by ABBKlaus
Xombie wrote:Why does a container work in a panel gadget but not a panel gadget in a container?
Do you have some sample code that shows your problem.