private void lol2() { List<forGraph> myList = new List<forGraph>(); double f = 1.1; //for (int k = 0; k < data.s0.Count; k++) //{ myList = new List<forGraph>();//so that a nw list is made everytime int total, total2; total = total2 = 0; List<S0> bbh = new List<S0>(); List<S0> bbh2 = new List<S0>(); for (int k = 0; k < data.s0.Count;k++ ) { total2 = 0; total = 0; bbh = data.s0[k]; bbh2 = data2.s0[k]; foreach (S0 mark in bbh) { total = total + int.Parse(mark.total); } foreach (S0 mark in bbh2) { total2 = total2 + int.Parse(mark.total); } total = total / bbh.Count; total2 = total2 / bbh2.Count; forGraph temp23 = new forGraph(); temp23.Subject = f.ToString(); temp23.Marks = total.ToString(); myList.Add(temp23); f += 0.1; forGraph temp24 = new forGraph(); temp24.Subject = f.ToString(); temp24.Marks = total2.ToString(); myList.Add(temp24); f += 0.9; } (SemesterChart.Series[0] as ColumnSeries).ItemsSource = myList; }
private async void onLaunch() { StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder; StorageFile sampleFile = await folder.GetFileAsync("data.txt"); string testlol = await Windows.Storage.FileIO.ReadTextAsync(sampleFile); Paper data = new Paper(); data = JsonConvert.DeserializeObject<Paper>(testlol); //now we plot some graphs //there are by default 8 garphs declared in xaml visibilty of all collapsed //as we will we encounter more data they will become visible and get binded with data List<forGraph> myList = new List<forGraph>(); int inter = 0; int f = 0; foreach (List<S0> bbh in data.s0) { f = 0; myList = new List<forGraph>();//so that a nw list is made everytime foreach (S0 bh in bbh) { f++; forGraph temp23 = new forGraph(); temp23.Subject = f.ToString(); temp23.Marks = bh.total; myList.Add(temp23); } if (inter == 0) { LineChart.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 1) { LineChart2.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart2.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 2) { LineChart3.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart3.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 3) { LineChart4.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart4.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 4) { LineChart5.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart5.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 5) { LineChart6.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart6.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 6) { LineChart7.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart7.Series[0] as LineSeries).ItemsSource = myList; } else if (inter == 7) { LineChart8.Visibility = Windows.UI.Xaml.Visibility.Visible; (LineChart8.Series[0] as LineSeries).ItemsSource = myList; } inter++; } }
private void lol() { List<forGraph> myList = new List<forGraph>(); double f = 1.1; //for (int k = 0; k < data.s0.Count; k++) //{ myList = new List<forGraph>();//so that a nw list is made everytime List<S0> bbh = new List<S0>(); List<S0> bbh2 = new List<S0>(); bbh = data.s0[0]; bbh2 = data2.s0[0]; for (int g = 0; g <bbh.Count; g++) { forGraph temp23 = new forGraph(); temp23.Subject = f.ToString(); temp23.Marks = bbh[g].total; myList.Add(temp23); f += 0.1; forGraph temp24 = new forGraph(); temp24.Subject = f.ToString(); temp24.Marks = bbh2[g].total; myList.Add(temp24); f += 0.9; } (SubjectChart.Series[0] as ColumnSeries).ItemsSource = myList; //} }