Visual Lansa Charting

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
DaveH
Posts: 10
Joined: Tue May 17, 2016 1:35 am

Visual Lansa Charting

Post by DaveH » Fri Aug 11, 2017 3:57 am

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
Attachments
WC Chart.PNG
WC Chart.PNG (12.04 KiB) Viewed 1903 times

MarkDale
Posts: 102
Joined: Wed Dec 02, 2015 10:06 am

Re: Visual Lansa Charting

Post by MarkDale » Fri Aug 11, 2017 9:07 am

Hi Dave - Is this a VLF-WIN or VLF-WEB application? (V13SP2)

DaveH
Posts: 10
Joined: Tue May 17, 2016 1:35 am

Re: Visual Lansa Charting

Post by DaveH » Fri Aug 11, 2017 11:30 pm

This is a VLF_WIN

MarkDale
Posts: 102
Joined: Wed Dec 02, 2015 10:06 am

Re: Visual Lansa Charting

Post by MarkDale » Tue Aug 15, 2017 10:57 am

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 97 times



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

DaveH
Posts: 10
Joined: Tue May 17, 2016 1:35 am

Re: Visual Lansa Charting

Post by DaveH » Wed Aug 16, 2017 7:20 am

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

MarkDale
Posts: 102
Joined: Wed Dec 02, 2015 10:06 am

Re: Visual Lansa Charting

Post by MarkDale » Wed Aug 16, 2017 8:03 am

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

Post Reply