Using enumerable index as x coordinate in RadCartesianChart

4 posts, 2 answers
  1. Alexander
    Alexander avatar
    77 posts
    Member since:
    Apr 2013

    Posted 09 Apr 2014 Link to this post

    Hello,

    I am binding the ItemsSource of a ScatterLineSeries to some Linq Enumerable.
    Is it possible to use the index (and not some property inside of the item) as x-coordinate?

    Additionally, is it possible to specify a dot-separated path inside the XValueBinding (e.g. XValueBinding="Parent.X1")?

    Thank you in advance!

    Alex
  2. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 10 Apr 2014 Link to this post

    Hi Alexander,

    1. Is it possible to use the index (and not some property inside of the item) as x-coordinate?
    If you are in a scatter mode, this is not possible (scatter mode is when you are using two linear axes and scatter series). If you are using a categorical series (and at least one categorical axis) you will achieve the desired effect by only setting the ValueBinding and not setting the CategoryBinding property at all.

    2. is it possible to specify a dot-separated path inside the XValueBinding
    You can use a GenericDataPointBinding:
    series1.ValueBinding = new GenericDataPointBinding<YourBusinessObject, double>
    {
      ValueSelector = dataItem => dataItem.Smth.Val
    };

    Regards,
    Petar Marchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Alexander
    Alexander avatar
    77 posts
    Member since:
    Apr 2013

    Posted 10 Apr 2014 in reply to Petar Marchev Link to this post

    Thank you. I think that will help me.
    Just one other question: Is it possible to specify an offset for the Categorical axis? So that it does not start with 1, but with any other number?

    Alex
  5. Answer
    Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 10 Apr 2014 Link to this post

    Hi Alexander,

    1. Is it possible to specify an offset
    When not setting a CategoryBinding, the chart internally assigns the Category of the DataPoint to be an index. Starts from 1. You cannot change this internal logic, but if you need, you can assign the CategoryBinding property and the axis will show what you need.

    Regards,
    Petar Marchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top