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

Bar color binding

1 Answer 67 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 2
Alex asked on 28 Feb 2012, 05:52 PM
Is there any way to bind bar chart single bar color to datasource?

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 02 Mar 2012, 04:46 PM
Hello Alex,

Thanks for using our support.
Please clarify what kind of DataSource you are referring to.
When you have a bar series, each bar can be described by a point template. See for example how to create
an orange bar and a blue bar:

<telerik:BarSeries>
    <telerik:BarSeries.PointTemplates>
        <DataTemplate>
            <Rectangle Fill="DarkOrange" />
        </DataTemplate>
        <DataTemplate>
            <Rectangle Fill="Blue" />
        </DataTemplate>
    </telerik:BarSeries.PointTemplates>
    <telerik:CategoricalDataPoint Category="1" Value="0.9" />
    <telerik:CategoricalDataPoint Category="2" Value="0.6" />
</telerik:BarSeries>

If you know how many bars you will have and if the order of the bars is consistent, you can set different templates for the different bars. Also you can use the PointTemplateSelector property and implement your custom logic (DataTemplateSelector class) for choosing the appropriate bar color.

Please write again if you need further assistance.

Kind regards,
Victor
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Chart
Asked by
Alex
Top achievements
Rank 2
Answers by
Victor
Telerik team
Share this question
or