mfc iocomp iPlotX控件,曲线显示或隐藏

1、右键添加iPlotX控件,

2、在其上边画条曲线 ,long index = m_iPlotX.AddChannel(); //动态添加通道,返回值是通道的索引

3、使用方法SetVisible显示或隐藏曲线,我的例子如下:

m_iPlotX.SetTitleText(_T("标题")); //设置标题

//使用button1画曲线

void CCiPlotXTestDlg::OnBnClickedButton1()
{
double XData;
double YData;
XData = 0;
YData = 0;
for(int i=0; i<100; i++)
{
XData = XData + 1;
YData = (rand()/(double)RAND_MAX)*100;
m_iPlotX.GetChannel(0).AddXY(XData, YData);

m_iPlotX.GetChannel(0).SetTitleText(_T("通道1")); //设置通道的Title
}
}


//使用button2显示或隐藏取向
void CCiPlotXTestDlg::OnBnClickedButton2()
{
if(button2TF)
{
((CButton *)GetDlgItem(IDC_BUTTON2))->SetWindowText(_T("显示")); //修改button的caption
button2TF = 0;
m_iPlotX.GetChannel(0).SetVisible(0);//隐藏通道一
}
else
{
((CButton *)GetDlgItem(IDC_BUTTON2))->SetWindowText(_T("隐藏")); 
button2TF = 1;
m_iPlotX.GetChannel(0).SetVisible(1); //显示通道一
}
}

//上边的方法是整个隐藏或显示

//下边的方法是从继续的地方继续画


void CCiPlotXTestDlg::OnBnClickedButton2()
{
//m_iPlotX.GetChannel(0).Clear();
if(button2TF)
{
((CButton *)GetDlgItem(IDC_BUTTON2))->SetWindowText(_T("显示")); //修改checkbox的状态
button2TF = 0;
//m_iPlotX.GetChannel(1).Clear();
m_iPlotX.GetChannel(1).SetVisible(0);
}
else
{
((CButton *)GetDlgItem(IDC_BUTTON2))->SetWindowText(_T("隐藏")); 
button2TF = 1;
m_iPlotX.GetChannel(1).Clear(); //清除之前画的线
m_iPlotX.GetChannel(1).SetVisible(1);
}
}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

woquNOKIA

谢谢老板!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值