用饼图添加用户名

Add user name with pie chart

我对饼图很陌生,我有一个饼图可以显示到 hh:mm:ss 的秒数,但我还需要包含用户名,这是我的代码。

   string easystone = ConfigurationManager.ConnectionStrings["easystone"].ConnectionString;

    SqlConnection con = new SqlConnection(easystone);
    SqlDataAdapter graph = new SqlDataAdapter("SELECT[User] , sum(time) as [time] FROM avgtime3 group by[user]", con);
    DataTable graphdata = new DataTable();
    graph.Fill(graphdata);
    chart1.DataSource = graphdata;
    chart1.ChartAreas["ChartArea1"].AxisX.Title = "";
    foreach (DataRow row in graphdata.Rows)
    {
        int total = (int)row["time"];
        int index = chart1.Series["Series1"].Points.AddXY(row["User"], new object[] { total });
        chart1.Series["Series1"].Points[index].Label = // I need the username to go here.
        chart1.Series["Series1"].Points[index].Label = string.Format("{0:00}:{1:00}:{2:00}", (total / 60) / 60, (total / 60) % 60, total % 60);
    }

在用户名前加上时间前缀。

chart1.Series["Series1"].Points[index].Label = row["User"].ToString() + " : " + string.Format("{0:00}:{1:00}:{2:00}", (total / 60) / 60, (total / 60) % 60, total % 60);