Real time graph

Has anyone come across a library to do real time graphs?

I’ve seen the WinRTXamlToolkit but I can’t get it to work real time.

I am recording seismic data with a geophone and want to show the data in real time on a graph. The graph will be showing the last 24 hours of data and I can zoom in if I see something I want to see in more detail.

I assume you talking about graphing from NETMF on a connected display? If sending the data to the Cloud and viewing the graph via browser is an option then there is of course Azure & PowerBI or even better if you need high sample rates and robust graphing capabilities there is Initial State.

Syncfusion now offers a free ‘community’ version of their libraries, which include not only realtime zoomable charts, but a 600 or so other useful controls including grids, trees, prop list, ribbons and dockable windows. They support winforms, wpf, winrt, xamarin (including android and iOS), asp.net and silverlight, all with the same programming model, plus javascript and a half dozen other platforms. This library has been a real boon to me.

The community version is free for your first app. The commercial version is around USD$1000, if I recall correctly.

See : [url]Over 1,700 UI components for .NET and JavaScript | Syncfusion

EDIT: Caveat: all that stuff will require about 1.1Gb of download and even more to install. But I haven’t regretted it yet.

So sorta like the cpu utilization graph on windows iot?

Correct. I want it local, not on the cloud for the time being.

I have the PI native display and would like to show the live data on this. I also want to be able to review data from previous days etc.

I’ll check this one out. It’s a hobby project for now but if the library is good I might consider it for other commercial work later.

How fast does the data have to move? Its seismic right? I’m thinking you can compose multiple successive jpgs and display them one after the other? I don’t have a solution for ya, I’m just wondering about your requirements.

Data is sampled 10 times per second.

@ Dave McLaughlin - Hi Dave, I used
“A simple C# library for graph plotting” by Stephan Zimmermann"
in my CodeShare entry for the Olimex ECG
https://www.ghielectronics.com/community/codeshare/entry/1036
but the library is for Windows Forms Application and needed to be adapted to Windows IOT.
Zooming in is not realized

So this solution has to run at least 10fps, on WinIot?

I’ve downloaded and installed this and I can get the graph on the screen but I don’t see any data showing when I use the following code. I’ve looked through a number of samples and don’t see that I am doing anything wrong.

This is the xaml file


        <Charts:SfChart Name="sensorChart" Header ="Seismic" HorizontalAlignment="Left" Height="368" VerticalAlignment="Top" Width="800">
            <Charts:SfChart.PrimaryAxis>
                <Charts:DateTimeAxis Name="xAxis" Header="Time" IntervalType="Minutes" Interval="60" FontSize="14"/>
            </Charts:SfChart.PrimaryAxis>

            <Charts:SfChart.SecondaryAxis>
                <Charts:NumericalAxis Header="Signal Level" FontSize="14" Minimum="-1.8" Maximum="1.8"/>
            </Charts:SfChart.SecondaryAxis>
        </Charts:SfChart>

and this is the code I put in the xaml.cs file


sensorData = new LineSeries();

sensorData.XBindingPath = "time";
sensorData.YBindingPath = "value";
sensorData.EnableAnimation = true;
sensorData.AnimationDuration = new TimeSpan(0, 0, 1);
sensorData.ItemsSource = chartList;
sensorChart.Series.Add(sensorData);

xAxis.Minimum = DateTime.Now;

and then I use this to update the list data


chartList.Add(new chartData { time = DateTime.Now, value = sensorVoltage});

charData is a simple class as follows:


        public class chartData
        {
            public DateTime time { get; set; }
            public double value { get; set; }
        }

Appreciate any pointers to why it don’t work?

I got it working. I change the List<> to an ObservableCollection<> and now the graph is drawing.

Really nice library once you figure out how it works. :slight_smile:

Not so good for real time. As I full up the graph it slows down.

What I think I need to do is write my own where I redraw the graph with the data points that have been recorded and then only plot the new points as they are added. This one redraws the whole graph each time and with around 18,000 points every 30 mins, it is slowing down too much.

Why are you using heavy objects to do this. Just use an array with the correct values.

I tried a List<> array but it doesn’t display anything with that.

@ Dave McLaughlin

Try this:

[url]https://binarysculpting.com/2012/04/03/adding-many-entries-to-an-observable-collection-in-a-performance-friendly-way/[/url]
[url]https://peteohanlon.wordpress.com/2008/10/22/bulk-loading-in-observablecollection/[/url]

1 Like