Jump to content
Software FX Community
Sign in to follow this  
nicovil

VC++ annotations not working

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...