Hello, I have a real-time graph which should display gaps from time to time. I tried to use NaN values but I am getting System.OverflowException after application runs for some time. Attached the sample project that demonstrates the problem. Thanks.
I ran your project and noticed that the plot's ProcessSpecialValues property was set to false. Set the plot's ProcessSpecialValues property to true and your application will behave correctly.
ProcessSpecialValues means the plot will process NaN and Infinity values. GDI+ by itself cannot handle NaN and Infinity values.
The problem is that you do not have the ProcessSpecialValues property on the plot set to true. The plot has to perform a lot of extra processing to handle NaN and +/-Infinity values, which can have a negative impact on performance. ProcessSpecialValues lets you choose if you want to take the performance hit. Most applications do not work with NaN and +/-Infinity values, so the default value is false in the interest of performance. For more information, see the Knowledge Base article "Why Does Plotting NaN or Infinity Values Generate an Exception Using .NET Graph Controls?".