Page 1 of 1

DrawEvery for Pointer instead of Marks

Posted: Wed Nov 15, 2006 7:13 pm
by 9346394
We are in the process of trying out the demo version of the .NET TeeChart to see if it will meet the functionality needs we have for a new app that we might write in C#. We have been using TeeChart in the Borland C++ Builder environment previously.
My test app is in Visual Studio .NET 2005 and is written in C# since that will be our dev environment going forward.

I am looking for a way to set an interval on the pointer symbols in a line series.
I know in the Marks there is the DrawEvery property that does exactly what I am looking for but I need it for the pointer symbols.
I have seen a few posts and responses that discuss doing this through the GetPointerStyle event handler for a series.

That would work fine but what I need to know from an implementation side is how do I set up that event handling when my series are created and added to the chart at runtime. I do not know how many series I will have at design time but I want to be able to set this interval for every series added to the chart.
Each example that I have seen talks about adding a Line1 series to the chart and creating an event handler for the GetPointerStyle event on that specific series. That looks great and the code within that handler shows me exactly what I want to do but I need to handle this GetPointerStyle event for each new series that gets added to my chart while running the application.

Any help you could give me on if/how this can be implemented would be greatly appreciated.

Aaron Peronto

Posted: Thu Nov 16, 2006 9:22 am
by narcis
Hi Aaron,

Achieving what you request at run-time is pretty easy as you can see in the example below. You can choose whether to display the pointer for each point using the GetPointerStyle event as shown below. In fact, using VS2005 it is very easy to assign events at design-time as code completion does most of the work for you. For example, just write line1.GetPointerStyle, type "+" and code completion will suggest the rest for you.

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			for (int i = 0; i < 10; i++)
			{
				Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
				line1.FillSampleValues();
				line1.Pointer.Visible = true;
				line1.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(line1_GetPointerStyle);
			}
		}

		void line1_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventArgs e)
		{
			if (e.ValueIndex % 5 == 0)
			{
				e.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle;
			}
			else
			{
				e.Style = Steema.TeeChart.Styles.PointerStyles.Nothing;
			}
		}

Posted: Thu Nov 16, 2006 2:03 pm
by 9346394
Thank you very much for the quick response.

That is exactly what I was looking for.
This works perfectly and will allow me to set an interval on each of my charts.