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

ChartSeriesItem Visible Property

1 Answer 52 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lam
Top achievements
Rank 1
Lam asked on 09 Oct 2012, 06:46 PM

For testing, I have a pie chart with 8 items.  The YValue of the item will be set in the NeedDataSource event. Since I am using the Telerik skin, the first item is green, second is yellow, third is red, and so on.  I need to have these color consistent since I will be referencing the color elswhere on the report.

Item1 = green
Item2 = yellow
Item3 = red
Item4 = blue

If I add only the items that have non-zero value the color will not be consistent.   For example, Item2 is zero then if I add Item1 then Item3:

Item1 = green
Item3 = yellow
Item4 = red
Item5 = blue

I need to make some of the items invisible.  However, setting Visible = false does NOT hide the item.  Suggestion?

I also tried the Remove() method but I get "An eroor occured while processing Chart... Object reference not set to an instance of an object."

foreach (ChartSeriesItem i in responseSeries.Items)
{
    ...
    if (i.YValue == 0)
    {
        i.Visible = false;                   
    }
   ...
}

 

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Oct 2012, 11:41 AM
Hi Lam,

The chart's automatically created series are generated in the report processing and they are immutable. Thus our suggestion is to setup the chart series based on data as elaborated in the Creating Chart Programmatically help article. 

All the best,
Peter
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Lam
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or