1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| Private Sub Plot(ByVal aPercentorProbaDico As SortedDictionary(Of String, MyPercentorProbaWindowData), ByVal aPattern As MyPercentorProbaWindowData)
'Initialisation
If AxChart.Charts.Count > 0 Then
AxChart.Charts.Delete(0)
End If
chrt = AxChart.Charts.Add()
chrt.Type = ChartChartTypeEnum.chChartTypeLine
chrt.HasTitle = True
chrt.Title.Caption = "FAST FORWARD FORECAST SENARIOS"
chrt.HasLegend = True
chrt.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom
chrt.HasAutoAspectRatio = True
chrt.HasAutoChartDepth = True
chrt.Border.Color = "#FFFBF0"
chrt.PlotArea.Interior.Color = "#FFFBF0"
Dim aSerieCollection As Integer = -1
For Each aserie As String In aPercentorProbaDico.Keys
aSerieCollection = aSerieCollection + 1
Dim X(aPercentorProbaDico(aserie).CumDepths.Count) As String
Dim Y(aPercentorProbaDico(aserie).CumDepths.Count)
Dim index As Integer = 0
Dim diffyearpredictiontimeserie As Integer = _StartDatePrediction.Year - aPercentorProbaDico(aserie).StartWindowDate.Year
If aPattern Is Nothing Then
For Each adate As DateTime In aPercentorProbaDico(aserie).CumDepthsFitted.Keys
X(index) = CStr(adate.AddYears(diffyearpredictiontimeserie))
Y(index) = aPercentorProbaDico(aserie).CumDepthsFitted(adate)
index = index + 1
Next
Else
Dim diffyearPatternTimeserie As Integer = aPattern.StartWindowDate.Year - aPercentorProbaDico(aserie).StartWindowDate.Year
For Each adate As DateTime In aPercentorProbaDico(aserie).CumDepthsFitted.Keys
X(index) = CStr(adate.AddYears(diffyearpredictiontimeserie))
'Y(index) = aPercentorProbaDico(aserie).CumDepthsFitted(adate)
Y(index) = aPattern.CumDepthsFitted(adate.AddYears(diffyearPatternTimeserie)) * aPercentorProbaDico(aserie).ExactValue / aPattern.ExactValue
index = index + 1
Next
End If
chrt.SeriesCollection.Add(aSerieCollection)
chrt.SeriesCollection(aSerieCollection).Caption = CStr(aserie)
chrt.SeriesCollection(aSerieCollection).SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), Join(X, vbTab))
chrt.SeriesCollection(aSerieCollection).SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), Join(Y, vbTab))
'chrt.Axes(ChartDimensionsEnum.chD).NumberFormat = "dd/MM/yyyy"
'chrt.Axes(ChartDimensionsEnum.chDimCategories).TickLabelUnitType = ChartAxisUnitTypeEnum.chAxisUnitDay
' chrt.Axes(ChartDimensionsEnum.chDimXValues).TickLabelUnitType = ChartAxisUnitTypeEnum.chAxisUnitMonth
'chrt.Axes(ChartAxisPositionEnum.chAxisPositionCategory).HasAutoMinorUnit = True
Next
End Sub |
Partager