Formatting excel graph in Progress

Gurn

New Member
Hi,
i have created a graph in excel from a progress program but the actual graph appears has a stacked graph but what I require is a combination of a stacked graph and a line graph. I have created a macro in excel which resolves this problem but everytime i run my progress code I keeping getting the original graph.

The vb code for the excel macro is as follows

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).ChartType = xlLine
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).ChartType = xlLine
ActiveChart.SeriesCollection(5).Select
ActiveChart.SeriesCollection(5).ChartType = xlLine


Can anyone help convert the above code into Progress code so that I can hopefully use this code in my program to automatically alter my graph.

TIA

Gurnek.
 
(Assuming you have chSheet defined and pointing to the correct sheet.)
Code:
    DEFINE VARIABLE chChart AS COMPONENT-HANDLE NO-UNDO.
    DEFINE VARIABLE chCollection AS COMPONENT-HANDLE NO-UNDO.

    ASSIGN chChart = chSheet:CHARTOBJECTS("Chart 1")
           chCollection = chChart:SERIESCOLLECTION(2)
           chCollection:CHARTTYPE = 4
           chCollection = chChart:SERIESCOLLECTION(3)
           chCollection:CHARTTYPE = 4
           chCollection = chChart:SERIESCOLLECTION(5)
           chCollection:CHARTTYPE = 4.

    RELEASE OBJECT chCollection.
    RELEASE OBJECT chChart.

For reference, here is a conversion list of VB chart types

Code:
xl3DArea                        -4098
xl3DAreaStacked                    78
xl3DAreaStacked100                 79
xl3DBarClustered                   60
xl3DBarStacked                     61
xl3DBarStacked100                  62
xl3DColumn                      -4100
xl3DColumnClustered                54
xl3DColumnStacked                  55
xl3DColumnStacked100               56
xl3DLine                        -4101
xl3DPie                         -4102
xl3DPieExploded                    70
xlArea                              1
xlAreaStacked                      76
xlAreaStacked100                   77
xlBarClustered                     57
xlBarOfPie                         71
xlBarStacked                       58
xlBarStacked100                    59
xlBubble                           15
xlBubble3DEffect                   87
xlColumnClustered                  51
xlColumnStacked                    52
xlColumnStacked100                 53
xlCloneBarClustered               102
xlCloneBarStacked                 103
xlCloneBarStacked100              104
xlCloneCol                        105
xlCloneColClustered                99
xlCloneColStacked                 100
xlCloneColStacked100              101
xlCylinderBarClustered             95
xlCylinderBarStacked               96
xlCylinderBarStacked100            97
xlCylinderCol                      98
xlCylinderColClustered             92
xlCylinderColStacked               93
xlCylinderColStacked100            94
xlDoughnut                      -4120
xlDoughnutExploded                 80
xlLine                              4
xlLineMarkers                      65
xlLineMarkersStacked               66
xlLineMarkersStacked100            67
xlLineStacked                      63
xlLineStacked100                   64
xlPie                               5
xlPieExploded                      69
xlPieOfPie                         68
xlPyramidBarClustered             109
xlPyramidBarStacked               110
xlPyramidBarStacked100            111
xlPyramidCol                      112
xlPyramidColClustered             106
xlPyramidColStacked               107
xlPyramidColStacked100            108
xlRadar                         -4151
xlRadarFilled                      82
xlRadarMarkers                     81
xlStockHLC                         88
xlStockOHLC                        89
xlStockVHLC                        90
xlStockVOHLC                       91
xlSurface                          83
xlSurfaceTopView                   85
xlSurfaceTopViewWireframe          86
xlSurfaceWireframe                 84
xlXYScatter                     -4169
xlXYScatterLines                   74
xlXYScatterLinesNoMarkers          75
xlXYScatterSmooth                  72
xlXYScatterSmoothNoMarkers         73

Originally posted by Gurn
Hi,
i have created a graph in excel from a progress program but the actual graph appears has a stacked graph but what I require is a combination of a stacked graph and a line graph. I have created a macro in excel which resolves this problem but everytime i run my progress code I keeping getting the original graph.

The vb code for the excel macro is as follows

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).ChartType = xlLine
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).ChartType = xlLine
ActiveChart.SeriesCollection(5).Select
ActiveChart.SeriesCollection(5).ChartType = xlLine


Can anyone help convert the above code into Progress code so that I can hopefully use this code in my program to automatically alter my graph.

TIA

Gurnek.
 
I guess you have to do all the Activating and Selecting then.
Try:

Code:
    DEFINE VARIABLE chChart AS COMPONENT-HANDLE NO-UNDO.
    DEFINE VARIABLE chCollection AS COMPONENT-HANDLE NO-UNDO.

    ASSIGN chChart = chSheet:CHARTOBJECTS("Chart 1" ).
    chChart:Activate().
 
    ASSIGN chCollection = chChart:SERIESCOLLECTION(2).
    chCollection:SELECT().
    ASSIGN chCollection:CHARTTYPE = 4.

    ASSIGN chCollection = chChart:SERIESCOLLECTION(3).
    chCollection:SELECT().
    ASSIGN chCollection:CHARTTYPE = 4.

    ASSIGN chCollection = chChart:SERIESCOLLECTION(5).
    chCollection:SELECT().
    ASSIGN chCollection:CHARTTYPE = 4.

    RELEASE OBJECT chCollection.
    RELEASE OBJECT chChart.
 
Back
Top