Office Web Components (OWC) – Part V Spreadsheet control as datasource to Chart Control

Chart control – Using the Spreadsheet control as data source

Speaking about the Spreadsheet control, I received an e-mail from an alias (?) asking how to customize the column- and rowheadings. Below is a snipped code that shows how to do it:

Dim Spread As OWC11.Spreadsheet
Dim stYears(0 To 2) As String
Dim iCounter As Integer

stYears(0) = “1996”
stYears(1) = “1997”
stYears(2) = “1998”

Set Spread = Me.Spreadsheet1

With Spread
    .Height = 3540
    .Width = 4695
    With .ActiveWindow
        ‘Set the caption of the actual columnheadings.
       .ColumnHeadings(1).Caption = “Country    “
        .ColumnHeadings(2).Caption = “Freight    “
        .ColumnHeadings(3).Caption = “Shipments  “
        ‘Set the caption of the actual rowheadings.
       For iCounter = 0 To 2
            .RowHeadings(iCounter + 1).Caption = stYears(iCounter)
            .RowHeadings(iCounter + 4).Caption = stYears(iCounter)
        Next iCounter
        ‘Limit the viewable part of the worksheet.
       .ViewableRange = “A1:D6”
    End With
End With

Set Spread = Nothing

The below image shows how the control looks like after executing the code:

Spread1

In the following example itís assumed that the Spreadsheet control is populated with a Recordset containing quarterly data for two countries. In addition itís a request to show the maximum / minimum amount of freight values as well as the number of shipments.

The following image show how the form is set up in the first place:

Spread2

The formulas have been created at design time and the formulas are the following:

Max: =MAX(C2:C9)
Min: =MIN(C2:C9)

When clicking on the ìView chartî ñ button the form expand and show the Chart control as the following image shows:

Spread3

Whenever the underlying data is updated in the Spreadsheet control itís automatically reflected in the Chart control.

The following code does all the hard work to set up the Chart space and the two charts:

Private Sub cmdBView_Click()
‘Ranges with data for the charts.
Const stData1 As String = “Datasource!A2:D5”
Const stData2 As String = “Datasource!A6:D9”

Dim owcSpread As OWC11.Spreadsheet
Dim owcChart As OWC11.ChartSpace
Dim stTitle1 As String, stTitle2 As String
Dim stLegend1 As String, stLegend2 As String

With Me
    .Width = 9315
    Set owcSpread = .Spreadsheet1
    Set owcChart = .ChartSpace1
End With

With owcSpread.ActiveSheet
    stTitle1 = .Range(“B2”).Value
    stTitle2 = .Range(“B6”).Value
    stLegend1 = .Range(“C1”).Value
    stLegend2 = .Range(“D1”).Value
End With
     
With owcChart
    .Clear
    ‘Set up the Spreadsheet control to be the data source.
   .DataSource = owcSpread
    ‘Remark: We are forced to add both the 1st and 2nd chart.
   ‘Add the first chart.
   .Charts.Add
    ‘Add the second chart.
   .Charts.Add
    ‘If we want to use the same scale for the Y-axis for all the charts then
   ‘we need to set this property to true.
   .HasUnifiedScales = True
    .Border.Color = vbWhite
    ‘By changing the layout we can control how the charts are presented
   ‘inside the Chart space.
   .ChartLayout = chChartLayoutHorizontal
End With

‘Set up the charts and manipulate some of their properties.
With owcChart.Charts(0)
    .Type = chChartTypeAreaStacked
    ‘The data reference must be of the datatype string.
   ‘The last parameter specify if each row represent a serie or not.
   .SetSpreadsheetData stData1, False
    .HasTitle = True
    With .Title
        .Caption = stTitle1
        .Font.Name = “Verdana”
        .Font.Size = 10
        .Font.Bold = True
        .Font.Color = RGB(0, 51, 153)
    End With
    With .SeriesCollection(1)
        .Interior.Color = vbYellow
        .Caption = stLegend1
    End With
    With .SeriesCollection(2)
        .Interior.Color = vbBlue
        .Caption = stLegend2
    End With
    With .Axes(0).Font
        .Name = “Verdana”
        .Size = 8
        .Bold = True
        .Color = RGB(0, 51, 153)
    End With
    With .Axes(1).Font
        .Name = “Verdana”
        .Size = 8
        .Color = RGB(0, 51, 153)
    End With
    .HasLegend = True
    With .Legend
        .Position = chLegendPositionBottom
        .Border.Color = vbWhite
        .LegendEntries(2).Visible = False
    End With
