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
SetName() works differently for GetXValues and GetYValues?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi David,
Are you using Add or AddXY method to populate your series? Using AddXY may solve this issue.
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 |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.:
According to this, the following code works fine:
I've added an item to our wish-list to add a property to change the Index column header.
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);
}
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");
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |