Chart: IChart;
Chart: Prognoz.Platform.Interop.Chart.IChart;
The Chart property returns a model chart.
The chart is available only after model calculation by the IMsModel.Execute method.
Executing the example requires a form containing the ChartBox component with the ChartBox1 identifier. The repository must contain a modeling container with the MS identifier that contains a model with the MODEL_D identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
Model: IMsModel;
Calcul: IMsModelCalculation;
Per: IMsModelPeriod;
Begin
// Get repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get the model
Model := mb.ItemByIdNamespace("MODEL_D", MsKey).Bind As IMsModel;
// Create model calculation parameters
Calcul := Model.CreateCalculation;
// Set calculation period
Per := Calcul.Period;
Per.IdentificationStartDate := DateTime.Parse("01.01.1990");
Per.IdentificationEndDate := DateTime.Parse("31.12.2010");
Per.ForecastStartDate := DateTime.Parse("01.01.2011");
Per.ForecastEndDate := DateTime.Parse("31.12.2015");
// Calculate the model
Model.Execute(Calcul, -1);
// Display model chart in the ChartBox1 component
ChartBox1.Chart := Model.Chart;
End Sub UserProc;
After executing the example the ChartBox1 component displays the MODEL_D model chart.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
…
Private Sub UserProc();
Var
mb: IMetabase;
MsKey: uinteger;
Model: IMsModel;
Calcul: IMsModelCalculation;
Per: IMsModelPeriod;
Begin
// Get repository
mb := Self.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get the model
Model := mb.ItemByIdNamespace["MODEL_D", MsKey].Bind() As IMsModel;
// Create model calculation parameters
Calcul := Model.CreateCalculation();
// Set calculation period
Per := Calcul.Period;
Per.IdentificationStartDate := DateTime.Parse("01.01.1990");
Per.IdentificationEndDate := DateTime.Parse("31.12.2010");
Per.ForecastStartDate := DateTime.Parse("01.01.2011");
Per.ForecastEndDate := DateTime.Parse("31.12.2015");
// Calculate the model
Model.Execute(Calcul, -1 As uinteger, 0);
// Display model chart in the ChartBox1 component
chartBoxNet1.CtrlBox.Chart := Model.Chart;
End Sub UserProc;
See also: