Real-time Column chart

Hello SF team,

I need to use a Column Series chart in my WPF application. 

The X-axis data for the chart is picked up from Serial Port on real-time basis at interval of 1-second. Lets say in a List<int>(). The Y-axis would be fixed for 0 to 100.

The chart should update accordingly. At a time max. 24 columns would be shown in the chart.

And thereafter it should rollover like 'moving-window' scenario.

I am totally new to SF and this would be the very first time I would be using (any) SF control.

I did go through basic tutorial of SF Column chart.  But its pretty text-book kind of tutorial and I could not find one for real-time data. Also, my application is not using MVVM or any other design pattern.

Could you please help me with relevant sample code?

Thanks!


5 Replies 1 reply marked as answer

YP Yuvaraj Palanisamy Syncfusion Team September 7, 2021 04:49 AM UTC

Hi Jaywant Kulkarni, 
 
Greetings from Syncfusion. 
 
We have analyzed your query and you can achieve your requirement “Real time chart in wpf” with the help of below document. 
 
 
Also, for more details please refer the below link about the SfChart in wpf 
 
Regards, 
Yuvaraj 



JK Jaywant Kulkarni replied to Yuvaraj Palanisamy September 7, 2021 08:27 AM UTC

Dear @Yuvaraj,

Thanks a lot for super quick reply!

Really a simple and working example. 

Though the sample is for LineSeries, I could figure out to tweak for ColumnSeries.

This is really helpful and close to my requirement.


Now I will work on the real thing and get back if any further help required.

Thanks again!


Cheers!

Jaywant 



GM Gayathri Manickam Syncfusion Team September 8, 2021 05:43 AM UTC

Hi Jaywant, 
 
Thank you for your update. We are glad to know that the provided solution works at your end. 
 
Please let us know if you have any further assistance. 
 
Thanks, 
Gayathri M 



JK Jaywant Kulkarni September 8, 2021 04:51 PM UTC

Hi,

As I tweaked the sample code, 

I am getting NullReference exception.

Please see attached files.

DataGenerator (.cs & .xaml) - orginal sample code - works perfectly.



THDVChart(.cs & .xaml) - my tweaked code - throws exception at line no 36.


Please help.

Thanks!


Attachment: tmp_87ad9cf.zip


GM Gayathri Manickam Syncfusion Team September 9, 2021 11:40 AM UTC

Hi Jaywant, 
 
We have analyzed your query and you can resolve the exception by initializing a property for the XData in the model and bind the property to the XBindingPath in the ChartSeries. Please refer below code snippet and modified sample. 
 
XAML:  
<chart:SfChart x:Name="THDVChart" Margin="0,10,19.8,0" AreaBorderThickness="0,1,1,1" Header=" " Palette="Custom" > 
  . . .          
   <chart:FastColumnBitmapSeries Label="A" XBindingPath="Date" 
   YBindingPath="Rph" LegendIcon="Rectangle" StrokeThickness="1"  
   ItemsSource="{Binding DynamicData}"/> 
             
</chart:SfChart> 
 
 
Thanks, 
Gayathri M. 


Marked as answer
Loader.
Up arrow icon