Customize Telerik RadCartesianChart XMLDataProvider

2 posts, 0 answers
  1. 선희
    선희 avatar
    1 posts
    Member since:
    Nov 2017

    Posted 16 Nov Link to this post

    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.

     

     

     

     

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1475 posts

    Posted 20 Nov Link to this post

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