MFC SeriesCollection question
-
How do I write
ActiveChart.SeriesCollection(1).XValues = "={""Date 08102003"","" Date 08102003""}"
in MFC? Here is my code for the chartwiz..this->m_xlChart->ChartWizard(var, // Source. COleVariant((short)3), // Gallery: 2d Column. COleVariant((short)2), // Format. COleVariant((short)2), // PlotBy xlColumns. COleVariant((short)0), // CategoryLabels. COleVariant((short)1), // SeriesLabels. COleVariant((short)TRUE), // HasLegend. COleVariant("MyChart"), // Title. COleVariant("Date"), // CategoryTitle. COleVariant("UNITS"), // ValueTitles. covOptional );
Basically I want to change Category (X) axis labels to something other then 1, 2, 3... etc. Sincerely, Mardigin -
How do I write
ActiveChart.SeriesCollection(1).XValues = "={""Date 08102003"","" Date 08102003""}"
in MFC? Here is my code for the chartwiz..this->m_xlChart->ChartWizard(var, // Source. COleVariant((short)3), // Gallery: 2d Column. COleVariant((short)2), // Format. COleVariant((short)2), // PlotBy xlColumns. COleVariant((short)0), // CategoryLabels. COleVariant((short)1), // SeriesLabels. COleVariant((short)TRUE), // HasLegend. COleVariant("MyChart"), // Title. COleVariant("Date"), // CategoryTitle. COleVariant("UNITS"), // ValueTitles. covOptional );
Basically I want to change Category (X) axis labels to something other then 1, 2, 3... etc. Sincerely, MardiginDisregard, I just solved this problem. Silly me. Here is the solution if anyone is interested.
xlSeries = this->m_xlChart->SeriesCollection(COleVariant((short)1)); VARIANT vResult; // A Struct with a pdispVal member VARTYPE vType; DISPID dispID; // Temporary DISPID unsigned short *ucPtr; // Temporary name holder ucPtr = L"XValues"; HRESULT hr = xlSeries.m_lpDispatch->GetIDsOfNames( IID_NULL, &ucPtr, 1, ACCESS_PROPERTY_GUID, &dispID ); //CString result; CString lpszNewValue= "={""Label1"",""Label2""}"; if(hr == S_OK) { xlSeries.SetXValues(COleVariant(lpszNewValue)); }
Sincerely, Mardigin -
Disregard, I just solved this problem. Silly me. Here is the solution if anyone is interested.
xlSeries = this->m_xlChart->SeriesCollection(COleVariant((short)1)); VARIANT vResult; // A Struct with a pdispVal member VARTYPE vType; DISPID dispID; // Temporary DISPID unsigned short *ucPtr; // Temporary name holder ucPtr = L"XValues"; HRESULT hr = xlSeries.m_lpDispatch->GetIDsOfNames( IID_NULL, &ucPtr, 1, ACCESS_PROPERTY_GUID, &dispID ); //CString result; CString lpszNewValue= "={""Label1"",""Label2""}"; if(hr == S_OK) { xlSeries.SetXValues(COleVariant(lpszNewValue)); }
Sincerely, MardiginMardigin wrote: CString lpszNewValue= "={""Label1"",""Label2""}"; In C++, to insert a "
"
" character you have to use "\"
", not """
" like in VB.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"