User (Legacy) Posted December 12, 2006 Author Report Share Posted December 12, 2006 I try to use ListDataProvider on my Chart in Visual C++ 2005. I add in stdafx.h these 2 lines : #import <ChartFX.ClientServer.data.dll> rename_namespace("Cfx62Data") #import <ChartFX.ClientServer.core.dll> rename_namespace("Cfx62") rename("min","minX") rename("max","maxX") exclude("_CollectionBase","_Component","CollectionBase","Component") Here is the code that cause problem : Cfx62Data::_ListDataProviderPtr m_listDataProviderPtr = Cfx62Data::_ListDataProviderPtr( __uuidof(Cfx62Data::ListDataProvider) ); int nTest1[3] = { 1,2,3 }; int nTest2[3] = { 4,5,6 }; CString nTest3[3]; nTest3[0] = CString("a"); nTest3[1] = CString("b"); nTest3[2] = CString("c"); HRESULT result1 = m_listDataProviderPtr->AddCollection( (VARIANT*)nTest1 ); HRESULT result2 = m_listDataProviderPtr->AddCollection( (VARIANT*)nTest2 ); HRESULT result3 = m_listDataProviderPtr->AddCollection( (VARIANT*)nTest3 ); m_chartPtr->DataSource = m_listDataProviderPtr->Get_Ptr(); All lines seem to work fine but the result is an empty chart. What is the problem? Thanks Marc Link to comment Share on other sites More sharing options...
User (Legacy) Posted December 12, 2006 Report Share Posted December 12, 2006 I try to use ListDataProvider on my Chart in Visual C++ 2005. I add in stdafx.h these 2 lines : #import <ChartFX.ClientServer.data.dll> rename_namespace("Cfx62Data") #import <ChartFX.ClientServer.core.dll> rename_namespace("Cfx62") rename("min","minX") rename("max","maxX") exclude("_CollectionBase","_Component","CollectionBase","Component") Here is the code that cause problem : Cfx62Data::_ListDataProviderPtr m_listDataProviderPtr = Cfx62Data::_ListDataProviderPtr( __uuidof(Cfx62Data::ListDataProvider) ); int nTest1[3] = { 1,2,3 }; int nTest2[3] = { 4,5,6 }; CString nTest3[3]; nTest3[0] = CString("a"); nTest3[1] = CString("b"); nTest3[2] = CString("c"); HRESULT result1 = m_listDataProviderPtr->AddCollection( (VARIANT*)nTest1 ); HRESULT result2 = m_listDataProviderPtr->AddCollection( (VARIANT*)nTest2 ); HRESULT result3 = m_listDataProviderPtr->AddCollection( (VARIANT*)nTest3 ); m_chartPtr->DataSource = m_listDataProviderPtr->Get_Ptr(); All lines seem to work fine but the result is an empty chart. What is the problem? Thanks Marc Link to comment Share on other sites More sharing options...
User (Legacy) Posted December 15, 2006 Author Report Share Posted December 15, 2006 I found a solution : m_chartPtr->ClearData(Cfx62::ClearDataFlag_AllData); m_chartPtr->_Gallery = Cfx62::Gallery_Curve; Cfx62Data::_ListDataProviderPtr m_listDataProviderPtr = Cfx62Data::_ListDataProviderPtr( __uuidof(Cfx62Data::ListDataProvider) ); double dTest1[3] = { 0,1,2 }; double dTest2[3] = { 2,3,4 }; double dTest3[3] = { 4,8,5 }; COleSafeArray saRet1; COleSafeArray saRet2; COleSafeArray saRet3; SAFEARRAYBOUND rgsabounds; rgsabounds.cElements = 3; rgsabounds.lLbound = 0; saRet1.CreateOneDim(VT_R8, 3, dTest1); saRet2.CreateOneDim(VT_R8, 3, dTest2); saRet3.CreateOneDim(VT_R8, 3, dTest3); m_chartPtr->DataSourceSettings->DataType->Item[0] = Cfx62::DataType_XValue; m_chartPtr->DataSourceSettings->DataType->Item[1] = Cfx62::DataType_Value; m_chartPtr->DataSourceSettings->DataType->Item[2] = Cfx62::DataType_Value; m_listDataProviderPtr->AddCollection( &saRet1.Detach() ); m_listDataProviderPtr->AddCollection( &saRet3.Detach() ); m_listDataProviderPtr->AddCollection( &saRet2.Detach() ); m_chartPtr->DataSourceSettings->DataSource = (IDispatch*)m_listDataProviderPtr; "Marc B." <marc.belletete@cyme.com> wrote in message news:t0d%23cVfHHHA.2608@webserver3.softwarefx.com... >I try to use ListDataProvider on my Chart in Visual C++ 2005. > I add in stdafx.h these 2 lines : > > #import <ChartFX.ClientServer.data.dll> rename_namespace("Cfx62Data") > #import <ChartFX.ClientServer.core.dll> rename_namespace("Cfx62") > rename("min","minX") rename("max","maxX") > exclude("_CollectionBase","_Component","CollectionBase","Component") > > Here is the code that cause problem : > > Cfx62Data::_ListDataProviderPtr m_listDataProviderPtr = > Cfx62Data::_ListDataProviderPtr( __uuidof(Cfx62Data::ListDataProvider) ); > > int nTest1[3] = { 1,2,3 }; > int nTest2[3] = { 4,5,6 }; > > CString nTest3[3]; > nTest3[0] = CString("a"); > nTest3[1] = CString("b"); > nTest3[2] = CString("c"); > > HRESULT result1 = m_listDataProviderPtr->AddCollection( > (VARIANT*)nTest1 ); > HRESULT result2 = m_listDataProviderPtr->AddCollection( > (VARIANT*)nTest2 ); > HRESULT result3 = m_listDataProviderPtr->AddCollection( > (VARIANT*)nTest3 ); > > m_chartPtr->DataSource = m_listDataProviderPtr->Get_Ptr(); > > > > All lines seem to work fine but the result is an empty chart. What is the > problem? > > Thanks > > > Marc > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted December 15, 2006 Author Report Share Posted December 15, 2006 I found a solution : m_chartPtr->ClearData(Cfx62::ClearDataFlag_AllData); m_chartPtr->_Gallery = Cfx62::Gallery_Curve; Cfx62Data::_ListDataProviderPtr m_listDataProviderPtr = Cfx62Data::_ListDataProviderPtr( __uuidof(Cfx62Data::ListDataProvider) ); double dTest1[3] = { 0,1,2 }; double dTest2[3] = { 2,3,4 }; double dTest3[3] = { 4,8,5 }; COleSafeArray saRet1; COleSafeArray saRet2; COleSafeArray saRet3; SAFEARRAYBOUND rgsabounds; rgsabounds.cElements = 3; rgsabounds.lLbound = 0; saRet1.CreateOneDim(VT_R8, 3, dTest1); saRet2.CreateOneDim(VT_R8, 3, dTest2); saRet3.CreateOneDim(VT_R8, 3, dTest3); m_chartPtr->DataSourceSettings->DataType->Item[0] = Cfx62::DataType_XValue; m_chartPtr->DataSourceSettings->DataType->Item[1] = Cfx62::DataType_Value; m_chartPtr->DataSourceSettings->DataType->Item[2] = Cfx62::DataType_Value; m_listDataProviderPtr->AddCollection( &saRet1.Detach() ); m_listDataProviderPtr->AddCollection( &saRet3.Detach() ); m_listDataProviderPtr->AddCollection( &saRet2.Detach() ); m_chartPtr->DataSourceSettings->DataSource = (IDispatch*)m_listDataProviderPtr; "Marc B." <marc.belletete@cyme.com> wrote in message news:t0d%23cVfHHHA.2608@webserver3.softwarefx.com... >I try to use ListDataProvider on my Chart in Visual C++ 2005. > I add in stdafx.h these 2 lines : > > #import <ChartFX.ClientServer.data.dll> rename_namespace("Cfx62Data") > #import <ChartFX.ClientServer.core.dll> rename_namespace("Cfx62") > rename("min","minX") rename("max","maxX") > exclude("_CollectionBase","_Component","CollectionBase","Component") > > Here is the code that cause problem : > > Cfx62Data::_ListDataProviderPtr m_listDataProviderPtr = > Cfx62Data::_ListDataProviderPtr( __uuidof(Cfx62Data::ListDataProvider) ); > > int nTest1[3] = { 1,2,3 }; > int nTest2[3] = { 4,5,6 }; > > CString nTest3[3]; > nTest3[0] = CString("a"); > nTest3[1] = CString("b"); > nTest3[2] = CString("c"); > > HRESULT result1 = m_listDataProviderPtr->AddCollection( > (VARIANT*)nTest1 ); > HRESULT result2 = m_listDataProviderPtr->AddCollection( > (VARIANT*)nTest2 ); > HRESULT result3 = m_listDataProviderPtr->AddCollection( > (VARIANT*)nTest3 ); > > m_chartPtr->DataSource = m_listDataProviderPtr->Get_Ptr(); > > > > All lines seem to work fine but the result is an empty chart. What is the > problem? > > Thanks > > > Marc > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.