Highlighted
Absent Member.
Absent Member.
460 views

[archive] Excel Create A Chart

[Migrated content. Thread originally posted on 17 February 2005]

I am having problems creating a chart in excel. Do you have a sample program that creates a chart?

Here is the vb code. I am having problems translating it into cobol code.

Charts.Add
ActiveChart.ChartType = x13DColumnStacked
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A2:B12"), PlotBy:=x1Columns
ActiveChart.Location Where:=x1LocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "My Title"
.Axes(x1Category).HasTitle = False
.Axes(x1Series).HasTitle = False
.Axes(x1Value).HasTitle = False
End With


Thank you in advance for your help.
Patty
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel Create A Chart

Not exactly your example, but here is an example of how to make a chart, missing some stuff, but got the core.


       WORKING-STORAGE              SECTION.
       77  oXL                      HANDLE OF Application.
       77  oBook                    HANDLE OF Workbook.
       77  oSheet                   HANDLE OF Worksheet.
       77  oChartObjects            HANDLE OF ChartObjects.
       77  oChartObject             HANDLE OF ChartObject.
       77  oChart                   HANDLE OF Chart.
       77  oRange                   HANDLE OF Range.

       01  MyTable.
           03 FILLER                OCCURS 10.
              05 MyItem             USAGE HANDLE OF VARIANT OCCURS 2.

       77  I                        PIC 9(3).
       77  J                        PIC 9(3).
       77  MyData                   PIC X(80).
       01  RND-VALUE                PIC 9(12)V9(5).

       PROCEDURE DIVISION.
       Main.
           PERFORM GEN-TABLE.
           CREATE  Application      OF Excel
                   HANDLE           IN oXL.
      *This is for training purposes only. If you don't want to see
      *Excel, remove this line.
           MODIFY  oXL              @Visible = 1.
           MODIFY  oXL              Workbooks::Add()
                   GIVING           oBook.
           INQUIRE oBook            Worksheets::Item(1) IN
                   oSheet.
           MODIFY  oSheet
                   Range("A1")::Resize(10 , 2)::Value =
                   MyTable.
           MODIFY  oSheet           ChartObjects()
                   GIVING           oChartObjects.
           MODIFY  oChartObjects    @Add(100, 100, 300, 200)
                   GIVING           oChartObject.
           INQUIRE oChartObject     Chart IN oChart.
           INQUIRE oSheet           Range("A1")::Resize(10 , 2) IN
                   oRange.
           MODIFY  oChart           SetSourceData(
                   BY NAME          Source = oRange).

           DESTROY oRange.
           DESTROY oChart.
           DESTROY oChartObject.
           DESTROY oChartObjects.
           DESTROY oSheet.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.