using System;
using System.Windows.Forms;
//---------------------------------------
using System.Windows.Forms.DataVisualization.Charting;
using System.Data.SqlClient;

namespace MyChart2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string strConn = "Server=.;" + "DataBase=MyTestDB3;" +
                             "Integrated Security=True";
            
            string strQuery = "Select Team_Name, Score From Teams";
            
            SqlConnection sCon = new SqlConnection(strConn);
            SqlCommand sc = new SqlCommand(strQuery, sCon);
            chart1.DataSource = sc;
            
            chart1.Series["Series1"].XValueMember = "Team_Name";
            chart1.Series["Series1"].YValueMembers = "Score";
            
            chart1.Series["Series1"].ChartType = SeriesChartType.Doughnut;
            chart1.Series["Series1"].IsValueShownAsLabel = true;
            chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
        }
    }
}