Ajax饼图C#修改属性

时间:2013-07-30 15:08:49

标签: c# ajax pie-chart

这是我的饼图现在的图像

enter image description here

以下是它的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";

我需要将底部值对齐到左边,这样我才能看到它们。我也希望能够手动设置颜色,这样就没有重复了。感谢。

1 个答案:

答案 0 :(得分: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";