Page 1 of 1

Marktips with multiple series

Posted: Fri Nov 07, 2008 8:23 am
by 13045482
Hi
I have a teechart which has 3 different type of series. Like the first one is in shape of line the second in shape of circle, third is triangle. Now line series has many data that is i have 5 lines in my chart, 5 circles and 5 triangles. Now i want marktips to be shown for each series like this

for line series-> seriestitle
for circle series-> X,y points
for triangle series-> X,y points


I tried something like ->

MarksTip1.Series.Add(tchlinVPECurve)
MarksTip1.Style = Steema.TeeChart.Styles.MarksStyles.SeriesTitle

MarksTip2.Series.Add(ActualMarker)
MarksTip2.Style = Steema.TeeChart.Styles.MarksStyles.XY

MarksTip3.Series.Add(ProposedMarker)
MarksTip3.Style = Steema.TeeChart.Styles.MarksStyles.XY

But it throws error-> object reference not set .. though i have created marktips in design mode and then using them in code. Also error is at these lines->
MarksTip1.Series.Add(tchlinVPECurve)
MarksTip2.Series.Add(ActualMarker)
MarksTip3.Series.Add(ProposedMarker)

Posted: Fri Nov 07, 2008 10:10 am
by narcis
Hi shikha,

You should try using this code instead:

Code: Select all

MarksTip1.Series=tchlinVPECurve
MarksTip2.Series=ActualMarker
MarksTip3.Series=ProposedMarker
If the "object reference not set" error persists please send us a simple example project we can run "as-is" to reproduce the problem here. You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Fri Nov 07, 2008 10:19 am
by 13045482
Thanks but this will add only the first series. That is it will show tooltip for only one line, one triangle and one circle where as i am adding multiple series for each series in chart. That is i have many lines many circles and many rectangles in chart.
I am using

procedure x()
tcStraAssessRC.Series.Add(tchlinVPECurve)
tcStraAssessRC.Series.Add(ActualMarker)
tcStraAssessRC.Series.Add(ProposedMarker)

.........

end sub

and calling this procedure many times. So if i use wht u suggested then it will only display last series data.

Posted: Fri Nov 07, 2008 10:36 am
by 13045482
also why after doing

MarksTip1.Series.Add(tchlinVPECurve)
MarksTip1.Series.RefreshSeries()

if i do ?MarksTip1.Series.Count why it shows 0?


why MarksTip1.Series.Add does not work

Posted: Fri Nov 07, 2008 11:02 am
by narcis
Hi shikha,

Sorry but after looking at this thoroughly I've found that you should use MarksTip.Series.Add, this is called when a new value is added to the series as it adds all points in source Series.

To achieve what you request you should use a MarksTip tool for each series, for example:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			for (int i = 0; i < 5; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
				tChart1.Series.Add(new Steema.TeeChart.Styles.Points());
				tChart1.Series.Add(new Steema.TeeChart.Styles.Points());
			}

			for (int i = 0; i < tChart1.Series.Count; i++)
			{
				tChart1[i].FillSampleValues();
				Steema.TeeChart.Tools.MarksTip marksTip = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
				marksTip.Series = tChart1[i];

				int tmp = i % 3;

				switch (tmp)
				{
					case 0: 
						marksTip.Style = Steema.TeeChart.Styles.MarksStyles.SeriesTitle;						
						break;
					case 1:
						marksTip.Style = Steema.TeeChart.Styles.MarksStyles.XY;
						((Steema.TeeChart.Styles.Points)tChart1[i]).Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
						break;
					case 2:
						marksTip.Style = Steema.TeeChart.Styles.MarksStyles.XY;
						((Steema.TeeChart.Styles.Points)tChart1[i]).Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Triangle;
						break;
				}
			}
		}