[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.- Home
- Sitemap
- Product Forums
- Rocket COBOL
- RocketĀ® ACUCOBOL
- [archive] GANTT CHART or MS CHART
[archive] GANTT CHART or MS CHART
- August 17, 2007
- 9 replies
- 0 views
9 replies
- Author
- Rocketeer
- August 17, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.
Hope this helps, it uses the MS chart control.
This was the first thing I learned how to do after Gisle Forseth's advanced windows course in London and then its just been adapted further the more you're sort of forced into reading things. i.e the installing of the dll for example.
The program in question is a stock usage display and has a graph push button option which shows 3 years usage history of the product.
The code upon pressing the graph push button.
Screen1-Pb-Graph-Ex-Cmd-Clicked.
SET CONTROL-OK TO TRUE
PERFORM CHECK-DLL
IF CONTROL-NOT-OK
PERFORM TRY-INSTALLING
IF WS-RESULT = 0
PERFORM CHECK-DLL
IF CONTROL-OK
PERFORM REGISTER-DLL
ELSE
DISPLAY MESSAGE BOX
"The necessary control is not present on your machine"
EXIT PARAGRAPH
END-IF
ELSE
DISPLAY MESSAGE BOX
"The necessary control is not present on your machine"
EXIT PARAGRAPH
END-IF
END-IF
PERFORM Acu-Graph-Routine
MOVE 4 TO ACCEPT-CONTROL
MOVE 4 TO CONTROL-ID
.The rest of the code you might want to see.
If the control isn't present, we try to install it, even in thin client mode on a unix server we copy the dll to the client etc
*
CHECK-DLL.
IF IS-REMOTE
CALL "@[DISPLAY]:MSCHART.dll@WINAPI"
ON EXCEPTION
SET CONTROL-NOT-OK TO TRUE
NOT ON EXCEPTION
SET CONTROL-OK TO TRUE
CANCEL "@[DISPLAY]:MSCHART.dll"
END-CALL
ELSE
CALL "MSCHART.dll@WINAPI"
ON EXCEPTION
SET CONTROL-NOT-OK TO TRUE
NOT ON EXCEPTION
SET CONTROL-OK TO TRUE
CANCEL "MSCHART.dll"
END-CALL
END-IF
.
*
REGISTER-DLL.
IF IS-REMOTE
CALL "@[DISPLAY]:MSCHART.dll@WINAPI"
ON EXCEPTION
SET CONTROL-NOT-OK TO TRUE
NOT ON EXCEPTION
SET CONTROL-OK TO TRUE
CALL "@[DISPLAY]:DllRegisterServer" GIVING WS-STATUS
IF WS-STATUS = ZERO
SET CONTROL-OK TO TRUE
END-IF
CANCEL "@[DISPLAY]:MSCHART.dll"
END-CALL
ELSE
CALL "MSCHART.dll@WINAPI"
ON EXCEPTION
SET CONTROL-NOT-OK TO TRUE
NOT ON EXCEPTION
SET CONTROL-OK TO TRUE
CALL "DllRegisterServer" GIVING WS-STATUS
IF WS-STATUS = ZERO
SET CONTROL-OK TO TRUE
END-IF
CANCEL "MSCHART.dll"
END-CALL
END-IF
.
*
TRY-INSTALLING.
IF IS-REMOTE
CALL "@[DISPLAY]:KERNEL32.DLL@WINAPI"
ON EXCEPTION
EXIT PARAGRAPH
END-CALL
SET WS-SYS-DIR-SIZE TO SIZE OF WS-SYSTEM-DIRECTORY
CALL "@[DISPLAY]:GetSystemDirectoryA" USING
BY REFERENCE WS-SYSTEM-DIRECTORY
BY REFERENCE WS-SYS-DIR-SIZE
GIVING WS-SYS-DIR-SIZE
CANCEL "@[DISPLAY]:KERNEL32.dll"
ELSE
CALL "KERNEL32.DLL@WINAPI"
ON EXCEPTION
EXIT PARAGRAPH
END-CALL
SET WS-SYS-DIR-SIZE TO SIZE OF WS-SYSTEM-DIRECTORY
CALL "GetSystemDirectoryA" USING
BY REFERENCE WS-SYSTEM-DIRECTORY
BY REFERENCE WS-SYS-DIR-SIZE
GIVING WS-SYS-DIR-SIZE
CANCEL "KERNEL32.dll"
END-IF
ADD 1 TO WS-SYS-DIR-SIZE
MOVE "\\" TO WS-SYSTEM-DIRECTORY(WS-SYS-DIR-SIZE:1)
*
*Above routine calls windows api and gets actual system directory
*Below routine copies the DLL to the system directory
*
MOVE SPACES TO WS-DESTINATION
IF IS-REMOTE
STRING "@[DISPLAY]:" DELIMITED BY SIZE
WS-SYSTEM-DIRECTORY DELIMITED BY " "
"MSCHART.dll" DELIMITED BY SIZE
INTO WS-DESTINATION
END-STRING
IF OS-IS-UNIX
CALL "C$COPY" USING "/logic/add-ins/MSCHART.dll"
WS-DESTINATION
GIVING WS-RESULT
ELSE
CALL "C$COPY" USING "C:\\LOGIC\\ADD-INS\\MSCHART.DLL"
WS-DESTINATION
GIVING WS-RESULT
END-IF
ELSE
STRING WS-SYSTEM-DIRECTORY DELIMITED BY " "
"MSCHART.DLL" DELIMITED BY SIZE
INTO WS-DESTINATION
END-STRING
CALL "C$COPY" USING "C:\\LOGIC\\ADD-INS\\MSCHART.DLL"
WS-DESTINATION
GIVING WS-RESULT
END-IF
.
*
Graph-Aft-Initdata.
MODIFY SCR-CHART, @DataGrid::RowLabelCount = 1
@DataGrid::ColumnCount = 3
@DataGrid::RowCount = 1
@ChartType = VtChChartType2dBar
MODIFY SCR-CHART, @Row = 1
@Column = 1
@Data = WS-ISD-TOT(1)
@Row = 1
@Column = 2
@Data = WS-ISD-TOT(2)
@Row = 1
@Column = 3
@Data = WS-ISD-TOT(3)
MODIFY SCR-CHART,
@DataGrid::ColumnLabel(1, 1, "This Year")
@DataGrid::ColumnLabel(2, 1, "Last Year")
@DataGrid::ColumnLabel(3, 1, "Previous Year")
@DataGrid::RowLabel(1, 1, S-ISM-DESC)
@ShowLegend 1
VISIBLE TRUE
.
*
PIE-CHART-PB-Ex-Cmd-Clicked.
MODIFY PIE-CHART-PB, ENABLED FALSE
MODIFY SCR-CHART, @ChartType = VtChChartType2dPie
MODIFY SCR-CHART, Plot::SeriesCollection::Count()
GIVING WS-SLICE
PERFORM UNTIL WS-SLICE = 0
INQUIRE SCR-CHART
Plot::SeriesCollection::Item(WS-SLICE)::DataPoints IN
HDATAPOINTS
USE HDATAPOINTS Item(-1)
MODIFY ^DataPointLabel::LocationType =
VtChLabelLocationTypeOutside
^DataPointLabel::Component =
VtChLabelComponentPercent
^DataPointLabel::PercentFormat = "0%"
^DataPointLabel::VtFont::Size = 14
END-USE
SUBTRACT 1 FROM WS-SLICE
END-PERFORM
.The graph screen has another push button to switch from a bar to pie chart.
I could'nt figure out how to switch it back to bar chart again properly so just left it so that the user has to close the screen and pick it again.
I don't know if Gisle is doing another of these courses, but if he is then I'd definately book yourself a place.
But beware, its pretty head wrecking at first.
Shaun
1 Attachments
- Author
- Rocketeer
- August 22, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.- Author
- Rocketeer
- August 22, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.- Author
- Rocketeer
- August 22, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.- Author
- Rocketeer
- December 5, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.- Author
- Rocketeer
- December 6, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.- Author
- Rocketeer
- December 6, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.If the control really has no print method, a very viable alternative is to make screen shot of it. The W$BITMAP library routine has a subfunction to take a handle of a control and create a bitmap file of it. Then you can reload this bitmap file with W$BITMAP and print it.
- Author
- Rocketeer
- December 6, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.If the control really has no print method, a very viable alternative is to make screen shot of it. The W$BITMAP library routine has a subfunction to take a handle of a control and create a bitmap file of it. Then you can reload this bitmap file with W$BITMAP and print it.
- Author
- Rocketeer
- December 6, 2007
[Migrated content. Thread originally posted on 17 August 2007]
I am looking to incorporate some charts in our application. Is there anyone who would like to share a program that they have that produces a chart on the screen. I would appreciate looking at your code to get the syntax. Programming active x controls are not my strong points. Thanks.If the control really has no print method, a very viable alternative is to make screen shot of it. The W$BITMAP library routine has a subfunction to take a handle of a control and create a bitmap file of it. Then you can reload this bitmap file with W$BITMAP and print it.
Recent badge winners
Neil Morrishas earned the badge Consistent Trajectory
Kevin Hondhas earned the badge Orbit Established
Kevin Hondhas earned the badge Consistent Trajectory
OsmanShariffhas earned the badge Network Contributor
OsmanShariffhas earned the badge Orbit Established
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
OKThis file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.
OK