private void viewGraphic_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(country1.Text) && !String.IsNullOrEmpty(country2.Text) && !String.IsNullOrEmpty(country3.Text)) { viewGraphic.Enabled = false; country1.Enabled = false; country2.Enabled = false; country3.Enabled = false; clearBtn.Enabled = true; chart1.Titles.Add("Female suicides of the countries " + country1.Text + ", " + country2.Text + " and " + country3.Text); chart1.Series["s1"].IsValueShownAsLabel = true; chart1.Series["s1"].Points.AddXY(country1.Text, mc.DeathsCountByGender("female", country1.Text)); chart1.Series["s1"].Points.AddXY(country2.Text, mc.DeathsCountByGender("female", country2.Text)); chart1.Series["s1"].Points.AddXY(country3.Text, mc.DeathsCountByGender("female", country3.Text)); } else { MessageBox.Show("One of the fields is empty. Please enter all the countries"); } } catch (Exception) { MessageBox.Show("Make sure the countries you entered are well written "); } }
private void graphicBar_Load(object sender, EventArgs e) { string[] series = { "Women", "Men" }; int[] puntos = { mc.DeathsCountByGender("female"), mc.DeathsCountByGender("male") }; chart1.Palette = ChartColorPalette.Pastel; chart1.Titles.Add("Deaths of men and women over the years worldwide"); for (int i = 0; i < series.Length; i++) { //titulos Series sr = chart1.Series.Add(series[i]); //cantidades sr.Label = puntos[i].ToString(); sr.Points.Add(puntos[i]); } }
private void viewGraphic_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(country1.Text) && !String.IsNullOrEmpty(country2.Text) && !String.IsNullOrEmpty(country3.Text)) { viewGraphic.Enabled = false; country1.Enabled = false; country2.Enabled = false; country3.Enabled = false; cleartBtn.Enabled = true; string[] series = { country1.Text, country2.Text, country3.Text }; int[] puntos = { mc.DeathsCountByGender("male", country1.Text), mc.DeathsCountByGender("male", country2.Text), mc.DeathsCountByGender("male", country3.Text) }; chart1.Palette = ChartColorPalette.Pastel; chart1.Titles.Add("Deaths of men over the years in the countries " + country1.Text + ", " + country2.Text + " and " + country3.Text); for (int i = 0; i < series.Length; i++) { //titulos Series sr = chart1.Series.Add(series[i]); //cantidades sr.Label = puntos[i].ToString(); sr.Points.Add(puntos[i]); } } else { MessageBox.Show("One of the fields is empty. Please enter all the countries"); } } catch (Exception) { MessageBox.Show("The country you have wrote is not in the data base, make sure you wrote it the right way."); } }