Reverse Series Style?

Thread is closed for posting
2 posts, 1 answers
  1. Richard
    Richard avatar
    4 posts
    Member since:
    Jun 2009

    Posted 30 Jul 2009 Link to this post

    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?

  2. Answer
    Ves avatar
    2927 posts

    Posted 03 Aug 2009 Link to this post

    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.

    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.
Back to Top