End With

With owcChart.Charts(1)
    .Type = chChartTypeAreaStacked
    .SetSpreadsheetData stData2, False
    With .SeriesCollection(1)
        .Interior.Color = vbRed
        .Caption = stLegend1
    End With
    With .SeriesCollection(2)
        .Interior.Color = vbBlue
        .Caption = stLegend2
    End With
    .HasTitle = True
    With .Title
        .Caption = stTitle2
        .Font.Name = “Verdana”
        .Font.Size = 10
        .Font.Bold = True
        .Font.Color = RGB(0, 51, 153)
    End With
    With .Axes(0).Font
        .Name = “Verdana”
        .Size = 8
        .Bold = True
        .Color = RGB(0, 51, 153)
    End With
    With .Axes(1).Font
        .Name = “Verdana”
        .Size = 8
        .Color = RGB(0, 51, 153)
    End With
    .HasLegend = True
    With .Legend
        .Position = chLegendPositionBottom
        .Border.Color = vbWhite
        .LegendEntries(2).Visible = False
    End With
End With

Set owcSpread = Nothing
Set owcChart = Nothing
   
End Sub

To sum up
For the last three years I have shipped over 20 customs solution that, in one or another way, include one or more of the controls in the OWC. Iíve mainly used them in COM add-ins for Excel or as part of VB 6.0-solutions but due to NDAs Iím not able to show any of these solutions in public. Anyway, up to this date no issues have been reported to me due to the use of these controls and therefore I find them to be trusted.

This post ends the introduction of the OWC package and although I have only skimmed on the surface I hope that you at least now have an idea about them.

Kind regards,
Dennis

Posted in Uncategorized

