Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
Chart , Multi-Series , Dynamic DataBinding , Path ?
posted

Hi Infragistics, as a helloworld exercise, I've got a line series , databound dynamically to a datastructure as follows:

 public class MyDataCollection : ObservableCollection
 {

xaml:   

works fine, all is well.

However, my goal -- What I am trying to do -- is databind to a member property , and not a single object, so as to support multple series:

 public class MyDataCollection
 {

public  ObservableCollection series1;

public  ObservableCollection series2;

public  ObservableCollection bubble1;
 

and in the xaml

<ig:LineSeries x:Name="line1" ItemsSource="{Binding Path=series1}" ValueMemberPath="myvalue"  ...

<ig:LineSeries x:Name="line2" ItemsSource="{Binding Path=series2}" ValueMemberPath="myvalue"  ...

<ig:BubbleSeries x:Name="bubble1"  ItemsSource="{Binding Path=bubble1}" XMemberPath="week" ....

The binding path doesn't appear to be working.  What's up with this? do you have a sample ( simple sample ) with dynamic databinding of multiple series ?

This is 15.2

Parents
  • 34430
    Offline posted

    Hello Martin,

    From the sample code that you have provided, I wouldn't expect that you would be able to bind to your ObservableCollections series1, series2, or bubble1, as you are missing the get and set declarations to actually make them properties. Binding to multiple collections in this case may not actually help you, though, especially if your CategoryXAxis or CategoryDateTimeXAxis is shared between your two LineSeries. You would need to have the same number of categories, with the same values in your series1 and series2 collection as in the collection that is bound to the shared CategoryXAxis, otherwise, you would not see anything in the XamDataChart.

    Instead, I would probably recommend a separate property on your MyDataPoint class so that you can modify the ValueMemberPath in each of your LineSeries, but keep them bound to the same collection. If you wanted to do this dynamically, and possibly "add a property" at runtime, I would recommend using a DataTable for this, as each of the Columns could serve as its own property, and you could add columns and series corresponding to those columns at runtime.

    For more about hosting multiple series in the XamDataChart at one time, I would recommend that you see the following article in our online documentation: http://help.infragistics.com/doc/WPF/2015.2/CLR4.0/?page=DataChart_Multiple_Series.html.

    I hope this helps you. Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

Reply Children