Page 1 of 1

Series Band missing?

Posted: Thu Jun 22, 2006 10:19 am
by 9529132
Hi,

I am trying the series band property with the code below
m_chart2.Series(0).FillSampleValues(200);
m_chart2.Series(1).FillSampleValues(200);
m_chart2.Series(2).FillSampleValues(200);

m_chart2.GetTools().Add(????????);

m_chart2.GetTools().GetItems(0).GetAsSeriesBand().SetSeries(COleVariant("1"));
m_chart2.GetTools().GetItems(0).GetAsSeriesBand().SetSeries2(COleVariant("2"));
m_chart2.GetTools().GetItems(0).GetAsSeriesBand().GetBrush().SetColor(RGB(255,125,128));
m_chart2.GetTools().GetItems(0).GetAsSeriesBand().SetTransparency(50);
m_chart2.GetTools().GetItems(0).GetAsSeriesBand().SetDrawBehindSeries(TRUE);

However, there is no seriesband ToolClass available for m_chart2.GetTools().Add(). The VB example uses tcSeriesBand. what's the equivalent name in C++?

Thank you very much,
David

Posted: Fri Jun 23, 2006 8:36 am
by Marc
Hello David,

This seems result of the same update problem as the source revision. We'll modify the TeeChartDefines.h file and post the revision on the attachments newsgroup. Apologies once again for the omission.

Meantime you can edit the file directly, modifying the Tools and Series sections to the following:

Code: Select all

// EToolClass
const unsigned long tcCursor = 0; 
const unsigned long tcDragMarks = 1; 
const unsigned long tcAxisArrow = 2; 
const unsigned long tcDrawLine = 3; 
const unsigned long tcNearest = 4; 
const unsigned long tcColorband = 5; 
const unsigned long tcColorLine = 6; 
const unsigned long tcRotate = 7;
const unsigned long tcMarksTip = 8;
const unsigned long tcChartImage = 9;
const unsigned long tcAnnotate = 10;
const unsigned long tcPageNumber = 11;
const unsigned long tcGridTranspose = 12;
const unsigned long tcExtraLegend = 13;
const unsigned long tcSeriesAnimation = 14;
const unsigned long tcGantt = 15;
const unsigned long tcGridBand = 16;
const unsigned long tcPie = 17;
const unsigned long tcDragPoint = 18;
const unsigned long tcLegendScrollBar = 19;
const unsigned long tcLight = 20;
const unsigned long tcSurfaceNearest = 21;
const unsigned long tcAxisScroll = 22;
const unsigned long tcSeriesBand = 23;
const unsigned long tcSelector = 24;
const unsigned long tcRectangle = 25;
const unsigned long tcDataTable = 26;

//ESeriesClass
...add...

const unsigned long scVolumePipe = 48;
Regards,
Marc Meumann

Posted: Mon Jun 26, 2006 1:02 am
by 9529132
Hi, Marc,

I edited the TeeChartDefines.h and changed my code to

m_chart1.Series(0).FillSampleValues(200);
m_chart1.Series(1).FillSampleValues(200);
m_chart1.GetTools().Add(tcSeriesBand);
m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetSeries(COleVariant("0"));
m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetSeries2(COleVariant("1"));
m_chart1.GetTools().GetItems(0).GetAsSeriesBand().GetBrush().SetColor(RGB(255,125,128));
m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetTransparency(50);
m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetDrawBehindSeries(TRUE);

But it still couldn't work. Would you please test it again?

Thank you very much!
David

Posted: Mon Jun 26, 2006 9:41 am
by Marc
Hello David,

Please check that you have the TeeChartDefine.h file in your project folder and included in the unit where the constant call is:

Code: Select all

#include "TeeChartDefines.h"
I had to tweak your code a little to get it to accept the Series as inputs to the SeriesBandTool. You can set them via the Series themselves. You might fiind a more efficient way to do the following but the code does work ok when tested here:

Code: Select all

	// TODO: Add your control notification handler code here
	m_chart1.Series(0).FillSampleValues(200); 
	m_chart1.Series(1).FillSampleValues(200);
	
	m_chart1.GetTools().Add(tcSeriesBand); 

	VARIANT SourceSeries1;

	SourceSeries1.vt=VT_DISPATCH;
	CSeries InputSeries1=m_chart1.Series(0);
	SourceSeries1.pdispVal=InputSeries1;

	VARIANT SourceSeries2;

	SourceSeries2.vt=VT_DISPATCH;
	CSeries InputSeries2=m_chart1.Series(1);
	SourceSeries2.pdispVal=InputSeries2;

	m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetSeries(SourceSeries1); 
	m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetSeries2(SourceSeries2); 
	m_chart1.GetTools().GetItems(0).GetAsSeriesBand().GetBrush().SetColor(RGB(255,125,128)); 
	m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetTransparency(50); 
	m_chart1.GetTools().GetItems(0).GetAsSeriesBand().SetDrawBehindSeries(TRUE);
Regards!
Marc

Posted: Mon Jun 26, 2006 10:02 am
by 9529132
Hi, Marc,

It finally works. Thank you very much! I am looking forward to the latest updates so that there won't be definition missing problem.

David