nicovil Posted May 14, 2015 Report Share Posted May 14, 2015 Hello. I'm trying to add an annotation to my chart using VC++, but they are not showed at all on the chart. I'm using this code snippet (VC++) using COM interface... m_chartPtr is the chart instance which is rendering perfect. Cfx62ClientServerAnnotation::_AnnotationXPtr annotx; HRESULT rs = annotx.CreateInstance(__uuidof(Cfx62ClientServerAnnotation::AnnotationX)); if (rs == S_OK) { annotx->Enabled = TRUE; Cfx62ClientServerAnnotation::_AnnotationTextPtr text; rs = text.CreateInstance(__uuidof(Cfx62ClientServerAnnotation::AnnotationText)); annotx->List->Add(text); if (rs == S_OK) { text->Attach(Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Near, 2, Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Far, 62); text->TextColor = RGB(255, 0, 0); text->Text = "Sample text"; text->Color = m_chartPtr->ColorFromArgb(0, 0, 0, 0); text->Border->Color = m_chartPtr->ColorFromArgb(0, 0, 0, 0); text->Orientation = 0; text->Align = Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Far; text->LineAlignment = Cfx62ClientServerAnnotation::StringAlignment::StringAlignment_Near; text->Top = 40; text->Left = 40; rs = text->SizeToFit(); if (rs == S_OK) { VARIANT v; V_VT(&v) = VT_DISPATCH; V_DISPATCH(&v) = annotx; m_chartPtr->Extensions->Add(v); } } } Is the code wrong? Any help will be really appreciated! Regards! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.