public static void DrawSeriesData(List <double> series, int startIndex) { Plot_Form form = new Plot_Form { chart1 = { ChartAreas = { [0] = { AxisX = { Interval = Math.Ceiling((double)((1.0 * (series.Count - startIndex)) / 20.0)) }, //Text = "Time series", //Color = Color.Blue } }, Titles = { [0] = { //AxisX = { Interval = Math.Ceiling((double) ((1.0 * (series.Count - startIndex)) / 20.0)) }, Text = "Time series", //Color = Color.Blue } }, Series = { [0] = { //AxisX = { Interval = Math.Ceiling((double) ((1.0 * (series.Count - startIndex)) / 20.0)) }, //Text = "Time series", Color = Color.Blue } } } }; for (int i = startIndex; i < series.Count; i++) { form.chart1.Series["Data"].Points.AddXY((double)(i + 1), series.ElementAt <double>(i)); } form.Show(); }
public static void DrawAutocorrelation(List <double> listAutocorrelation, List <double> listConfidenceLimit, bool isPACF = false) { Plot_Form form = new Plot_Form(); if (!isPACF) { form.chart1.Titles["Title1"].Text = "Autocorrelation Function"; form.chart1.ChartAreas["ChartArea1"].Axes[0].Title = "Lag"; form.chart1.ChartAreas["ChartArea1"].Axes[1].Title = "ACF"; form.chart1.Series[0].Name = "ACF"; } else { form.chart1.Titles["Title1"].Text = "Partial Autocorrelation Function"; form.chart1.ChartAreas["ChartArea1"].Axes[0].Title = "Lag"; form.chart1.ChartAreas["ChartArea1"].Axes[1].Title = "PACF"; form.chart1.Series[0].Name = "PACF"; } int count = listAutocorrelation.Count; form.chart1.ChartAreas[0].AxisX.Interval = Math.Ceiling((double)((1.0 * count) / 20.0)); Series item = new Series { ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red, IsVisibleInLegend = false }; Series series2 = new Series { ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red, IsVisibleInLegend = false }; Series series3 = new Series { ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Black, IsVisibleInLegend = false }; int num2 = 0; if (isPACF) { num2 = 1; } for (int i = 0; i < listAutocorrelation.Count; i++) { Series series4 = new Series { ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Blue }; series4.Points.AddXY((double)(num2 + i), 0.0); series4.Points.AddXY((double)(num2 + i), listAutocorrelation[i]); series4.IsVisibleInLegend = false; form.chart1.Series.Add(series4); item.Points.AddXY((double)(num2 + i), listConfidenceLimit[i]); series2.Points.AddXY((double)(num2 + i), -listConfidenceLimit[i]); series3.Points.AddXY((double)i, 0.0); } form.chart1.Series.Add(item); form.chart1.Series.Add(series2); form.chart1.Series.Add(series3); form.Show(); }