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

Binding Single Objects to a RadCartesianChart's BarSeries

1 Answer 175 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 18 Jan 2013, 09:57 PM
Hey there, I'm creating a project where I want to display attributes of specific objects in a chart. For example, I have 2 different loan objects (Current Loan and Proposed Loan) and I want to display each one of those object's "Tax Savings" in a bar chart. I am trying to do something EXACTLY like this:

http://www.telerik.com/help/wpf/radchartingkit-series-barseries.html 

But I want the properties themselves to be properties on my objects. I've tried basic bindings and I can't seem to get it to work. The objects bind find throughout my app it's just not functioning here. The code I've got is:

                            <telerikChart:RadCartesianChart Width="500" >

                                <telerikChart:RadCartesianChart.HorizontalAxis>
                                    <chartView:CategoricalAxis/>
                                </telerikChart:RadCartesianChart.HorizontalAxis>
                                
                                <telerikChart:RadCartesianChart.VerticalAxis>
                                    <chartView:LinearAxis/>
                                </telerikChart:RadCartesianChart.VerticalAxis>

                                <telerik:BarSeries>
                                    <telerik:BarSeries.DataPoints>
                                        <telerik:CategoricalDataPoint  Value="{Binding Path=CurrentLoan.TaxSavings}"
                                                  Category="Proposed Loan"/>
                                        <telerik:CategoricalDataPoint  Value="{Binding Path=ProposedLoan.TaxSavings}"
                                                  Category="Current Loan"/>
                                    </telerik:BarSeries.DataPoints>
                                </telerik:BarSeries>

                            </telerikChart:RadCartesianChart>

When It loads, it actually blanks out my entire "View" that the charts are supposed to be in. Any suggestions? Thank you

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 23 Jan 2013, 12:33 PM
Hi Bryan,

CategoricalDataPoint.Value is not a dependency property, so this scenario is not expected to work. You can either populate the values in code or provide an enumerable as ItemsSource for the BarSeries as shown in this example, and let the chart create the bars for you.

Kind regards,
Ves
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ChartView
Asked by
Bryan
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or