private void PopulateChartData(System.Windows.Forms.DataVisualization.Charting.Chart performanceChart, PerformanceData.DataType dataType) { PerformanceData.FetchPerformanceData(dataType); foreach (string address in PerformanceData.Addresses) { System.Windows.Forms.DataVisualization.Charting.Series series = new System.Windows.Forms.DataVisualization.Charting.Series(); series.ChartArea = "ChartArea1"; series.IsValueShownAsLabel = true; series.Legend = "Legend1"; series.Name = address; series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; performanceChart.Series.Add(series); } for (int index = 0; index < PerformanceData.DataRanges.Length; index++) { int iXPoint = PerformanceData.DataRanges[index]; PerformanceData.TimeTakenForData[] tymTaken = null; PerformanceData.GraphData.TryGetValue(iXPoint, out tymTaken); foreach (PerformanceData.TimeTakenForData tmtaken in tymTaken) { performanceChart.Series[tmtaken.Address].Points.AddXY(iXPoint, tmtaken.TimeTaken); } } performanceChart.DataBind(); }
private void GridView_Load(object sender, EventArgs e) { PerformanceData.FetchPerformanceData(PerformanceData.DataType.ASCIIDouble); dataGridView1.DataSource = PerformanceData.GraphData; dataGridView1.Columns[0].Name = "Data"; dataGridView1.Columns[0].HeaderText = "Data"; dataGridView1.Columns[0].DataPropertyName = "CustomerID"; dataGridView1.Columns[1].HeaderText = "Contact Name"; dataGridView1.Columns[1].Name = "Name"; dataGridView1.Columns[1].DataPropertyName = "ContactName"; dataGridView1.Columns[2].Name = "Country"; dataGridView1.Columns[2].HeaderText = "Country"; dataGridView1.Columns[2].DataPropertyName = "Country"; }