Jump to content
Software FX Community

Assigning Legend Labels


User (Legacy)
 Share

Recommended Posts

Hello, 

I've been trying to set legends to series with the following code:

for (int i = 0; i < 3; i++)

{

ICfxSeriesPtr pSerie = m_pChartFX->Series->Item[nSerie+i];

CString strLabel;

strLabel.Format("%s - %s", pSection->GetName(), (i==0) ? "Major" :

"Minor");

pSerie->Legend = (const char *)strLabel;

}

If I open a chart window all is well, the legend labels are there and

everything works. But after I close the window, I cannot create another

chart window. The function CreateControl fails.

BUT!

if I execute the following code:

for (int i = 0; i < 3; i++)

{

ICfxSeriesPtr pSerie = m_pChartFX->Series->Item[nSerie+i];

pSerie->Legend = (const char *)pSection->GetName();

}

I can create and close as many windows as I like, CreateControl never fails.

Both the strLabel and the pSection->GetName() result in a CString object, so

there's no difference there. At first I thought that the solution was in the

scope of the variables, as pSection->GetName() is permanently active. So I

created a static array of CString objects and used that to format the string

and used that for the legend. Same difference.

Then I used the CString::AllocSysString() which creates a BSTR object. No

difference.

And at the moment I'm out of options, but running against a deadline.

Does anybody have a clue?

Thanks!

Rob Ursem

Link to comment
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.

 Share

×
×
  • Create New...