여러 시리즈가있는 차트가 있습니다. foreach Series를 자동으로 다른 색상으로 설정하려면 ChartColorPalette를 사용하고 있습니다.ChartColorPalette를 사용할 때 런타임 중에 Series.Color를 읽으려면 어떻게해야합니까?
그 순간, 시리즈를 만들 때 Color를 읽고 dropDownList.listItem에 같은 backgroundColor를 지정하려고합니다. 그러나 안타깝게도 바로 그 순간에 Color는 아직 설정되지 않았습니다.
나중에 ASP.NET의 Rendering-Event에서 Series가 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을해야하지? – Quantbuff
예. 나는 그것을 고쳤다. – Zahnfee