SetName() works differently for GetXValues and GetYValues?

TeeChart for ActiveX, COM and ASP
Post Reply
David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

SetName() works differently for GetXValues and GetYValues?

Post by David » Mon Jun 19, 2006 10:51 am

Hi,

I would like to export a chart to a xls file with x and y have their own headers instead of just X and Y. So I tried this way

m_chart1.GetExport().GetAsXLS().SetIncludeHeader(TRUE);
m_chart1.GetExport().GetAsXLS().SetIncludeIndex(TRUE);
m_chart1.GetExport().GetAsXLS().SetIncludeLabels(FALSE);
m_chart1.Series(0).GetXValues().SetName("Degree");
m_chart1.Series(0).GetYValues().SetName("CH0");

However, in the xls file, I can only see two columns, one with a header "Index" and the other "CH0". It seems the SetName() works differently for GetXValues and GetYValues.

Any suggestions?

David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jun 19, 2006 11:20 am

Hi David,

Are you using Add or AddXY method to populate your series? Using AddXY may solve this issue.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Post by David » Mon Jun 19, 2006 2:03 pm

Hi, Narcís,

Actually I use AddRealTime since the series is defined as FastLine. Is it possible to realize it with AddRealTime?

Thanks
David

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 20, 2006 12:41 pm

Hi David,

It's quite weird as it works perfectly using VB6 but doesn't using Visual C++. I've added the issue (TA05011505) to our defect list to be investigated and, if necessary, fixed for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 27, 2006 8:49 am

Hi David,

After more investigation we have found that if XValues are the same as the index the XValues column is not shown. This would happen when the for populating the series starts at 0, i.e.:

Code: Select all

	for (int i=0; i<100; i++) 
	{
		m_Chart1.Series(0).GetAsFastLine().AddRealTime(i,i*i,"",clTeeColor);
	}
According to this, the following code works fine:

Code: Select all

void CExcelExportDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	m_Chart1.AddSeries(scFastLine);

	for (int i=1; i<100; i++) 
	{
		m_Chart1.Series(0).GetAsFastLine().AddRealTime(i,i*i,"",clTeeColor);
	}

	m_Chart1.Series(0).GetXValues().SetName("Degree");
	m_Chart1.Series(0).GetYValues().SetName("CHO");	
}

void CExcelExportDlg::OnButton1() 
{
	VARIANT varX, varY;

	VariantInit(&varX);
	varX.vt = VT_BSTR;
	varX.bstrVal = m_Chart1.Series(0).GetXValues().GetName().AllocSysString();

	
	VariantInit(&varY);	
	varY.vt = VT_BSTR;
	varY.bstrVal = m_Chart1.Series(0).GetYValues().GetName().AllocSysString();


	m_Chart1.GetHeader().GetText().Add(varX);
	m_Chart1.GetHeader().GetText().Add(varY);

	m_Chart1.GetExport().GetAsXLS().SetIncludeHeader(true);
	m_Chart1.GetExport().GetAsXLS().SetIncludeIndex(true);
	m_Chart1.GetExport().GetAsXLS().SetIncludeLabels(false);
	
	m_Chart1.GetExport().GetAsXLS().SetSeries(COleVariant("0"));	
	m_Chart1.GetExport().GetAsXLS().SaveToFile("e:\\Temp\\MyTeeChart.xls");	
		
}
I've added an item to our wish-list to add a property to change the Index column header.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply