Hi Experts,
Recently we have a request to create screenshots of waveforms, we implement this with WPF RenderTargetBitmap to save the graph grid to a image file. Since we have a lot of waveforms to save, so in a loop, we set the DataSource of the viewmodel each time and show the window, then in the window's Window_ContentRendered event to save the grap image. But the problem is that, when the data source is large, for example, 4 channels with 1M ponits of each channel, some of the generated image file lost the plot area. See the attached pictures.
Lost waveform
Correct display waveform
Here is the code we use the graph:
And here is how we handle the Window_ContentRendered event:
Usually, when the datasource is 4*1M, we have about 10 images lost every 100 pictures, if the data source is 4*100k, only few lost images. But on some old machines, even 4*100k will also lost about 20% images.
According to my understanding, when the window_contentRendered event is triggered, the NI Graph should already complete rendering the image, I don't know why we lost the waveforms when saving to image file. Is there any other event I should use to save the WPF Grid as a image? Thanks in advance.