您的位置:首页 > 移动开发

How to plot line chart with Real-time data at Dialog-base application?

2018-03-22 17:26 525 查看

How to plot line chart with Real-time data at Dialog-base application? 

Visual Studio Languages , Windows Desktop Development > Visual C++

Question




0Sign in to voteHi, Sir:I would like to create MFC Dialog-base application for ploting realtime dataI found many free sample code from website, like "Draw or display Real-time data plot Chart"
,"Simple Real-time Class for Advanced Charts and Plotting", it is good for ploting.But they are all base Doc/View, not Dialog-baseI download source code from "Draw or display Real-time data plot Chart"
But it is fail to run "Create" functionHow to modify code to match my necessary?((CButton *)GetDlgItem(IDC_CHART_REALTIME))->GetClientRect(&clientRect); // IDC_CHART_REALTIME is Picture Control
m_Plot.Create(WS_VISIBLE, clientRect, this, 12000, TRUE);BOOL clPlot::Create(DWORD dwstyle, CRect &rect, CWnd *pParent, UINT id)
{
 DWORD style = dwstyle & (~WS_BORDER);
 if(dwstyle & WS_BORDER)
  m_bctlBorder=TRUE;
 else
  m_bctlBorder=FALSE; if (!CWnd::Create(NULL, "", style, rect, pParent, id, NULL))
  return FALSE;
 
 m_ctlRect = rect;
 pParent->ClientToScreen(m_ctlRect);
 ScreenToClient(m_ctlRect); ComputeRects(TRUE);
 return TRUE;
}void clPlot::ComputeRects(BOOL bInitialization)
{
 CClientDC dc(this);
 ...
}void clPlot::OnPaint() 
{
        CPaintDC dc(this); // device context for painting
 ...
}
void clPlot::MoveWindow(CRect & Rect)
{
 m_ctlRect = Rect;
 GetParent()->ClientToScreen(m_ctlRect);
 ScreenToClient(m_ctlRect);
 ComputeRects(TRUE);
 CWnd::MoveWindow(Rect);
}
ps:
Simple Real-time Class for Advanced Charts and Plotting:
http://www.codeguru.com/cpp/controls/controls/chartingandanaloguecontrols/article.php/c2223/Simple-Realtime-Class-for-Advanced-Charts-and-Plotting.htm
Draw or display Real-time data plot Chart:
http://www.ucancode.net/Visual_C_MFC_Samples/Draw_Display_Real_Time_data_Plot_Chart_vc_example.htmThanks!!!BR,
AlanThursday, June 04, 2015 1:56 AMReply|Quotealan.emc0 Points

Answers




0Sign in to voteHi alan.emc,I have downloaded that sample - Draw or display Real-time data plot Chart. And it works well after I resolved some dependency issue.So What do you mean it is fail on "create" function? Does the function didn't get invoked or one line code in that function fails? What error message do you get?Please explain more details.I try to make the real- time data plot chart display on a dialog, so I create a MFC dialog based project. Copy the code in demoview.cpp to my dialog class cpp file(add clPlot m_Plot, OnTimer, Onsize OnEraseBkgnd) , and add refencence to clPlot project. check this screenshot:

Hope this helps some.ShuWe are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. 
Click HERE to participate the survey.

Edited by Shu 2017 Friday, June 05, 2015 6:03 AM
Marked as answer by Shu 2017 Tuesday, June 16, 2015 12:12 PM
Friday, June 05, 2015 3:37 AMReply|QuoteShu 2017NO11,415 Points

All replies




0Sign in to voteHi alan.emc,I have downloaded that sample - Draw or display Real-time data plot Chart. And it works well after I resolved some dependency issue.So What do you mean it is fail on "create" function? Does the function didn't get invoked or one line code in that function fails? What error message do you get?Please explain more details.I try to make the real- time data plot chart display on a dialog, so I create a MFC dialog based project. Copy the code in demoview.cpp to my dialog class cpp file(add clPlot m_Plot, OnTimer, Onsize OnEraseBkgnd) , and add refencence to clPlot project. check this screenshot:

Hope this helps some.ShuWe are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. 
Click HERE to participate the survey.

Edited by Shu 2017 Friday, June 05, 2015 6:03 AM
Marked as answer by Shu 2017 Tuesday, June 16, 2015 12:12 PM
Friday, June 05, 2015 3:37 AMReply|QuoteShu 2017NO11,415 Points




0Sign in to voteI have same issue when built in release mode. May I know what you change to make it run in release mode? Thanks

转:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/06a9cea8-db05-4319-b201-1e3896c4a408/how-to-plot-line-chart-with-realtime-data-at-dialogbase-application?forum=vcgeneral
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