Highlighted
Absent Member.
Absent Member.
6625 views

[archive] MSChart Question

[Migrated content. Thread originally posted on 20 February 2004]

We are using the Microsoft Chart Control 6.0 Active-X control to display a pie chart of values. The chart works great and our values are displayed in the graphical form correctly. Our problem is that we want to also show the numeric values for each slice of the pie.

We have tried to use the Microsoft Office Chart 10.0 control but can't see to figure out how to plug data into the columns that we created. This control will show the values but we can't make our cobol program load the data sheet.

Any help on either of these will be appreciated.

Thanks
0 Likes
18 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

Always a benefit and encouraging for brainstorming to have some very small sample code for a starter...
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

I am not sure what your response is supposted to tell me??? This process is a small process that simply reads a file and puts the data totals into working storage values. Then the WS variables are being shown on a graph. The process is very simple it is the displaying of the graphs that are cause for our concern. If you have any experience with the two graphs please let me know.

Thanks
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

I have created charts before. Do you have a small code sample so we can see what direction you are taking?

Rob
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

Rob thanks for the reply.

Basically we are putting data into a fields and displaying them on a graph. The process is working great, it is the display of the graph that we are having questions about.

As I said in one graph we would like to see totals on the pie chart and can't get them to appear. On the other we just need to know how to populate the graph with our data (it works great with data manually entered).

Thanks for any help.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

Originally posted by kwt10
I am not sure what your response is supposted to tell me???


Post some code.
I assume that you can provide some code that illustrates your problem?
You don't need to send along databases and stuff, just use some static values.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

Sorry for the misunderstanding that I got from you email. I read it wrong and misspoke in my response.

This is an example of us trying to put numbers into the CHARTSPACE chart:

MODIFY Graph-1, SetData(1,1,WS-D-1).
MODIFY Graph-1, SetData(1,2,WS-D-2).
MODIFY Graph-1, SetData(1,3,WS-D-3).
MODIFY Graph-1, SetData(1,4,WS-D-4).
MODIFY Graph-1, SetData(1,5,WS-D-5).
MODIFY Graph-1, SetData(1,6,WS-D-6).
MODIFY Graph-1, SetData(1,7,WS-D-7).
MODIFY Graph-1, SetData(1,8,WS-D-8).
MODIFY Graph-1, SetData(1,9,WS-D-9).
MODIFY Graph-1, SetData(1,10,WS-D-10).
MODIFY Graph-1, SetData(1,11,WS-D-11).
MODIFY Graph-1, SetData(1,12,WS-D-12).

[WS-D-# is a working storage variable that we use to fill in data]

I really don't know how to put code in for the other chart. We get the data into the chart and it is displayed. The only problem that we are having with it is showing the chart values on screen when the chart is drawn.

Hope this helps.

Thanks
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

I am not quite sure what you want to accomplish, and a quick search did not unveil any sample code on the SetData method either. However, here is an example of how to populate the MS Chart control, is that good for any?


       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  MSCHART-DEMO.
       AUTHOR.                      Cheesle.
       REMARKS.

       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
       COPY "MSCHART.DEF".
                .
       WORKING-STORAGE              SECTION.
       77 WsTitle                   PIC X(20) VALUE "MS Chart Demo".

       SCREEN                       SECTION.
       01 ChartForm.

           03 MSChart1              MSCHART
              COL                   4
              LINE                  4
              LINES                 30
              SIZE                  40.

       PROCEDURE DIVISION.
       APP-MAIN-LOGIC.
           DISPLAY STANDARD         GRAPHICAL WINDOW
                   LINES            35
                   SIZE             45
                   BACKGROUND-LOW
                   TITLE            WsTitle.
           DISPLAY ChartForm.
           MODIFY  MSChart1
                   Charttype        = VtChChartType2dBar
                   RowCount         = 1
                   ColumnCount      = 5
                   RowLabel         = "Row label".

           MODIFY  MSChart1
                   @Row             = 1
                   @Column          = 1
                   @Data            = 100
                   @Column          = 2
                   @Data            = 200
                   @Column          = 3
                   @Data            = 300
                   @Column          = 4
                   @Data            = 400
                   @Column          = 5
                   @Data            = 500
           ACCEPT  OMITTED.
           STOP    RUN.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

gforseth, thanks for the sample program. It lets us know that what we have for the MSCHART is correct. As I said in my original post, we have the MSCHART working (except for displaying the totals on the chart). We are able to make the MSCHART take our data and display it correctly. When we showed it to our directors they wanted the totals for each Pie slice on the pie chart shown.

The CHARTSPACE chart is the one that we just can't figure out how to get data into. It seems to want to connect to a database and will not accept data inputed via the program. We don't have SQL data to put in the chart. That is what the code sample is from my last post. It is our latest attempt (stab in the dark) at getting data into the chart.

Thanks again.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

If you can find some example in visual basic, java, delphi or VC++, that accomplishes what you want, let us know and we might be able to work it out.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

Here is another example, now showing the legend:


       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  MSCHART-DEMO.
       AUTHOR.                      Cheesle.
       REMARKS.

       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
       COPY "MSCHART.DEF".
                .
       WORKING-STORAGE              SECTION.
       77  CNTL-FONT                USAGE HANDLE OF FONT SMALL-FONT.

       SCREEN                       SECTION.

       01 CHART-FORM.
           03 CheeseChart           MSCHART
              COL                   10
              LINE                  5
              LINES                 30
              SIZE                  40
              Visible               0.

       PROCEDURE DIVISION.
       ACU-MAIN-LOGIC.
           DISPLAY STANDARD         GRAPHICAL WINDOW
                   LINES            30
                   SIZE             50
                   BACKGROUND-LOW
                   CONTROL FONT     CNTL-FONT
                   TITLE            "Pie Chart demo".
           DISPLAY CHART-FORM.
           MODIFY  CheeseChart
                   DataGrid::RowLabelCount = 1
                   DataGrid::ColumnCount = 3
                   DataGrid::RowCount = 1
                   ChartType        = VtChChartType2dPie.
           MODIFY  CheeseChart
                   Row              = 1
                   @Column          = 1
                   @Data            = 100.
           MODIFY  CheeseChart
                   Row              = 1
                   @Column          = 2
                   @Data            = 100.
           MODIFY  CheeseChart
                   Row              = 1
                   @Column          = 3
                   @Data            = 100.

           MODIFY  CheeseChart
                   DataGrid::ColumnLabel(1, 1, "Slice 1")
                   DataGrid::ColumnLabel(2, 1, "Slice 2")
                   DataGrid::ColumnLabel(3, 1, "Slice 3")
                   DataGrid::RowLabel(1, 1, "The Row label")
                   ShowLegend = 1
                   Visible  = 1.

           ACCEPT  OMITTED.
           EXIT    PROGRAM
           STOP    RUN
           .

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] MSChart Question

