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

Customize Telerik RadCartesianChart XMLDataProvider

1 Answer 39 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
선희
Top achievements
Rank 1
선희 asked on 16 Nov 2017, 07:40 AM

I have WPF application RadCartesianChart

This is the code of one of them......

  <telerik:RadCartesianChart x:Name="RadChart1"     Palette="Windows8"  DataContext="{Binding XPath=/Nodes/Node,Source={StaticResource xml_Chart}}">

            <telerik:RadCartesianChart.HorizontalAxis>
                <telerik:CategoricalAxis Background="#FFF50000" />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
                <telerik:LinearAxis />
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.Series>
                <telerik:BarSeries CategoryBinding="{Binding XPath=@shortTime}"
                                   ValueBinding="{Binding XPath=Item/@value}"
                                   ItemsSource="{Binding}"   ShowLabels="True">
                </telerik:BarSeries>
            </telerik:RadCartesianChart.Series>
       </telerik:RadCartesianChart>
     =============================================================

I want to work with xml..

<telerik:BarSeries CategoryBinding="{Binding XPath=@shortTime}"
                                   ValueBinding="{Binding XPath=Item/@value}"
                                   ItemsSource="{Binding}"   ShowLabels="True">
                </telerik:BarSeries>

I can not run it. Help..... Thanks.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 20 Nov 2017, 02:56 PM
Hello,

The chart's value binding properties doesn't work with XMLDataProvider out of the box. To achieve your requirement you can set the chart's ValueBinding and CategoryBinding properties in code using the GenericDataPointBinding class. Read more about this in the Create Data-Bound Chart article. Basically, you can use the ValueSelector of the GenericDataPointBinding to assign a function that gets the values for the chart's data points from the data provider. 

I hope this helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
General Discussions
Asked by
선희
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or