【发布时间】:2012-03-28 13:46:20
【问题描述】:
我有一个包含多个系列的图表。我正在使用 ChartColorPalette 为每个系列自动设置不同的颜色。
在那一刻,当我创建我的系列时,我想读取颜色以给 dropDownList.listItem 相同的背景颜色。但不幸的是,在那一刻,颜色仍未设置。
系列是否有可能在 ASP.NET 的 Rendering-Event 后期从 ChartColorPalette 中获取颜色定义?
或者我做错了什么?
Chart newChart = new Chart();
newChart.Palette = ChartColorPalette.Bright;
Series newSeries;
foreach (....)
{
newSeries = new Series();
newChart.Series.Add(newSeries);
// no color found :(
string colorName = newSeries.Color.Name
// same here
string colorName = newChart.Series[identifier].Color.Name;
myDropDownList.Items.FindByValue(identifier).Attributes.Add("style", "background: " + colorName + ";");
}
【问题讨论】:
-
你的代码中不应该是 newSeries 而不是 Newseries 吗?