public void redata(ref int s, ref List<question> questions, ref int choices_no1, ref int data_format) { float total = 0; Graph.SeriesCollection ss = questions[s].datasheet.Application.Chart().SeriesCollection(); Graph.Points kj; kj = ss.Item(1).Points(); objSlide = objPres.Slides._Index(s + 1); objShapes = objSlide.Shapes; for (int i = 2; i <= choices_no1 + 1; i++) { total = (total + questions[s].values[i - 2]); } if (data_format == 2) { for (int i = 2; i <= choices_no1 + 1; i++) { questions[s].datasheet.Cells[2, i] = questions[s].values[i - 2]; } questions[s].datasheet.Application.Chart().Refresh(); objShape2 = objShapes[4]; objShape2.TextEffect.Text = "Total" + " " + total.ToString(); } else if (data_format == 1) { for (int i = 2; i <= choices_no1 + 1; i++) { questions[s].datasheet.Cells[2, i] = (((questions[s].values[i - 2]) / total) * 100) + "%"; } } else if (data_format == 3) { for (int i = 2; i <= choices_no1 + 1; i++) { questions[s].datasheet.Cells[2, i] = questions[s].values[i - 2]; Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); label.Text = (((questions[s].values[i - 2]) / total) * 100).ToString() + "%" + "[" + questions[s].values[i - 2].ToString() + "]"; } objShape2 = objShapes[4]; objShape2.TextEffect.Text = "Total" + " " + total.ToString(); } }
public void add_chart(ref List<question> questions, ref int question_no, ref int choices_no1,ref ColorDialog colordialog1, ref int data_format, ref Color[] bar_colors, ref FontDialog fontdialog1) { if (questions[question_no].show_chart == true) { objChart = objSlide.Shapes[2].OLEFormat.Object; Graph.SeriesCollection ss = objChart.SeriesCollection(); Graph.Points kj; kj = ss.Item(1).Points(); Graph.Axes kk; kk = objChart.Axes(); questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ objChart.ApplyDataLabels(); for (int i = 2; i <= choices_no1 + 1; i++) { questions[question_no].datasheet.Cells[1, i] = i - 1; // kj.Item(i - 1).Interior.Color = } float total = 0; for (int i = 2; i <= choices_no1 + 1; i++) { total = (total + questions[question_no].values[i - 2]); } if (data_format == 2) { for (int i = 2; i <= choices_no1 + 1; i++) { Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); questions[question_no].datasheet.Cells[2, i] = questions[question_no].values[i - 2]; kj.Item(i - 1).Interior.Color = bar_colors[i - 2]; } objShape2 = objSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 435, 480, 120, 70); objShape2.TextEffect.Text = "Total" + " " + total.ToString(); objShape2.TextEffect.FontName = "Comic Sans MS"; objShape2.TextEffect.FontSize = 15; objShape2.TextEffect.FontBold = MsoTriState.msoTrue; } else if (data_format == 1) { for (int i = 2; i <= choices_no1 + 1; i++) { Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); questions[question_no].datasheet.Cells[2, i] = (((questions[question_no].values[i - 2]) / total) * 100) + "%"; kj.Item(i - 1).Interior.Color = bar_colors[i - 2]; } } else if (data_format == 3) { for (int i = 2; i <= choices_no1 + 1; i++) { questions[question_no].datasheet.Cells[2, i] = questions[question_no].values[i - 2]; Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); label.Text = (((questions[question_no].values[i - 2]) / total) * 100).ToString("F") + "%" + "[" + questions[question_no].values[i - 2].ToString() + "]"; kj.Item(i - 1).Interior.Color = bar_colors[i - 2]; label.Font.Size = 15; } objShape2 = objSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 435, 480, 120, 70); objShape2.TextEffect.Text = "Total" + " " + total.ToString(); objShape2.TextEffect.FontName = "Comic Sans MS"; objShape2.TextEffect.FontSize = 15; objShape2.TextEffect.FontBold = MsoTriState.msoTrue; } objChart.Refresh(); objChart.Application.Update(); } }
public void add_chart1(ref List<Team> teams,ref List<Team> teams1 ) { objChart1 = objslide1.Shapes[1].OLEFormat.Object; objChart = objSlide.Shapes[1].OLEFormat.Object; Graph.SeriesCollection ss = objChart.SeriesCollection(); kj = ss.Item(1).Points(); // sc.Item(1).Values = 5; // questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ //objChart.ApplyDataLabels(); datasheet= objChart.Application.DataSheet; //float total = 0; //for (int i = 2; i <= choices_no1 + 1; i++) //{ // total = (total + questions[question_no].values[i - 2]); //} objChart.ApplyDataLabels(); for (int i = 2; (16 - i) >= 0; i++) { datasheet.Cells[1, i] = teams[16 - i].KeyPad; // kj.Item(i - 1).Interior.Color = } for (int i = 2; (16-i) >=0 ; i++) { // Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); datasheet.Cells[2, i] = teams[16-i].points; kj.Item(i - 1).Interior.Color = teams[16-i].bc; } Graph.Axes chart1 = objChart.Axes(); objchart2 = objSlide.Shapes[2].OLEFormat.Object; Graph.Axes chart2 = objchart2.Axes(); ss = objchart2.SeriesCollection(); kj = ss.Item(1).Points(); // sc.Item(1).Values = 5; // questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ //objChart.ApplyDataLabels(); datasheet3 = objchart2.Application.DataSheet; //float total = 0; //for (int i = 2; i <= choices_no1 + 1; i++) //{ // total = (total + questions[question_no].values[i - 2]); //} objchart2.ApplyDataLabels(); for (int i = 2; (31-i) >14; i++) { datasheet3.Cells[1, i] = teams[31-i].KeyPad; // kj.Item(i - 1).Interior.Color = } for (int i = 2; (31 - i) >14; i++) { // Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); datasheet3.Cells[2, i] = teams[31 - i].points; kj.Item(i - 1).Interior.Color = teams[31 - i].bc; } //second slide objChart1 =objslide1.Shapes[1].OLEFormat.Object; ss = objChart1.SeriesCollection(); // sc.Item(1).Values = 5; // questions[question_no].datasheet = objChart.Application.DataSheet; /* datasheet.Cells[1, 3] = "ali"; datasheet.Cells[1, 4] = "ali"; datasheet.Cells[1, 5] = "ali"; datasheet.Cells[2, 4] = kk.Count; */ //objChart.ApplyDataLabels(); datasheet1 = objChart1.Application.DataSheet; //float total = 0; //for (int i = 2; i <= choices_no1 + 1; i++) //{ // total = (total + questions[question_no].values[i - 2]); //} objChart1.ApplyDataLabels(); for (int i = 2; (i - 2) < teams1.Count; i++) { datasheet1.Cells[1, i] = teams1[i - 2].KeyPad; // kj.Item(i - 1).Interior.Color = } for (int i = 2; (i - 2) < teams1.Count; i++) { // Graph.DataLabel label = ss.Item(1).DataLabels(i - 1); datasheet1.Cells[2, i] = teams1[i - 2].time; kj = ss.Item(1).Points(); kj.Item(i - 1).Interior.Color = teams1[i - 2].bc; } }