Here is even one more example. This one does in addition to the previous, provide legends in percents per slice.

       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  Chart2.
       AUTHOR.                      Cheesle.
       REMARKS.

       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
       COPY "MSCHART.DEF".
                .
       WORKING-STORAGE              SECTION.
       77  CNTL-FONT                USAGE HANDLE OF FONT SMALL-FONT.
       77  hDataPoints              USAGE HANDLE OF DataPoints.
       77  WS-I                     PIC 9(1).
       77  WS-A                     PIC 9(9).

       SCREEN                       SECTION.

       01 CHART-FORM.
           03 CheeseChart           MSCHART
              COL                   5
              LINE                  2
              LINES                 30
              SIZE                  50
              Visible               0
              LICENSE-KEY "8E147C69-BD50-11d1-B137-0000F8753F5D".

       PROCEDURE DIVISION.
       ACU-MAIN-LOGIC.
           DISPLAY STANDARD         GRAPHICAL WINDOW
                   LINES            30
                   SIZE             50
                   BACKGROUND-LOW
                   CONTROL FONT     CNTL-FONT
                   TITLE            "Pie Chart demo".
           DISPLAY CHART-FORM.
           MODIFY  CheeseChart      Datagrid::SetSize(1, 3, 1, 3)
                   ChartType        = VtChChartType2dPie.
           PERFORM VARYING          WS-I FROM 1 BY 1 UNTIL WS-I > 3
                   MULTIPLY WS-I BY 100 GIVING WS-A
                   MODIFY           CheeseChart
                                    @Row    = 1
                                    @Column = WS-I
                                    @Data   = WS-A
                   END-PERFORM.
           MODIFY  CheeseChart
                   DataGrid::ColumnLabel(1, 1, "Slice 1")
                   DataGrid::ColumnLabel(2, 1, "Slice 2")
                   DataGrid::ColumnLabel(3, 1, "Slice 3")
                   DataGrid::RowLabel(1, 1, "The Row label").

           MODIFY  CheeseChart
                   Plot::SeriesCollection::Count()
                   GIVING           WS-I.
           PERFORM UNTIL            WS-I = 0
                   INQUIRE          CheeseChart
                    Plot::SeriesCollection::Item(WS-I)::DataPoints IN
                    hDataPoints
                   USE              hDataPoints Item(-1)
                                    MODIFY
                                     ^DataPointLabel::LocationType =
                                      VtChLabelLocationTypeOutside
                                     ^DataPointLabel::Component =
                                      VtChLabelComponentPercent
                                     ^DataPointLabel::PercentFormat =
                                      "0%"
                                     ^DataPointLabel::VtFont::Size = 10
                                     END-USE
                   SUBTRACT         1 FROM WS-I
                   END-PERFORM.

           MODIFY  CheeseChart
                   ShowLegend = 1
                   Visible  = 1.

           ACCEPT  OMITTED.
           EXIT    PROGRAM
           STOP    RUN
           .

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.