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

Resetting controls

1 Answer 65 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Keith Stephens
Top achievements
Rank 1
Keith Stephens asked on 16 May 2011, 03:36 PM
Hello,
In the attached screen shot you will see on the left side I have 3 drop down boxes and below them I have a list of employees.
The drop down boxes are Division, region, branch.  Upon choosing these it filters the employees to show.
When the user selects an employee then I populate the information on the right side. I am mainly concerned about the pie chart, the bar chart, and the radgrid.

I need to get 2 things done, and I don't know how to get this accomplished.

1. When an employee is selected I need in the bar chart that employee's bars to be a diffenent color, shows that this employee is selected.  http://www.telerik.com/community/forums/aspnet-ajax/chart/change-color-of-bars-for-selected-user.aspx corresponding help request.

2. When the user chooses another division, region or branch, I need the pie chart, bar chart, and radgrid to blank out.

The Division, Region, Branch and employee listing are in a user control. The radgrid is in a user control.  The chart on on the page I am using the sqldatasource control to do my binding. 

All controls are in an Ajax update panel.  I have an event handler which fires when an employee is selected for populating that employees info for the right side of the page.  I have tried this with selecting of Division, Region and branch but it did not work.
In this event I tried setting the datasource to null and rebinding, I tried .RemoveSeries but nothing has worked.

A small working sample would be very helpful.  In item 1 above in the other post they just supplied a few lines of code, not sure where to put that code ect...

If I need to supply specific code or anything else just let me know.
Thanks,
Keith.

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 19 May 2011, 02:48 PM
Hi Keith Stephens,

In the attached file you can find a sample project which demonstrates how to change the colors of the bars according to a DropDownList selection. As it is already described in this forum post, you can achieve that through the RadChart.Series[i].Appearance. For example:
radChart1.Series[0].Appearance.FillStyle.MainColor = Color.Red;
radChart1.Series[0].Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

When you select another division, region or branch, you can clear the RadChart.Series collection, until a new employee is selected and after that fill them again. For example:
radChart1.Series.Clear();

In the sample project, I am using two buttons to demonstrate this approach. The "ClearData" button clears the series and the "PopulateData" button populates the data again. You can also change the default EmptySeriesMessage:
radChart1.PlotArea.EmptySeriesMessage.TextBlock.Text = "My custom empty series message";

You can review the online help topic about "How Do I Assign Individual Colors to Bars?" here.

I hope that this information helps.

All the best,
Polina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Chart (Obsolete)
Asked by
Keith Stephens
Top achievements
Rank 1
Answers by
Missing User
Share this question
or