We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cannot bind a RangeColumnSeries in c#

Thread ID:

Created:

Updated:

Platform:

Replies:

129415 Mar 16,2017 11:32 AM UTC Mar 20,2017 04:01 AM UTC UWP 3
loading
Tags: SfChart
fmgstocks
Asked On March 16, 2017 11:32 AM UTC

I am using the following code to set up a rangecolumnseries object.


            RangeColumnSeries1.ItemsSource = this.MySourceData;
            RangeColumnSeries1.XBindingPath = "Name";
            RangeColumnSeries1.High = "High";
            RangeColumnSeries1.Low = "Low";
          


The MySourceData object is a collection of records that have public double properties for High and Low.  After the code runs the HighValues property has a count of 0 despite there being values in MySourceData. So the graph is empty. 

How do I programmatically get my High/Low values into the Chart Object.

Thanks folks.



Devi Aruna Maharasi Murugan [Syncfusion]
Replied On March 17, 2017 09:05 AM UTC

Dear Customer, 
  
Thanks for contacting Syncfusion Support. 
  
We have prepared a demo sample by creating RangeColumnSeries in code behind. Please find the code snippet, 
 
SfChart chart = new SfChart(); 
RangeColumnSeries rangeSeries = new RangeColumnSeries(); 
rangeSeries.ItemsSource = new ViewModel().Collection; 
rangeSeries.XBindingPath = "XValue"; 
rangeSeries.High = "High"; 
rangeSeries.Low = "Low"; 
chart.Series.Add(rangeSeries); 
 
 
ViewModel.CS 
 
public class ViewModel 
{ 
    public ObservableCollection<Model> Collection { get; set; } 
    public ViewModel() 
     { 
       Collection = new ObservableCollection<Model>(); 
 
       Collection.Add(new Model() { XValue = 1, High = 604, Low = 595 }); 
       Collection.Add(new Model() { XValue = 2, High = 602, Low = 595 }); 
       Collection.Add(new Model() { XValue = 3, High = 608, Low = 594 }); 
       Collection.Add(new Model() { XValue = 4, High = 619, Low = 604 }); 
       Collection.Add(new Model() { XValue = 5, High = 608, Low = 594 }); 
     } 
} 
 
 
  
The demo sample can be downloaded from below link, 
  
  
Please find the output screenshot, 
 
 
  
Regards, 
Devi 





fmgstocks
Replied On March 18, 2017 02:04 PM UTC

Thanks Devi,

My code was the same as far as I can tell except I created the chart in XAML.  Anyway, when I do everything in code following your example it works.  Much appreciated.



Devi Aruna Maharasi Murugan [Syncfusion]
Replied On March 20, 2017 04:01 AM UTC

Dear Customer, 
  
Thanks for your update. 
  
Please let us know, if you need any further assistance on this. 
  
Regards, 
Devi 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;