DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Overlaying multiple plots

 
Post new topic   Reply to topic    DPlot Forum Index -> C, C++, C#
View previous topic :: View next topic  
Author Message
cyberphox



Joined: 08 Nov 2009
Posts: 1

PostPosted: Sun Nov 08, 2009 4:49 am    Post subject: Overlaying multiple plots Reply with quote

Hi all,

Before I carry on I have to say DPLOT is a fantastic tool!

I have recently found out about using dplotlib in c# and now am trying to add some real-time plotting capabilites to some automatic test software.

What I would like to do is plot an array of data (histogram of levels of an ADC output, 16 levels in total). This histogram is updated at a specific rate.

I use this every time I get new data on the ADC statistics: -

for (int i = 0; i < 16 i++)
{
x = i;
y1 = AdcBins[i];
dplot.DPlot_AddData8(DocNum, dplot.DATA_XYXY, 1, 1, ref x, ref y1);
}


Now the problem I encounter is the plot wraps back on itself, basically the last point joins back to the start point after each update.

There are two options I would like to try:

1. Is just show one plot at each update. In other words clear the last plot and show the new one but do it quickly without recreating the axis etc.

2. Also to plot each new plot over the other not clearing the previous one but not to have the wrapping of last point to first.

I hope this makes a bit of sense.

Kind regards,
M.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Sun Nov 08, 2009 8:27 am    Post subject: Reply with quote

1.

dplot.DPlot_Command(DocNum,"[EditEraseData(1)]");
for (int i = 0; i < 16; i++)
{
x = i;
y1 = AdcBins[i];
dplot.DPlot_AddData8(DocNum, dplot.DATA_XYXY, 1, 1, ref x, ref y1);
}

EditEraseData doesn't delete the curve (and since that's the only curve, close the plot) and it doesn't redraw anything. It just resets the number of points in that curve to 0.

2. Two ways to do this. a) You can use separate curves for each group of 16 points. That would mean you'd need to keep track of how many curves were present, plus DPlot will balk if you need to do this more than 100 times.

b) Use the YCutoff command to set a range of values outside which points won't be drawn (or line segments drawn to/from). Then before your loop add a point whose Y value is outside that range. For example if you know your Y values will always range from 0 to 100:

dplot.DPlot_Command(DocNum,"[YCutoff(1,-100,200)]")
// You only need to use YCutoff once, but multiple calls won't hurt anything.
x = 0;
y = 201;
dplot.DPlot_AddData8(DocNum,dplot.DATA_XYXY,1,1,ref x,ref y1);
for (int i = 0; i < 16; i++)
{
x = i;
y1 = AdcBins[i];
dplot.DPlot_AddData8(DocNum, dplot.DATA_XYXY, 1, 1, ref x, ref y1);
}
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> C, C++, C# All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group