RMChart UserLib V4.12

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

RMChart UserLib V4.12

Post 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
Last edited by ABBKlaus on Tue Apr 06, 2010 11:28 am, edited 5 times in total.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Looks very nice Klaus. Thank you very much.
I may look like a mule, but I'm not a complete ass.
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Post 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.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

Now also added to the DLL and UserLibs sections on www.PureArea.net :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Amundo
Enthusiast
Enthusiast
Posts: 200
Joined: Thu Feb 16, 2006 1:41 am
Location: New Zealand

Post by Amundo »

Thanks ABBKlaus!


And thanks as well, Andre.
Win10, PB6.x, okayish CPU, onboard video card, fuzzy monitor (or is that my eyesight?)
"When the facts change, I change my mind" - John Maynard Keynes
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post 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
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Yetta great release!

Thanks ABBKlaus.




@Baldrick

When I saw this guess what sprang to mind? :D
Dare2 cut down to size
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Post 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: )
BriceManuel
Enthusiast
Enthusiast
Posts: 195
Joined: Thu Nov 29, 2007 8:23 am

Post by BriceManuel »

This is the most impressive user contribution since eGrid :!:
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Post 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 
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Thanks Baldrick, i have added some known problems to the first post.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post 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.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post 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
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post 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!
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post 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.
Post Reply