This project is read-only.

Line Graph Performance

Jun 15, 2010 at 4:49 PM
Edited Jun 15, 2010 at 5:36 PM
I am making a line graph to display a decent amount of data at once. However, when I have about 9,000 points on the screen at once, panning and zooming can be very slow and laggy.

However, sometimes there can be more points than this (when zoomed out) and it pans and zooms fine.

Is there any way for me to fix this?...I'm hoping that I'm just doing something wrong with the way I am adding data:

ObservableDataSource<float> testOdsY1 = new ObservableDataSource<float>(channelData1);
ObservableDataSource<float> testOdsY2 = new ObservableDataSource<float>(channelData2);
ObservableDataSource<float> testOdsY3 = new ObservableDataSource<float>(channelData3);
ObservableDataSource<float> testOdsY4 = new ObservableDataSource<float>(channelData4);
ObservableDataSource<float> testOdsY5 = new ObservableDataSource<float>(channelData5);
ObservableDataSource<float> testOdsY6 = new ObservableDataSource<float>(channelData6);
ObservableDataSource<Int64> testOdsX = new ObservableDataSource<Int64>(timestampData);

testOdsY1.SetYMapping(F => F);
testOdsY2.SetYMapping(F => F);
testOdsY3.SetYMapping(F => F);
testOdsY4.SetYMapping(F => F);
testOdsY5.SetYMapping(F => F);
testOdsY6.SetYMapping(F => F);
testOdsX.SetXMapping(I => I);

CompositeDataSource compositeDataSource1 = new CompositeDataSource(testOdsX, testOdsY1);
CompositeDataSource compositeDataSource2 = new CompositeDataSource(testOdsX, testOdsY2);
CompositeDataSource compositeDataSource3 = new CompositeDataSource(testOdsX, testOdsY3);
CompositeDataSource compositeDataSource4 = new CompositeDataSource(testOdsX, testOdsY4);
CompositeDataSource compositeDataSource5 = new CompositeDataSource(testOdsX, testOdsY5);
CompositeDataSource compositeDataSource6 = new CompositeDataSource(testOdsX, testOdsY6);

LineGraph lg1 = topChart.AddLineGraph(compositeDataSource1, "Channel 1");
LineGraph lg2 = topChart.AddLineGraph(compositeDataSource2, "Channel 2");
LineGraph lg3 = topChart.AddLineGraph(compositeDataSource3, "Channel 3");
LineGraph lg4 = topChart.AddLineGraph(compositeDataSource4, "Channel 4");
LineGraph lg5 = topChart.AddLineGraph(compositeDataSource5, "Channel 5");
LineGraph lg6 = topChart.AddLineGraph(compositeDataSource6, "Channel 6");

When it is lagging at its worst, the channel data (channelData1, channelData2, etc. all of which are lists of floats) contain 1530 points each.

But when I am zoomed out, with each channel containing 1700 points each, I can zoom and pan fine.

Please let me know if I am doing something ( or a lot of things :p ) wrong...I hope so because I am really depending on D3 for this project.

Thank you for any help
Jun 15, 2010 at 5:35 PM


please wait for some weeks, we are going to publish DirectX line and marker chart. These charts should resolve your problem. I'm being so unclear in date because this part is being developed by another person and I didn't have time to talk to him to determine exact date.


Jun 15, 2010 at 5:43 PM
Thank you for your quick reply. Please let me know when you get a better estimate of when these DirectX charts will become available. I still feel like it might be an issue on my part, as your "Simulation" sample does a good job with a decently large dataset.
Jun 15, 2010 at 5:46 PM

Can you please send me a sample that can reproduce your problem?

Jun 15, 2010 at 6:14 PM
I won't be able to send my current code. I will try to reproduce the problem another way and get that to you.
Jun 15, 2010 at 6:32 PM
Edited Jun 15, 2010 at 7:09 PM
I just changed my program over to how your simulation sample works (with threading, and appending data) and it still is bad when scrolling/zooming. So I'm not sure where the problem lies anymore.
Jun 15, 2010 at 6:43 PM

The performance is directly related to how many lines WPF is having to draw, so if your points are very close in X and very far apart in Y, then WPF has to draw thousands of long lines and it is not designed to handle this situation with good perfromance. That is why the team is working on a DirectX rendering solution.

Jun 15, 2010 at 8:52 PM
Makes sense, thanks for the input. Here's hoping the DirectX version comes along soon.
Jun 15, 2010 at 9:17 PM
I tried checking out the latest nightly build that looks like it has some DirectX stuff in it, but had a lot of errors getting it up and running. Would the latest nightly give me a good idea of how much better performance I can get out of this?