User (Legacy) Posted April 25, 2006 Author Report Share Posted April 25, 2006 I am trying to make sure I can make a realtime chart. However I can only ever see the last point that I add in the realtime chart. Am I doing something incorrectly here? OnBnClickedButton1 is used to create and setup the chart. OnBnClickedButton2 is used to add points to the chart. void CDynamicDlg::OnBnClickedButton2() { //...'Finally when the timer calls set the new data if (nOffset == 20) { m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( Cfx62::RealTimeStyle_NoWaitArrow ); } m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || Cfx62::COD_AddPoints ),2,1 ); //'Set two new points for series 1 m_chartPtr->Value->PutItem(0,0, -50 + rand() * 100 ); m_chartPtr->Value->PutItem(1,0, -50 + rand() * 100 ); char buf[20]; m_chartPtr->Legend->PutItem( 0, itoa( nOffset + 1, buf, 10 ) ); //'Close the channel forcing scroll m_chartPtr->CloseData( (Cfx62::COD )( Cfx62::COD_Values || Cfx62::COD_RealTime || Cfx62::COD_ScrollLegend ) ); nOffset++; } void CDynamicDlg::OnBnClickedButton1() { CRect rc; GetDlgItem(IDC_FRAME)->GetWindowRect(rc); ScreenToClient(rc); m_chartWnd.CreateControl(__uuidof(Cfx62::Chart), NULL, WS_VISIBLE, rc, this, IDC_CHART1,NULL,NULL,NULL /* LICENSE STRING SHOULD GO HERE */ ); // Attach to Chart pointer m_chartPtr = m_chartWnd.GetControlUnknown(); // Use some of the ChartFX API m_chartPtr->_Gallery = Cfx62::Gallery_Bar; m_chartPtr->ClearData( Cfx62::ClearDataFlag_Values ); m_chartPtr->TypeMask = (Cfx62::ChartType)( m_chartPtr->TypeMask || Cfx62::ChartType_EvenSpacing ); m_chartPtr->TypeEx = (Cfx62::ChartTypeEx)( m_chartPtr->TypeEx || Cfx62::ChartTypeEx_NoLegInvalidate ); m_chartPtr->RealTimeSettings->BufferSize = 20; //50; m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( Cfx62::RealTimeStyle_LoopPos || Cfx62::RealTimeStyle_NoWaitArrow ); m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || Cfx62::COD_Remove || Cfx62::COD_AllocHidden), 2, 20 ); for( int i = 0; i < 20; i++ ){ char buf[20]; m_chartPtr->Legend->PutItem( i, itoa( i + 1, buf, 10 ) ); } m_chartPtr->CloseData( Cfx62::COD_Values ); nOffset = 0; m_chartPtr->AxisY->PutminX( 0 ); m_chartPtr->AxisY->PutmaxX( 100 ); } Link to comment Share on other sites More sharing options...
User (Legacy) Posted April 25, 2006 Report Share Posted April 25, 2006 I am trying to make sure I can make a realtime chart. However I can only ever see the last point that I add in the realtime chart. Am I doing something incorrectly here? OnBnClickedButton1 is used to create and setup the chart. OnBnClickedButton2 is used to add points to the chart. void CDynamicDlg::OnBnClickedButton2() { //...'Finally when the timer calls set the new data if (nOffset == 20) { m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( Cfx62::RealTimeStyle_NoWaitArrow ); } m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || Cfx62::COD_AddPoints ),2,1 ); //'Set two new points for series 1 m_chartPtr->Value->PutItem(0,0, -50 + rand() * 100 ); m_chartPtr->Value->PutItem(1,0, -50 + rand() * 100 ); char buf[20]; m_chartPtr->Legend->PutItem( 0, itoa( nOffset + 1, buf, 10 ) ); //'Close the channel forcing scroll m_chartPtr->CloseData( (Cfx62::COD )( Cfx62::COD_Values || Cfx62::COD_RealTime || Cfx62::COD_ScrollLegend ) ); nOffset++; } void CDynamicDlg::OnBnClickedButton1() { CRect rc; GetDlgItem(IDC_FRAME)->GetWindowRect(rc); ScreenToClient(rc); m_chartWnd.CreateControl(__uuidof(Cfx62::Chart), NULL, WS_VISIBLE, rc, this, IDC_CHART1,NULL,NULL,NULL /* LICENSE STRING SHOULD GO HERE */ ); // Attach to Chart pointer m_chartPtr = m_chartWnd.GetControlUnknown(); // Use some of the ChartFX API m_chartPtr->_Gallery = Cfx62::Gallery_Bar; m_chartPtr->ClearData( Cfx62::ClearDataFlag_Values ); m_chartPtr->TypeMask = (Cfx62::ChartType)( m_chartPtr->TypeMask || Cfx62::ChartType_EvenSpacing ); m_chartPtr->TypeEx = (Cfx62::ChartTypeEx)( m_chartPtr->TypeEx || Cfx62::ChartTypeEx_NoLegInvalidate ); m_chartPtr->RealTimeSettings->BufferSize = 20; //50; m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( Cfx62::RealTimeStyle_LoopPos || Cfx62::RealTimeStyle_NoWaitArrow ); m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || Cfx62::COD_Remove || Cfx62::COD_AllocHidden), 2, 20 ); for( int i = 0; i < 20; i++ ){ char buf[20]; m_chartPtr->Legend->PutItem( i, itoa( i + 1, buf, 10 ) ); } m_chartPtr->CloseData( Cfx62::COD_Values ); nOffset = 0; m_chartPtr->AxisY->PutminX( 0 ); m_chartPtr->AxisY->PutmaxX( 100 ); } Link to comment Share on other sites More sharing options...
Software FX Posted April 29, 2006 Report Share Posted April 29, 2006 I don't know if this is some formatting problem but it looks like you are using the wrong "or" operator. For example, I see: Cfx62::COD_Values || Cfx62::COD_AddPoints and it should be: Cfx62::COD_Values | Cfx62::COD_AddPoints (A bitwise or). -- Francisco Padron www.chartfx.com "Mac Dyer" <mac@simx.com> wrote in message news:RSPEXxKaGHA.3508@webserver3.softwarefx.com... >I am trying to make sure I can make a realtime chart. However I can only > ever see the last point that I add in the realtime chart. Am I doing > something incorrectly here? OnBnClickedButton1 is used to create and > setup > the chart. OnBnClickedButton2 is used to add points to the chart. > > > void CDynamicDlg::OnBnClickedButton2() > { > //...'Finally when the timer calls set the new data > if (nOffset == 20) { > m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( > Cfx62::RealTimeStyle_NoWaitArrow ); > } > m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || > Cfx62::COD_AddPoints ),2,1 ); > //'Set two new points for series 1 > m_chartPtr->Value->PutItem(0,0, -50 + rand() * 100 ); > m_chartPtr->Value->PutItem(1,0, -50 + rand() * 100 ); > char buf[20]; > m_chartPtr->Legend->PutItem( 0, itoa( nOffset + 1, buf, 10 ) ); > //'Close the channel forcing scroll > m_chartPtr->CloseData( (Cfx62::COD )( Cfx62::COD_Values || > Cfx62::COD_RealTime || Cfx62::COD_ScrollLegend ) ); > nOffset++; > } > void CDynamicDlg::OnBnClickedButton1() > { > CRect rc; > GetDlgItem(IDC_FRAME)->GetWindowRect(rc); > ScreenToClient(rc); > m_chartWnd.CreateControl(__uuidof(Cfx62::Chart), NULL, WS_VISIBLE, rc, > this, > IDC_CHART1,NULL,NULL,NULL /* LICENSE STRING SHOULD GO HERE */ ); > // Attach to Chart pointer > m_chartPtr = m_chartWnd.GetControlUnknown(); > // Use some of the ChartFX API > m_chartPtr->_Gallery = Cfx62::Gallery_Bar; > m_chartPtr->ClearData( Cfx62::ClearDataFlag_Values ); > m_chartPtr->TypeMask = (Cfx62::ChartType)( m_chartPtr->TypeMask || > Cfx62::ChartType_EvenSpacing ); > m_chartPtr->TypeEx = (Cfx62::ChartTypeEx)( m_chartPtr->TypeEx || > Cfx62::ChartTypeEx_NoLegInvalidate ); > m_chartPtr->RealTimeSettings->BufferSize = 20; //50; > m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( > Cfx62::RealTimeStyle_LoopPos || Cfx62::RealTimeStyle_NoWaitArrow ); > m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || Cfx62::COD_Remove > || Cfx62::COD_AllocHidden), 2, 20 ); > for( int i = 0; i < 20; i++ ){ > char buf[20]; > m_chartPtr->Legend->PutItem( i, itoa( i + 1, buf, 10 ) ); > } > m_chartPtr->CloseData( Cfx62::COD_Values ); > nOffset = 0; > m_chartPtr->AxisY->PutminX( 0 ); > m_chartPtr->AxisY->PutmaxX( 100 ); > } > > Link to comment Share on other sites More sharing options...
Software FX Posted April 29, 2006 Report Share Posted April 29, 2006 I don't know if this is some formatting problem but it looks like you are using the wrong "or" operator. For example, I see: Cfx62::COD_Values || Cfx62::COD_AddPoints and it should be: Cfx62::COD_Values | Cfx62::COD_AddPoints (A bitwise or). -- Francisco Padron www.chartfx.com "Mac Dyer" <mac@simx.com> wrote in message news:RSPEXxKaGHA.3508@webserver3.softwarefx.com... >I am trying to make sure I can make a realtime chart. However I can only > ever see the last point that I add in the realtime chart. Am I doing > something incorrectly here? OnBnClickedButton1 is used to create and > setup > the chart. OnBnClickedButton2 is used to add points to the chart. > > > void CDynamicDlg::OnBnClickedButton2() > { > //...'Finally when the timer calls set the new data > if (nOffset == 20) { > m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( > Cfx62::RealTimeStyle_NoWaitArrow ); > } > m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || > Cfx62::COD_AddPoints ),2,1 ); > //'Set two new points for series 1 > m_chartPtr->Value->PutItem(0,0, -50 + rand() * 100 ); > m_chartPtr->Value->PutItem(1,0, -50 + rand() * 100 ); > char buf[20]; > m_chartPtr->Legend->PutItem( 0, itoa( nOffset + 1, buf, 10 ) ); > //'Close the channel forcing scroll > m_chartPtr->CloseData( (Cfx62::COD )( Cfx62::COD_Values || > Cfx62::COD_RealTime || Cfx62::COD_ScrollLegend ) ); > nOffset++; > } > void CDynamicDlg::OnBnClickedButton1() > { > CRect rc; > GetDlgItem(IDC_FRAME)->GetWindowRect(rc); > ScreenToClient(rc); > m_chartWnd.CreateControl(__uuidof(Cfx62::Chart), NULL, WS_VISIBLE, rc, > this, > IDC_CHART1,NULL,NULL,NULL /* LICENSE STRING SHOULD GO HERE */ ); > // Attach to Chart pointer > m_chartPtr = m_chartWnd.GetControlUnknown(); > // Use some of the ChartFX API > m_chartPtr->_Gallery = Cfx62::Gallery_Bar; > m_chartPtr->ClearData( Cfx62::ClearDataFlag_Values ); > m_chartPtr->TypeMask = (Cfx62::ChartType)( m_chartPtr->TypeMask || > Cfx62::ChartType_EvenSpacing ); > m_chartPtr->TypeEx = (Cfx62::ChartTypeEx)( m_chartPtr->TypeEx || > Cfx62::ChartTypeEx_NoLegInvalidate ); > m_chartPtr->RealTimeSettings->BufferSize = 20; //50; > m_chartPtr->RealTimeSettings->Style = (Cfx62::RealTimeStyle)( > Cfx62::RealTimeStyle_LoopPos || Cfx62::RealTimeStyle_NoWaitArrow ); > m_chartPtr->OpenData( (Cfx62::COD )(Cfx62::COD_Values || Cfx62::COD_Remove > || Cfx62::COD_AllocHidden), 2, 20 ); > for( int i = 0; i < 20; i++ ){ > char buf[20]; > m_chartPtr->Legend->PutItem( i, itoa( i + 1, buf, 10 ) ); > } > m_chartPtr->CloseData( Cfx62::COD_Values ); > nOffset = 0; > m_chartPtr->AxisY->PutminX( 0 ); > m_chartPtr->AxisY->PutmaxX( 100 ); > } > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.