This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi There, If you have a 4 lineseries with 1000 points each(in my case x-axis is datetime), You can noticeably see the performance issue. We really need to have 50 lines each with 1000 points to be faster. (we reduce 1000 line to 50, but the performance is really not that great at all). Since our software is doing scientific research analysis, so show 50 lines is a must. Right now, the customer is a bit upset with us for the performance. Our previous version which use Dundas as graphics is more smooth. Is that possible to improve the performance? Thanks Gordon |
|
|
Hello Gordon I'll look into this scenario for you this week to see if anything can be done. Jason Fauchelle |
|
|
Hello Gordon This week I put some time looking into this but haven't come up with any ideas to improve the performance of a chart with many series. I will however continue to look into this for you next week. Jason Fauchelle |
|
|
Hello Gordon So far I've been able to improve the performance by almost 20% (according to profiler results) for loading data, dynamic updates and interaction. Interaction is still lagging with 50 series, but it's a start. This improvement will be available in the next nightly build. Jason Fauchelle |
|
|
Hello Gordon I've made some significant improvements to the charting performance today. On my machine, loading 300 lines with 1000 points each takes less than 5 seconds. This performance boost will be available in the next nightly build for you to try out. I will continue working on further improvements. Jason Fauchelle |
|
|
Hi Jason, I don't know how you did it in such a short time. You are right, it is takes about 5 seconds to load 300 lines with 1000 points each line. I am again very impressive. Thanks, Gordon |
|
|
Hello Gordon Great to hear you're pleased with the performance improvements in your app. I've done another round of improvements that drops the loading time down to 3 seconds. All the improvements will be available in the next nightly build for both versions 5.1 and 6.0. Jason Fauchelle |
|
|
Hello Gordon I've managed to squeeze almost 1 more second off the loading time for 300 lines with 1000 points each. This improvement will be available in the next nightly build for 5.1 and 6.0. With these improvements, you could now sacrifice more performance to display more lines if you wanted to. Displaying 5000 lines with 1000 points each takes less than 30 seconds which is much improved. This is about how long it used to take to display 300 lines. This could be improved even further using the techniques I describe below. There are a couple of things you can now do at your end to get the best performance possible: 1) In the next nightly build you'll find a new IChartDataExtractor interface. Implementing this is an alternative to setting the XBinding and YBinding properties. It allows you to manually bypass the general PropertyInfo to go straight to the source of the data which is almost twice as fast. Say for example you have a custom data point model like this:
You could implement a data extractor like this:
See that the GetX and GetY methods know exactly how to get the x and y values. This is much faster than using the all-purpose XBinding and YBinding to find the data. You can use an instance of such a data extractor to set the new DataExtractor property on the appropriate DataSeries. Then you no longer need to set the XBinding and YBinding properties of that series. Note that you don't need to use this approach all across your application, only on the charts that have many data series or generally bad performance. 2) Last of all, you can calibrate the balance between performance and accuracy. If you can afford to lose a few points in each line, create an instance of FixedSampleCountSampler and set the MaxDataPointCount property to be the desired number of points you'd like to be displayed on each line. The default is 400. So if you set this to 200, you'd display half as many points, but the chart would load twice as fast. It's up to you to find the right value based on how much data you need to show versus how fast you need it to load. The sampler instance can then be used to set the DataSampler property of the appropriate series. Let me know if you have any questions. Jason Fauchelle |
|
|
Thanks Jason for working so hard to improve the performance and your boss should give you a big bonus for such a efficient work. 1) For the first suggestion, it is very good that we can have a choice to go to the data directly and improve the performance. If I implement this, can I still using ToolTipBinding for non lineseries and it still work? 2)For 2nd suggestion, Will it work for both LineSeries and ScatterSeries? i.e.:
Can it still keep the same shape as before? What kind of mechanism you use for sampling? |
|
|
Hello Gordon 1) Yes, ToolTipBinding is unaffected by implementing IChartDataExtractor. As long as your data point models have a property to provide the tooltip value, ToolTipBinding will get it. 2) No, the data sampler will only work on line-based series (line, area, spline stacked etc) and bar series. Scatter series has a more complex mechanism built into it to sample the data points. The only customizability this has is to turn it off using the AllowsDataSampling property. This mechanism is good at improving the performance by cutting down the number of displayed data points while still making sure outlying data points are still displayed. In general it will display up to 500 points. It is accurate at displaying the shape of the data, but obviously not as good as displaying every data point. I know your product requires high accuracy, so you may want to experiment with turning it off to see if there is much difference. By default, line charts will always show the correct data of course, but not necessarily the most accurate shape. By enabling the IsMinMaxSamplingEnabled property like you have done in your code snippet, you will get the most accurate shape possible but sacrifice a bit of performance. (only about half a second at the most for rendering 300 lines with 1000 points each). By the way, MaxDataPointCount is a property on the FixedSampleCountSampler, not on the data series as you've got in your code snippet :) Jason Fauchelle |
|
|
Hi Jason, Thanks for the improvement. It is probably the fastest wpf graph tools in the world now. I have a little bit concerns here about the number of points in the curve, since I did not know how many points you put on on a line: Even I set AllowsDataSampling = false, on the LineSeries, it still Set LineSeries.DataSampler = FixedSampleCountSampler with Max number default to 400. in this case Does it uses Data Sampling at all? It is always LineSeries.DataPoints.Count = 0 when I checked it on the run time. If I set AllowsDataSampling = false, I want all the points to be plot no matter which data series I use. |
|
|
Hello Gordon If you set AllowsDataSampling to be false, then the chart will stop using the data sampler, and will render all points. This is respected by all different types of series. Also make sure to set IsMinMaxSamplingEnabled to False because this is an alternative sampling technique separate from the DataSampler. The FixedSampleCountSampler(400) is the static default for all data series. This is only used if AllowsDataSampling is true. You can ignore the DataPoints collection. This is only used if chart symbols are displayed. If you render a chart with 10,000 points with AllowsDataSampling on and off, you will see the difference in performance so that you can see this property works as expected. Jason Fauchelle |
|