01-26-2011 01:04 PM
Hello,
can somebody please help me with the following WavefromGraph-problem:
I have a WaveformGraph with one XAxis. Attached to this graph there are many plots each plot have its very own YAxis but are sharing one and the same XAxis (the default one of the graph).
I set the default increment to 0.5 seconds each time a value is appended using PlotYAppend(double data). So far so good, here comes the problem I am not able to solve, this drives me mad:
I'm adding, for example, three plots and updating values on these calling PlotYAppend() .... and finish plotting after, let's say, 5 seconds. Then I need to add two new plots which append data by using PlotYAppend() but for this two plots I want them to start plotting where the last (maximum) plot I plotted before has ended (here in this example: start from second 5). Although all the plots are sharing the same XAxis all plots start from second 0.
How can I achieve the above mentioned behaviour?
01-27-2011 10:58 AM
Hello -
One thing that may work depending upon your application would be to use PlotY instead of PlotYAppend for your first plotting operation per plot. This way, you can use the overload that includes an offset - allowing you to determine where plotting begins from.
NickB
National Instruments
01-28-2011 02:23 AM
Hello nickb,
thanks for your suggestion, this however doesn't work since PlotY removes all previous points/history of the plot. What I need is actually something that is able to surpress line interploation between two specific points, say:
point(0,0) -> point(100,10) => Draw no line between, i.e. do not interpolate between these two points.
Best regards,
01-28-2011 02:34 AM
I attached a picture for better understanding what I want to achieve.
01-31-2011 01:51 AM
Hi there,
As I understood from the picture that you have attached, the append should start from the 5 seconds on the x-axis.
When you add a new plot, you can set the WaveformPlot.DefaultStart property which tells the graph where to start plotting.
If this is not what you are looking for, please attach a sample project and detail us about the requirement so that we can help you better.
Vijet Patankar
National Instruments
01-31-2011 02:07 AM
Hello vcp,
I know the DefaultStart property, the problem is that the gap should be made in one and the same plot. So this is not a different plot where I could set the DefaultStart property.
01-31-2011 03:44 AM
You can make a plot look broken in several ways.
Solution 1: Easy way
Set WaveformPlot.ProcessSepcialValues to true. Now, in the data plot Double.Nan to get a break in the plot.
waveformPlot1.ProcessSpecialValues = true;
waveformPlot1.PlotYAppend(new double[] { 2, 3, 7, 5, double.NaN, double.NaN, 6, 9, 8, 4 });
Solution 2: Not so easy way
1) Hook on to the Plot.BeforeDraw, and cancel the plot drawing. And do the following in the event handler.
2) Get the pixel coordinates for the break using WaveformPlot.Map(..). (Here we calculate start position and end position of the break in the pixel coordinates from the data coordinates).
3) Draw the plot to a temp Bitmap.
4) Once you know where the break appears in the pixel coordinates, use Bitmap.SetPixel(...) method to set pixels in the rectangular region to Color.Transparent.
5) Use the grahics object from the event args to draw an image on the Plot area bounds.
6) Done.
Hope this helps.
Vijet Patankar
NationalInstruments.
02-01-2011 02:36 AM
Thanks! This solution (Solution 1) works perfectly!!