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

Reverse Series Style?

1 Answer 93 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 30 Jul 2009, 05:27 PM
I am new to Telerik -

I am using the "Telerik" skin for a pie chart, stacked bar and stacked bar 100% chart. Each charts data source is bound at runtime.

The Telerik Skin produces a blue complex gradient as the series one value and a complex green gradient as the series two value.

Is there anyway to reverse, control or otherwise modify the series color when binding at runtime other than manually setting the FillSettings in the ItemDataBound event? (which works fine).

Am I correct that this is the only way because the built in styles are essentially compiled into the Telerik.Web.UI assembly?

Thanks,
Richard

1 Answer, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 03 Aug 2009, 09:51 AM
Hello Richard,

For the pie series -- this is the correct way. Here is the reason -- there is no way to set the pie slices appearance before they even exist.

For StackedBar and StackedBar100 series -- if you need to provide different color for each individual bar you will need to use the same approach as with the pie series due to the very same reason. However, if you are fine with the default chart behavior -- all the series items use the same color (but you need to customize it) -- you can choose:
  • Use ItemDataBound event to set each item's appearance (you have already found this)
  • Use DataBound event to set each series appearance, one setting for the entire series
  • Use the DataYColumn property of the ChartSeries object and set the appearance for the series. More details about this one:
When databinding RadChart you can let RadChart generate series for you or you can supply your own series. If you simply set the DataSource property RadChart will create a ChartSeries for each numeric field/column in the datasource. Alternatively, you can create ChartSeries objects and add them to RadChart.Series collection. In this case if you set the ChartSeries.DataYColumn property to the name of a field or column in the datasource, RadChart will not create series but it will only populate those you have created. This way you can customize the series appearance declaratively.

I have attached a small example showing this.

Sincerely,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart (Obsolete)
Asked by
Richard
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or