Changing Chart Type and Setting Up Set of Series

Executing the example requires that the repository contains a workbook with the OBJ123 identifier in which the chart type and a data set to be displayed in the chart are changed. The report must display the chart.

Add links to the following system assemblies:

Fore Example

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Exp: IEaxAnalyzer;
    Chart: IChart;
    Table: ITabSheet;
Begin
    MB := MetabaseClass.Active;
    //Open a workbook to edit
    MObj := MB.ItemById("OBJ123").Edit;
    Exp := MObj As IEaxAnalyzer;
    //Get a workbook chart
    Chart := Exp.Chart.Chart;
    //Change the chart type to bar chart
    Chart.Type := ChartType.Bars;
    //Get a workbook table
    Table := Exp.Grid.TabSheet;
    //Select the entire table in order all all rows contained in the table are displayed
    Table.View.Selection.SelectAll;
    MObj.Save;
End Sub UserProc;

After executing the example the chart type is changed to bar chart. All rows are selected in the table, therefore the data set displayed in the chart is changed.

Fore.NET Example

The specified procedure is the Main entry point in the Program module of the .NET assembly. The Express, Metabase, Chart, Tab assemblies must be imported to this module from the Prognoz.Platform.Interop system assembly.

Public Shared Sub Main(Params: StartParams);

Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    Exp: IEaxAnalyzer;
    Chart: IChart;
    Table: ITabSheet;
Begin
    MB :=  Params.Metabase;
    //Open a workbook to edit
    MObj := MB.ItemById["OBJ123"].Edit();
    Exp := MObj As IEaxAnalyzer;
    //Get a workbook chart
    Chart := Exp.Chart.Chart;
    //Change the chart type to bar chart
    Chart.Type := ChartType.chtBars;
    //Get a workbook table
    Table := Exp.Grid.TabSheet;
    //Select the entire table in order all all rows contained in the table are displayed
    Table.View.Selection.SelectAll();
    MObj.Save();
End Sub;

The result of example execution matches with that of the Fore example.

See also:

Examples