Jump to content
Software FX Community

Assigning Legend Labels


User (Legacy)

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...