0

这是我现在的饼图的图像

在此处输入图像描述

这是它的c#代码..

string query = string.Format("select  TestName,Count (TestName) AS Counts from VExecutionGlobalHistory where Tester <> 'dit2988' AND TestTypeID = 1 group by TestName", ddlTests.SelectedItem.Value);
                        DataTable dt = GetData(query);


                        foreach (DataRow row in dt.Rows)
                        {
                            SpecificTestsWeb6.PieChartValues.Add(new   AjaxControlToolkit.PieChartValue
                            {
                                Category = row["TestName"].ToString(),
                                Data = Convert.ToDecimal(row["Counts"]),

                            }
                            );

                        }
                        SpecificTestsWeb6.ChartTitle = "Specific Tests Run";

我需要将底部值向左对齐,这样我才能看到它们。我还希望能够手动分配颜色,以免重复。谢谢。

4

1 回答 1

0
 var random = new Random();

                            foreach (DataRow row in dt.Rows)
                            {
                                var color = String.Format("#{0:X6}", random.Next(0x1000000));

                                SpecificTestsRapp.PieChartValues.Add(new AjaxControlToolkit.PieChartValue
                                {
                                    Category = row["TestName"].ToString(),
                                    Data = Convert.ToDecimal(row["Counts"]),
                                    PieChartValueColor = color
                                });
                            }

                            SpecificTestsRapp.ChartTitle = "Specific Tests Run";
于 2013-08-07T13:27:30.090 回答