18 thoughts on “Office Web Components (OWC) – Part V Spreadsheet control as datasource to Chart Control

  1. Dennis,

    Your posts are of great value to all of us.

    They simply make OWC programming a pleasure!

    Would you know how to change the tiptext in a chart legend, or in a pivot fieldset?

    Do we have to hook on the CommandTipText event?

    Thanks,

    – Philippe

  2. Philippe and Jim,

    Many thanks for Your kind words – Highly appreciated especially as I don’t have English as my first language :)

    Let me see if we can sort it out:

    First we must assure that we have access to the Tip-event and also that the tips are displayed
    which is controlled by the Chartspace object:

    With owcChart
    .AllowScreenTipEvents = True
    .DisplayScreenTips = True
    End With

    For PivotTables object it seems that only the DisplayScreenTips is available but it seems to work
    anyway.

    Then we use the following event-procedure of the Chartspace/Pivottable:

    Private Sub ChartSpace1_BeforeScreenTip(ByVal TipText As OWC11.ByRef, ByVal ContextObject As Object)
    If TypeName(ContextObject) = “ChLegend” Then TipText.Value = “Add the wanted text here!”
    End Sub

    Private Sub PivotTable1_BeforeScreenTip(ByVal ScreenTipText As OWC11.ByRef, ByVal SourceObject As Object)
    If TypeName(SourceObject) = “PivotFieldSet” Then ScreenTipText.Value = “Add the wanted text here!”
    End Sub

    However, I’m not sure if we can grab each individual legend or fieldset.

    Hopefully the above will give You some guidance and insight

    Kind regards,
    Dennis

  3. Hi Dennis,

    Thanks for the hint. Works fine in ‘untyped’ VbScript :

    Private Sub cs_BeforeScreenTip(tip, ctx)
    window.status = TypeName(ctx)
    If TypeName(ctx) = “ChLegendEntry” Then
    tip.Value = “tip ” & cstr(ctx.index)
    End Sub

    Tak!

    – Philippe

  4. Hi Dennis,
    I was wondering if this functionality can be provided in windows forms using vb.net?
    I tried to connect OWC chart component to OWC spreadsheet control (both available on the same form) but was not successful. Can you throw some light?

    Thanks in advance.

    Sincerely,
    Vivek

  5. Vivek,

    Sorry for late reply.

    Could You please give some more details about it?

    Errors reported and how You have set up the connection etc.

    In general I have no good experience with the present version of the OWC and VB.NET.

    TIA,
    Dennis

  6. Hi Dennis,
    I am extremely new to the OWC controls, and have a simple task in front of me. I am looking to populate a spreadsheet object with two columns of data, and a set number of rows and then to graph them. I am to the point where I have the spreadsheet populated, and for that I am grateful. Now, however, I have to graph that small array of data in a simple bar graph. How should I go about doing this?
    Thank you for any help you may provide.

  7. wanted to one 2 very specific things-
    1) how comfortably can i use owc in windows applications / winforms? any runtime exception threats?
    2) how can i attach a SQL datasource table columns as category and data value fields? everytime i do this i get an error “Failed to fetch data.” the table has good 10 rows, cant figure out why the error must be popping up, connection string verified.

  8. Hi Dennis,

    I was really fine to get through OWC

    I would like to know how can i use OWC10 and OWC11 spreadsheet in the same project.

    Example

    I want some of my client to use only OWC10 and other to use OWC11.

    Can u tell me how can i use both the component in my project.

  9. Hej Dennis,
    Do you have an example where you put an owc-spreadsheet on an ASP.Net-page and programmatically set and get data from cells in either C# or VB.Net?
    Tia
    SteffenJ

  10. Dennis I am starting coding but I can surely say da you’re well structured in your work. Big up from Germany.
    If I may, I’d like to know how to manage a problem that I had with spreadsheet.
    Basically, I’ve a userform with a commandButton and a spreasheet on the same spreasheet. And what I’d like to do is to compute the average of any range of values selected by the user on the spreasheet.
    I did the task for a predefined range, but I was unable to do it with a range that could be selected by the user in a randomly manner.
    Thankx for the assistance.
    Nicolas Fils

  11. Hello, i’m a begginer in OWC programing, i’m making a Visual Basic Application and when i copy and past your code, and put this numbers in the excel control, it appear an error:
    “Error 5 Execution Time..”
    And is in this line of the code:
    .SetSpreadsheetData stData1, False

    Can you help me and tell me what i’m doing wrong.

    I’ know this post is very old(about 2 years) but the info is still here so… Can you help me?

  12. Greetings Sir

    On my OCW chart I want to display an upper limit line goign across the chart that shows the limit of a certain branch’s capacity. A sort of trendline but not really a trendline but a max line….

    THanks

  13. Hi, cant you give your proyect in zip please, i am new in programming owc. And your example is very good for my problem.

    Thanks a lot

  14. Hi Dennis,

    Thanks for your articles on owc. I am populating pivot chart using the code below. But, my problem is, after filtering the captions are not retained.

    The reason behind using the captions is that, Chart is not populating series with name having more than 23 characters. Please let me know how can we populate series names having more than 23 characters binded with oracle views?

    private void LoadPortfolioChart()
    {
    String datafile = null;
    //string sqlCommand = @”SELECT Year “”Year””,Month “”Month””,Week “”Week””,Day “”Day””,Hour “”Hour””,ECO_GAS_UNDERCONTECO “”Eco_gas_UnderContEco””, ECO_LIGNITEIN_MUST “”Eco_LigniteIN_Must””,ECO_LIGNITEIN_UNDERCONTECO “”LigniteIN_UnderContEco””,ECO_GAS_MUST “”Eco_Gas_Must””,ECO_OUTRIGHTHYDRO_UNDERCONTECO “”Hydro_UnderContEco””,ECO_OUTRIGHTHYDRO_MUST “”Eco_OutrightHydro_Must””,ECO_COAL_UNDERCONTECO “”Eco_Coal_UnderContEco””,ECO_COAL_MUST “”Eco_Coal_Must””,ECO_LIGNITE_UNDERCONTECO “”Lignite_UnderContEco””,ECO_LIGNITE_MUST “”Eco_Lignite_Must””,ECO_OUTRIGHTVW_UNDERCONTECO “”VW_UnderContEco””,ECO_OUTRIGHTVW_MUST “”Eco_OutrightVW_Must””,ECO_OUTRIGHT_NUKE_UNDERCONTECO “”Nuke_UnderContEco””,Eco_OutrightNuke_Must “”Nuke_Must””,MAX_UNDERCONTROL “”Max_UnderControl””,MAX_UNDERCONT_WILLI “”Max_UnderCont_Willi””,SYS_HEDGEPOSAGG “”Sys_HedgePosAgg””,SALES_NET “”Sales_Net”” FROM PRODUCTIONUNDERCONTROLHEDGEPOS ORDER BY TRADEDATE”;
    datafile = GetOWCXML(“FetchEconomicGendHedges”);

    enlargedGraphAxChartSpace.Clear();
    enlargedGraphAxChartSpace.ConnectionString = “provider=mspersist”;
    enlargedGraphAxChartSpace.CommandText = datafile;

    //2
    //string strresult = ExportUtils.GetADORecordSet(dataSetEcoMax, System.IO.Directory.GetCurrentDirectory());

    //System.Xml.XmlDocument oxmldoc = new System.Xml.XmlDocument();

    ////Load the XML recordset into the XML Document object.
    //oxmldoc.LoadXml(strresult);

    ////Save it to disk file.
    //oxmldoc.Save(datafile);

    //3
    //string connectionString = “Provider=MSDAORA.1;Password=TU_PROPOMT;User ID=TU_PROPOMT;Data Source=XE.WORLD”;

    //enlargedGraphAxChartSpace.Clear();
    //enlargedGraphAxChartSpace.ConnectionString = connectionString;
    //enlargedGraphAxChartSpace.DataMember = “PRODUCTIONUNDERCONTROLHEDGEPOS”;
    //enlargedGraphAxChartSpace.CommandText = “SELECT Year,Month,Week,Day,Hour,ECO_GAS_UNDERCONTECO, ECO_LIGNITEIN_MUST,ECO_LIGNITEIN_UNDERCONTECO LIGNITEIN_UNDERCONTECO,ECO_GAS_MUST,ECO_OUTRIGHTHYDRO_UNDERCONTECO HYDRO_UNDERCONTECO,ECO_OUTRIGHTHYDRO_MUST,ECO_COAL_UNDERCONTECO,ECO_COAL_MUST,ECO_LIGNITE_UNDERCONTECO LIGNITE_UNDERCONTECO,ECO_LIGNITE_MUST,ECO_OUTRIGHTVW_UNDERCONTECO VW_UNDERCONTECO,ECO_OUTRIGHTVW_MUST,ECO_OUTRIGHT_NUKE_UNDERCONTECO NUKE_UNDERCONTECO,Eco_OutrightNuke_Must NUKE_MUST,MAX_UNDERCONTROL,MAX_UNDERCONT_WILLI,SYS_HEDGEPOSAGG,SALES_NET FROM PRODUCTIONUNDERCONTROLHEDGEPOS”;

    enlargedGraphAxChartSpace.Charts[0].PlotArea.Interior.Color = “White”;

    //Specify if the chart needs to have legend.
    enlargedGraphAxChartSpace.Charts[0].HasLegend = true;

    enlargedGraphAxChartSpace.AllowFiltering = true;
    enlargedGraphAxChartSpace.AllowGrouping = true;

    enlargedGraphAxChartSpace.EnableEvents = true;
    enlargedGraphAxChartSpace.HasRuntimeSelection = false;

    enlargedGraphAxChartSpace.DisplayToolbar = false;
    enlargedGraphAxChartSpace.DisplayPropertyToolbox = false;
    enlargedGraphAxChartSpace.DisplayFieldList = false;
    //By setting this property to false a standard chart
    //and not a PivotChart is created.
    enlargedGraphAxChartSpace.DisplayFieldButtons = true;

    //Prevent the user(s) from doing anything else except filter the data
    //and add / remove fields.
    enlargedGraphAxChartSpace.AllowUISelection = false;
    enlargedGraphAxChartSpace.HasMultipleCharts = false;

    enlargedGraphAxChartSpace.PlotAllAggregates = ChartPlotAggregatesEnum.chPlotAggregatesSeries;
    //Give chart X and Y title
    enlargedGraphAxChartSpace.Charts[0].Axes[0].HasTitle = true;
    enlargedGraphAxChartSpace.Charts[0].Axes[0].Title.Caption = “Delivery Period”;
    enlargedGraphAxChartSpace.Charts[0].Axes[0].Title.Font.Bold = true;
    enlargedGraphAxChartSpace.Charts[0].Axes[1].HasTitle = true;
    enlargedGraphAxChartSpace.Charts[0].Axes[1].Title.Caption = “Volume”;
    enlargedGraphAxChartSpace.Charts[0].Axes[1].Title.Font.Bold = true;

    //set Y Axis Min and Max Values
    //TODO: Remove hardcoding of min and max
    //enlargedGraphAxChartSpace.Charts[0].Axes[1].Scaling.Maximum = 15000;
    enlargedGraphAxChartSpace.Charts[0].Axes[1].Scaling.Minimum = 5000;
    //enlargedGraphAxChartSpace.Charts[0].Axes[1].MajorUnit = 2000;

    enlargedGraphAxChartSpace.Charts[0].Axes[1].NumberFormat = “#,##0 “MW””;
    enlargedGraphAxChartSpace.Charts[0].Type = ChartChartTypeEnum.chChartTypeAreaStacked;

    object[] aNames = { “MONTH”, “WEEK”, “DAY”, “HOUR” };

    object[] aTotals = { “SYS_HEDGEPOSAGG”,”SALES_NET”,”MAX_UNDERCONT_WILLI”,”MAX_UNDERCONTROL”,
    “NUKE_MUST”,”NUKE_UNDERCONTECO”,”ECO_OUTRIGHTVW_MUST”,”VW_UNDERCONTECO”,
    “ECO_LIGNITE_MUST”,”LIGNITE_UNDERCONTECO”,”ECO_COAL_MUST”,”ECO_COAL_UNDERCONTECO”,
    “ECO_OUTRIGHTHYDRO_MUST”,”ECO_OUTRIGHTHYDRO_UNDERCONTECO”,”LIGNITEIN_UNDERCONTECO”,
    “ECO_LIGNITEIN_MUST”, “ECO_GAS_MUST”,”ECO_GAS_UNDERCONTECO”
    };

    enlargedGraphAxChartSpace.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimFilter,
    (int)ChartSpecialDataSourcesEnum.chDataBound, “YEAR”);
    enlargedGraphAxChartSpace.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues,
    (int)ChartSpecialDataSourcesEnum.chDataBound, aTotals);
    enlargedGraphAxChartSpace.SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimCategories,
    (int)ChartSpecialDataSourcesEnum.chDataBound, aNames);
    if (enlargedGraphAxChartSpace.Charts[0].SeriesCollection.Count > 0)
    {

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of NUKE_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “DimGray”);
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of NUKE_MUST”].Caption = “Sum of Eco_OutrightNuke_Must”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of NUKE_UNDERCONTECO”].Interior.SetSolid(“DimGray”);
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of NUKE_UNDERCONTECO”].Caption = “Sum of Eco_Outright_Nuke_UnderContEco”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_OUTRIGHTVW_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “Gray”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of VW_UNDERCONTECO”].Interior.SetSolid(“Gray”);
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of VW_UNDERCONTECO”].Caption = “Sum of Eco_OutrightVW_UnderContEco”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_LIGNITE_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “Maroon”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of LIGNITE_UNDERCONTECO”].Interior.SetSolid(“Maroon”);
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of LIGNITE_UNDERCONTECO”].Caption = “Sum of Eco_Lignite_UnderContEco”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_COAL_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “Silver”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_COAL_UNDERCONTECO”].Interior.SetSolid(“Silver”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_OUTRIGHTHYDRO_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “RoyalBlue”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of HYDRO_UNDERCONTECO”].Interior.SetSolid(“RoyalBlue”);
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of HYDRO_UNDERCONTECO”].Caption = “Sum of Eco_OutrightHydro_UnderContEco”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of LIGNITEIN_UNDERCONTECO”].Interior.SetSolid(“Sienna”);
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of LIGNITEIN_UNDERCONTECO”].Caption = “Sum of Eco_LigniteIN_UnderContEco”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_LIGNITEIN_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “Sienna”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_GAS_UNDERCONTECO”].Interior.SetSolid(“Gold”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_GAS_MUST”].Interior.SetPatterned(ChartPatternTypeEnum.chPatternWeave, “White”, “Gold”);

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONTROL”].Type = ChartChartTypeEnum.chChartTypeLine;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONTROL”].Line.Color = “Black”;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONTROL”].Line.set_Weight((LineWeightEnum)int.Parse(“1?));

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONT_WILLI”].Type = ChartChartTypeEnum.chChartTypeLine;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONT_WILLI”].Line.Color = “Lime”;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONT_WILLI”].Line.set_Weight((LineWeightEnum)int.Parse(“1?));

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”].Type = ChartChartTypeEnum.chChartTypeLine;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”].Line.Color = “Red”;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”].Line.set_Weight((LineWeightEnum)int.Parse(“1?));

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”].Type = ChartChartTypeEnum.chChartTypeLine;
    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”].Line.Color = “Black”;

    //enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”].Ungroup(true);
    //enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”].Ungroup(true);
    //enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”].Group(enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”]);
    //enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”].Group(enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”]);

    //ChAxis Caxix2 = enlargedGraphAxChartSpace.Charts[0].Axes.Add(enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”].get_Scalings(ChartDimensionsEnum.chDimValues));
    //Caxix2.Position = OWC10.ChartAxisPositionEnum.chAxisPositionRight;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of NUKE_MUST”].Border.Color = “DimGray”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of NUKE_UNDERCONTECO”].Border.Color = “DimGray”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_OUTRIGHTVW_MUST”].Border.Color = “Gray”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of VW_UNDERCONTECO”].Border.Color = “Gray”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_LIGNITE_MUST”].Border.Color = “Maroon”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of LIGNITE_UNDERCONTECO”].Border.Color = “Maroon”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_COAL_MUST”].Border.Color = “Silver”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_COAL_UNDERCONTECO”].Border.Color = “Silver”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_OUTRIGHTHYDRO_MUST”].Border.Color = “RoyalBlue”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of HYDRO_UNDERCONTECO”].Border.Color = “RoyalBlue”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of LIGNITEIN_UNDERCONTECO”].Border.Color = “Sienna”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_LIGNITEIN_MUST”].Border.Color = “Sienna”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_GAS_UNDERCONTECO”].Border.Color = “Gold”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of ECO_GAS_MUST”].Border.Color = “Gold”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONTROL”].Border.Color = “Black”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of MAX_UNDERCONT_WILLI”].Border.Color = “Lime”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SALES_NET”].Border.Color = “Red”;

    enlargedGraphAxChartSpace.Charts[0].SeriesCollection[“Sum of SYS_HEDGEPOSAGG”].Border.Color = “Black”;

    }

    }

  15. Thank Denis for yours so usefull informations.
    1) Do you know how to write a text on a cell using the wraptext using OWC11 ?

    2) Do you know how to resize automaticly the size of a text on a cell?
    if i make a manual zoom (modify the height and width of cells) the text size don’t change automaticly

    Kinds regards


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published. Required fields are marked *