Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Aug 22, 2021 7:38:51 GMT -5
Hi Does anyone know of a charting/graphing module for LB? I need to be able to print Gantt charts, Work Breakdown Structures, and other barcharts from within an LB program. The module can either be integrated as part of the code or "run" exterrnally from data in some sort of a file. I used to be able to do this from within QBasic and EBasic using a .dll developed by a developer. The developer has informed me that the .dll is no longer available or supported. I have successfully ported my Project Management program to LB from other BASICs and this is all that I now need to complete the conversion. The program is used by students studying the subject. I tried to attach examples but ProBoards rejected them. If you Google "Gantt Charts" and "Work Breakdown Structures" you should get an idea of what I am looking looking to produce. The Gannt Chart does not need the overaching (black) bars nor the connecting links shown in the examples. Any help will be appreciated. Attachments:
|
|
|
Post by Rod on Aug 22, 2021 10:36:46 GMT -5
Creating that output is relatively easy. But the other charts you mention make the piece of string too long. You would need to beef up the definition of the charting to get real coding examples back.
What specific charts, what parameter choices and what range size limitations?
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Aug 22, 2021 13:59:20 GMT -5
Thanks Rod
Most important at this point is the Gantt chart such as the example shown,
The program has a limit of 100 activities so a maximum of 100 bars or lines. The calendar dates at the top of the page can be up to about 3 to 5 years i.e., about 1200 to 2000 days so multiple pages.
I am busy researching report writers.
The problem I have is controlling the printer (default Windows printer). Modern printers no longer have the old "esc" codes to manage them.
i am using the print dll off Alice's site to switch between orientation (portrait, landscape). I agree, the other charts/graphs would not be too easy to produce. The Gantt however should be doable...
|
|
|
Post by Brandon Parker on Aug 22, 2021 14:01:32 GMT -5
Do you have the DLL and documentation that you used to use?
{:0)
Brandon Parker
|
|
|
Post by tsh73 on Aug 22, 2021 14:02:28 GMT -5
Give us some examples - what data in, what picture out If you already used existing DLL, ins/outs already thought out, it could speed up things. Explain them and here at forum we might code a solution in LB.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Aug 22, 2021 14:33:02 GMT -5
Thanks everybody for responding!!
The dll I used was ddoc which was specifically built for ebasic and the documentation no longer exists. I contacted the author who says that he threw everything away years ago. I used the ddoc dll to control the printer (spacing, special print chars, etc.) and to print specific reports. The problem is not with the logic but with printing the special characters and changing colours. Once I have sorted that out, I am sure that I could code something to print the Gantt chart. DDOC had specific functions to print Gantt charts, Pie Charts, Line Charts, Bar Graphs, etc. You sent it data in an array, some parameters, selected a function, and it did it. the .dll does not seem to work under Win 10 and ebasic is now obsolete hence the conversion to LB.
A Gantt chart is specific to project management. It shows activity info down the left-hand side and calendar dates across the top. It then shows bars to indicate where in time each activity is executed (fromdate to date). Different colours are used to indicate critical and non-critical activities and float. There is an example in my original post
|
|
|
Post by Brandon Parker on Aug 22, 2021 14:51:22 GMT -5
If you have the DLL and have examples in another basic then we might be able to convert the examples to LB.
Otherwise, creating a gantt chart using a Liberty BASIC GraphicBox would be fairly easy. Having example data you are looking at using will help those willing to put in the time to build something for you.
{:0)
Brandon Parker
|
|
|
Post by tsh73 on Aug 22, 2021 15:03:34 GMT -5
Well, I made something. Could be used as a base, probably. (moving a mouse shows corresponding date) 'attempt at Gant chart (tsh73, Aug 2021) maxN=100 dim dt(maxN,2)
N=0 while 1 read ttl$, dtStrt$, dtEnd$ if ttl$="XYZZY" then exit while print ttl$ dt1=date$(dtStrt$) dt2=date$(dtEnd$) print weekDay$(dt1),dtStrt$, date$(dt1) print weekDay$(dt2),dtEnd$, date$(dt2) realDays =dt2-dt1+1 wrkDays=realDays-numWeekEnds(dt1, dt2) print , wrkDays, realDays N=N+1 dt(N,1)=dt1 dt(N,2)=dt2 wend
open "Gantt chart 0.01" for graphics_nsb_nf as #gr #gr "down; home; posxy cx cy" #gr "trapclose [quit]"
days=dt(N,2)-dt(1,1)+1 dayW=int(2*cx/days) dayH=int(2*cx/2/N)
d0=dt(1,1) for i = 1 to N #gr "place ";(dt(i,1)-d0)*dayW;" ";(2*i)*dayH #gr "box ";(dt(i,2)-d0+1)*dayW;" ";(2*i+1)*dayH next
#gr "flush" #gr "when mouseMove [mov]"
wait
[mov] x=MouseX d=int(x/dayW)+d0 #gr "place 0 0" #gr "\\";date$(d) wait
[quit] close #gr end
function weekDay(day) '1 is Mon, 5 is Fri, >5 is weekEnds weekDay=(day+1)mod 7 +1 end function function weekDay$(day) weekDay$=word$("Mon Tue Wed Thr Fri Sat Sun", weekDay(day)) end function function numWeekEnds(dt1, dt2) for d = dt1 to dt2 numWeekEnds=numWeekEnds+(weekDay(d)>5) next end function
data "Design & testing", "7/23/12", "8/6/12" data "Result & analysys", "8/7/12", "8/13/12" data "Applications", "8/14/12", "8/28/12"
data "Purchasing", "8/29/12", "9/3/12" data "Model preparation", "9/4/12", "10/1/12" data "Design final testing", "10/2/12", "10/17/12"
data "Complete final report", "10/18/12", "10/24/12" data "Preparing for final report submission", "10/25/12", "10/26/12"
data "Prepare the material that use during presentation", "10/29/12", "10/29/12" data "XYZZY", "dummy", "dummy"
|
|
|
Post by colinmcm on Aug 22, 2021 16:52:24 GMT -5
LB_ddocDllPrintTrialDemo2.zip (76.08 KB)for what it is worth, Eldron Gill used doc.dll form liberty basic back in 2004, and posted a demo in newsletter 122. I have a zip file containing the demo. I have just run it under windows10 with no problems. It might help.
|
|
|
Post by Brandon Parker on Aug 22, 2021 17:04:04 GMT -5
Thanks colinmcm! Here is the link to the manual, but it appears that the DLL in the ZIP is most likely an older version because some functions in the documentation are not present in the DLL. www.greatwebdivide.com/ddoc_manual/{:0) Brandon Parker
|
|
|
Post by colinmcm on Aug 22, 2021 17:05:43 GMT -5
just to add, I see nothing on the screen when running (ie no print preview), but you can print to PDF, which may be a work-around. printing to paper seems OK. Like the pb program itself states, all the functions of DDoc.dll may not be supported.
|
|
|
Post by colinmcm on Aug 22, 2021 17:08:17 GMT -5
Very true Brandon, we are going back 17 years to Eldons work after all. It seems like yesterday.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Aug 23, 2021 2:10:35 GMT -5
Thanks Guys. I am going to play around with Anatoly's code. My code already has weekday routines etc....
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Aug 23, 2021 7:25:56 GMT -5
Hi Guys The plot thickens but it is becoming clearer I downloaded and unzipped the ddoc file pointed to by Colinmcm. It seems to be the core DDOC engine (.dll) with a demo program converted to LB. It is the same ddoc that I used under EBasic and I did the port to EBasic then for the developer of ddoc (Don Dikinson). The manual pointed to by Brandon is a subset of the manual that I have. The manual in my possession is 42 pages and is dated 1998. I contacted Don about 9 months ago about ddoc and he told me that he no longer supports it altough it is still offered on the Internet. I took a closer look at how I was using ddoc and it was to control the then "line printers" using control codes. The specialised reporting modules I used were provided by a ddoc wrapper which was the sort of forerunner of RPV reports. Checked again and found that RPV Reports is now a large company with a specialised report writer but unfortunately nobody recalls the wrapper or its existence. So back to square one. Anatoly's code helped me to better understand graphics in LB as I had not yet played with grapics in LB - thanks Anatoly! The code was easy to use to do a screen display but the problem of printing to a printer still remains. I will experiment with ddoc to see what capabilities it has under LB but I am loathe to use an unsupprted product. I am also going to look at the LB demo program "printform" to see if that has any answers. I think there is a gap for someone to develop a printer management module for LB. Such a module must allow for printing graphics to a printer and to control modern printers through the API or PCL. Thanks for everybody's help - much appreciated!!
|
|
|
Post by tenochtitlanuk on Aug 23, 2021 7:38:33 GMT -5
Are you aware of how easy it is to send a graphics LB window to a printer to fill the width of the paper? If not, we can point you to the many examples- no printer ESC codes needed on modern printers.
EDIT Not trying to teach old hands things they know already! But it is so easy to write/draw to a graphics window. An all-singing/all-dancing dll is great and clearly works, but all my code needing paper output is drawn to screen then printed by LB. I know Anatoly and I have talked of a general-purpose LB packkage- but I always end up doing directly coded LB, or use say GnuPlot. See eg page-printing text & QR code
|
|