Page 1 of 1

Markstip working differently after updating?

Posted: Thu Sep 25, 2008 1:06 am
by 6923298
Hi,

I've just updated my TeeChart .Net V3 to 3.5.3187.15584 and my MarksTip function no longer works as it was previously.

My original Markstip function was setup as shown below and was based on advice from http://www.teechart.net/support/viewtop ... highlight= (see Edu's post on 11-May-07). Basically, I wanted to get MarksTip to use a different label for the CrossPoint. Prior to the update, I was getting the correct label but after the update, all the labels were identical.

The full code is quite long, so here's a bits and pieces of it.

Code: Select all

        private Steema.TeeChart.Styles.Line exportLine;        
        private int on_ExportLines;

marksTip.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip_GetText);

        void marksTip_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
        {
            if (on_ExportLines != -1 && exportLine != null)            
            {
                e.Text = exportLine.Labels[on_ExportLines];
            }
        }

        private void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if (tChart1.Series.Count > 0)
            {
                if (exportLine != null)
                {
                    on_ExportLines = exportLine.Clicked(e.X, e.Y);
                }
            }
        }
Please advise. Thanks.

Posted: Thu Sep 25, 2008 10:08 am
by narcis
Hi pw,

Code below works fine for me here. Could you please check if it works at your end and modify it so that I can reproduce the problem here?

Code: Select all

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

		private Steema.TeeChart.Styles.Line exportLine;
		private int on_ExportLines = -1; 

		private void InitializeChart()
		{
			tChart1.Aspect.View3D = false;

			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			Steema.TeeChart.Styles.Line line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			line1.FillSampleValues();
			line2.FillSampleValues();

			Steema.TeeChart.Functions.CrossPoints crossPoints1 = new Steema.TeeChart.Functions.CrossPoints(tChart1.Chart);
			exportLine = new Steema.TeeChart.Styles.Line(tChart1.Chart);

			exportLine.Function = crossPoints1;
			exportLine.DataSource = new object[] { line1, line2 };
			exportLine.Pointer.Visible = true;

			for (int i = 0; i < exportLine.Count; i++)
			{
				exportLine.Labels[i] = "intersection point " + Convert.ToString(i + 1);
			}

			Steema.TeeChart.Tools.MarksTip marksTip1 = new Steema.TeeChart.Tools.MarksTip(tChart1.Chart);
			marksTip1.Series = exportLine;
			marksTip1.GetText += new Steema.TeeChart.Tools.MarksTipGetTextEventHandler(marksTip1_GetText);

			tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
		}

		void tChart1_MouseMove(object sender, MouseEventArgs e)
		{
			if (tChart1.Series.Count > 0)
			{
				if (exportLine != null)
				{
					on_ExportLines = exportLine.Clicked(e.X, e.Y);
				}
			} 
		}

		void marksTip1_GetText(Steema.TeeChart.Tools.MarksTip sender, Steema.TeeChart.Tools.MarksTipGetTextEventArgs e)
		{
			if (on_ExportLines != -1 && exportLine != null)
			{
				e.Text = exportLine.Labels[on_ExportLines];
			} 
		}
Thanks in advance.

Posted: Tue Sep 30, 2008 11:16 pm
by 6923298
Hi Narcis,

In your code, the MarksTip is assigned to a particular series, e.g marksTip1.Series = exportLine

If I have a few lines, do I have to create different MarksTip for each of those lines?

Thanks.

Good question

Posted: Wed Oct 01, 2008 12:33 am
by 8739068
I wondered that as well.

Posted: Wed Oct 01, 2008 8:08 am
by narcis
Hello everyone,
If I have a few lines, do I have to create different MarksTip for each of those lines?
Not necessarily. If you don't assign it to a specific series it will work for all series. However, depending on your requirements you may need to create a tool for each series.