This is a migrated thread and some comments may be shown as answers.

Setting ChartItem's Color

1 Answer 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark Holdt
Top achievements
Rank 1
Mark Holdt asked on 01 Dec 2009, 12:38 PM
Currently we are programmatically adding values, labels to a chartseries within a Telerik Report.
For each item within the series, we would like to set the Item's MainColor and FillType.

Adding values and labels to ChartSeries
...ChartSeries cs = new Telerik.Reporting.Charting.ChartSeries();
Hashtable ht = ....;
double total = 0;
            foreach (DictionaryEntry de in ht)
                total += (double)de.Value;
            foreach (DictionaryEntry de in ht)
            {
               cs.AddItem((double)de.Value, (String)de.Key + " " + ((double)de.Value / total).ToString("P02"));
            }

The following is where we have problems. For each of the above items, we would like to set the item's color and Filltype:
 
int dcount = 0;
            foreach (DictionaryEntry de in ht)
            {
                cs.Items[dcount].Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
                cs.Items[dcount].Appearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(14, 55, 147);
                dcount = +1;
            }

For some reason ,however, not all the items get the above color when rendering the report (it typically works fine for the first few items). 

Not sure how to proceed.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 01 Dec 2009, 04:13 PM
Hi Mark Holdt,

The sporadic coloring that you report is very weird and we have not been able to reproduce it in our local tests. Please take a look at the following forum post that contains more info and sample code that is working fine on our end and let us know what differs on your end.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Mark Holdt
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or