User (Legacy) Posted April 9, 2003 Report Share Posted April 9, 2003 I am unable to find any documentation on how to use the axis format function in Visual C++. I would like to format the axis to show a date followed by the time, using my own format. But in Visual C++, the variable is a VARIANT and I would like to know how to use a variant to supply a STRING with my formating. I've tried using the following code VARIANT v; V_VT(&v) = VT_BSTR; V_ v.bstrVal = BSTR("DM-d-yy"); m_pGraphDlg->m_ctrlCFX.GetAxis().GetItem(AXIS_X).SetFormat(v); but it simply ignores any type of formating I give it. Thanks for any help Paulo Sebasti Link to comment Share on other sites More sharing options...
Software FX Posted April 10, 2003 Report Share Posted April 10, 2003 Is this an X/Y chart ? are labels being assigned to the X-Axis ? Like with any string passed to an ActiveX component, it needs to be a OLE String. Casting yours to BSTR is not enough, you need to convert your string into a BSRT as follows: VARIANT v; V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(L"DM-d-yy"); -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted April 10, 2003 Author Report Share Posted April 10, 2003 Thanks. It worked, but now I am having problems creating a newline. I want to have the labels as date"newline"time. This works if I set the label myself, but if I try to set the format as V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(L"XMM-dd-yyyy\n\rHH:mm"); It shows my the date, followed by two strange characters, followed by the time. Does the automatic formating support multi-line labels ? Thanks in advance Paulo Sebasti Link to comment Share on other sites More sharing options...
Software FX Posted April 10, 2003 Report Share Posted April 10, 2003 By default the axis-labels are single-line. Use the Style property, in particular, turn OFF the AS_SINGLELINE flag to allow for multi-line labels. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.