Page 1 of 1

Visual Lansa Charting

Posted: Fri Aug 11, 2017 3:57 am
by DaveH
I am currently on Lansa V13SP2. I am looking at creating a gantt/bar chart within out visual lansa framework. I have attached an example out a pieces of software not all users have access to. The goal is to get this in visual lansa for all users.

I was thinking of google charts, not sure if it would work within visual lansa.

Any suggestions/examples would be greate

Thanks

Re: Visual Lansa Charting

Posted: Fri Aug 11, 2017 9:07 am
by MarkDale
Hi Dave - Is this a VLF-WIN or VLF-WEB application? (V13SP2)

Re: Visual Lansa Charting

Posted: Fri Aug 11, 2017 11:30 pm
by DaveH
This is a VLF_WIN

Re: Visual Lansa Charting

Posted: Tue Aug 15, 2017 10:57 am
by MarkDale
Hi,

I don't have an example but I think I can sketch out how it can be done.

Say you wanted to show one of these examples
https://developers.google.com/chart/int ... ganttchart

If you copy the html for example 2 on the website and save it as a html file in your Temp directory, then your visual lansa program can show that html either within an ActiveX or by starting a browser and pointing the browser at the url. (See attached example)

ActiveX
#tgt_file := *Temp_Dir + GanntChart2_with_Metatag.htm
#DF_WEBAC.Navigate Url(#tgt_file)

In a browser
#tgt_file := *Temp_Dir + GanntChart2_with_Metatag.htm
Use Builtin(SYSTEM_COMMAND) With_Args(H #tgt_file) To_Get(#VF_ELNUM)

You do have to make one tiny change to the Html to allow it to be shown within the ActiveX (to tell the ActiveX to use the browser's latest features rather than IE7). Make the html like this:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

The html file contains the data to be displayed. So your visual lansa program could write your own version of that html file to the user's temp directory, complete with the Gannt chart data that you want to show. I have included a routine that shows how to write out data using the STM_FILE built in function.
TST_X240 and Html.zip
(13.22 KiB) Downloaded 102 times



Screenshot.PNG
Screenshot.PNG (52.18 KiB) Viewed 2001 times

Re: Visual Lansa Charting

Posted: Wed Aug 16, 2017 7:20 am
by DaveH
You mentioned to have Lansa create an HTML file in the users temp folder. I cannot seem to find any documentation on how visual Lansa could create the HTML file to a temp folder. Do you have an example by chance

Thanks

Re: Visual Lansa Charting

Posted: Wed Aug 16, 2017 8:03 am
by MarkDale
Its in the example form I gave you - its this routine:

Mthroutine Name(HowtoWriteAHtmlFile)
Define_Com Class(#prim_alph) Name(#tgt_file)
Define_Com Class(#prim_alph) Name(#uLine)

Define Field(#FILENO) Type(*DEC) Length(3) Decimals(0) Desc('Allocated file number')
Define Field(#OPTIONS) Type(*CHAR) Length(256) Desc('Options for stream file open')
Define Field(#RETC) Type(*Char) Length(2) Desc('Return Code')

#tgt_file := *Temp_Dir + GanntChart2_with_Metatag.htm
#OPTIONS := '''Write'''

Use Builtin(STM_FILE_OPEN) With_Args(#tgt_file #OPTIONS) To_Get(#FILENO #RETC)
If (#RETC = OK)

* Write out the lines of the html file (including the data)
Use Builtin(STM_FILE_WRITE) With_Args(#FILENO #uLine) To_Get(#RETC)

Endif
Use Builtin(STM_FILE_CLOSE) With_Args(#FILENO)

Endroutine