jiazp 发表于 2006-3-8 22:56:12

【请教】用strip chart控件做曲线出现的问题

在用strip chart作图是出现了问题,麻烦高手看一下,我是按3Hz计算的正弦曲线,可是感觉strip chart同时给我花了两个正弦,变成了6Hz的曲线,中间的连接部分还出现如图所示的情况,请问这事怎么回事?该如何解决?还请各位执教!<img src="attachments/dvbbs/2006-3/20063814553181399.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\nCTRL+Mouse wheel to zoom in/out\';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=\'hand\'; this.alt=\'Click here to open new window\nCTRL+Mouse wheel to zoom in/out\';}" onclick="if(!this.resized) {return true;} else {window.open(\'attachments/dvbbs/2006-3/20063814553181399.jpg\');}" onmousewheel="return imgzoom(this);" alt="" />

cpubbs 发表于 2006-3-17 18:53:43

因为你的数据只有这么多,所以它就只能显示这么多了!如果你画了一次,显示二条曲线真的挺奇怪的,把你的程序再复制出来瞧瞧!或者你重新建一个项目,再做一次,或者有什么地方不小心弄错了呢?我用过另一个按点画的函数!

cpubbs 发表于 2006-3-9 06:01:35

<P>兄弟最好能把C程序复制一部分贴出来,这样可能更容易查问题出来!</P>

jiazp 发表于 2006-3-9 17:37:36

<P>代码如下,麻烦哥们看一下。</P>
<P>int n,frequency=3,force=50;</P>
<P>for(n=0;n&lt;100;n++)<BR>{indata=force*sin(2.0*PI*frequency*n/100);<BR>sampledata=force*sin(2.0*PI*frequency*(n-2)/100);}</P>
<P>float temp1,temp2;<BR>temp1=indata;</P>
<P>temp2=sampledata; </P>

<P>    for(n=99;n&gt;0;n--)<BR>    {<BR>temp=indata;<BR>indata=indata;<BR>sampledata=sampledata;<BR>    }</P>
<P>ClearStripChart(ForceTestPanelHandle,ForceTest_STRIPCHART_2);<BR>   PlotStripChart(ForceTestPanelHandle,ForceTest_STRIPCHART_2,indata,100,0,0,VAL_FLOAT);<BR>   PlotStripChart(ForceTestPanelHandle,ForceTest_STRIPCHART_2,sampledata,100,0,0,VAL_FLOAT);</P>

game216 发表于 2006-3-14 06:37:51

高,实在是高

cpubbs 发表于 2006-3-11 08:12:45

<P> PlotStripChart(ForceTestPanelHandle,ForceTest_STRIPCHART_2,indata,100,0,0,VAL_FLOAT);<BR>   PlotStripChart(ForceTestPanelHandle,ForceTest_STRIPCHART_2,sampledata,100,0,0,VAL_FLOAT);</P>
<P>这里可是画了二次了呀兄弟?</P>

jiazp 发表于 2006-3-17 17:03:39

<P>多谢,不过我还不是很清楚,我那个是画两组数据,也就是两条曲线,不是应该两次调用plotstripchart吗?现在注释掉一条语句,却画了两条曲线,但是只在屏幕的一半显示,为什么不是满屏幕显示呢?还请老大详细说一下,有没有这方面的例程,麻烦借看一下。</P><img src="attachments/dvbbs/2006-3/2006317962144802.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window\nCTRL+Mouse wheel to zoom in/out\';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor=\'hand\'; this.alt=\'Click here to open new window\nCTRL+Mouse wheel to zoom in/out\';}" onclick="if(!this.resized) {return true;} else {window.open(\'attachments/dvbbs/2006-3/2006317962144802.jpg\');}" onmousewheel="return imgzoom(this);" alt="" />
[此贴子已经被作者于2006-3-17 9:06:30编辑过]

engine2003 发表于 2006-3-29 03:34:29

<P>想在一个图里画出两条曲线来,是用PlotXY函数吧</P>
<P>看帮助了。</P>

easons 发表于 2006-4-24 17:54:21

<P>你的控件设置有问题,设了两条曲线</P>
<P>所以你用以下语句时</P>
<P>PlotStripChart(ForceTestPanelHandle,ForceTest_STRIPCHART_2,indata,100,0,0,VAL_FLOAT);</P>
<P>每次给控件每条曲线传递一组数据,方式如下:</P>
<P>数据为:1 2 3 4 5 6 7 8 9 0</P>
<P>第一条为:1 3 5 7 9</P>
<P>第二条为:2 4 6 8 0 </P>

yuling0916 发表于 2008-7-4 07:32:27

楼上的意思是说,如果控件设置的时候设置成2的话,两条曲线是隔点取来画图的吗?
页: [1]
查看完整版本: 【请教】用strip chart控件做曲线出现的问题