How to: Add vertical & horizontal Median lines on scatte

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

How to: Add vertical & horizontal Median lines on scatte

Post by ASM » Wed Dec 13, 2006 3:53 pm

Hello,
is it possible to have a scatter chart with a vertical & horizontal median lines? If so, can someone point us in the right direction?

The scatter is to determine how a person is performing against their peers.

Thanks!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 13, 2006 3:57 pm

Hi ASM,

Yes, this can be done as shown in the What's New?\Welcome !\New Functions\Median Function example. This example can be found at the features demo available at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

Post by ASM » Wed Dec 13, 2006 3:59 pm

Narcís
Thanks for the quick response!

Chris
ASM Research

ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

Post by ASM » Wed Dec 13, 2006 6:57 pm

we can get the horizontal median to display but how do we also display a vertical median to create a "crosshair".

Thanks!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Dec 14, 2006 9:41 am

Hi ASM,

Vertical median function doesn't exist. However, you can easily implement that using an horizontal line series like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			tChart1.Aspect.View3D = false;
			line1.FillSampleValues();

			Steema.TeeChart.Styles.HorizLine vertMedian1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);

			double xMedian;

			if (line1.Count % 2 != 0)
				xMedian = line1.XValues[(line1.Count / 2) + 1];
			else
				xMedian = (line1.XValues[(line1.Count / 2)] + line1.XValues[(line1.Count / 2) + 1]) / 2;

			vertMedian1.Add(xMedian, line1.YValues.Minimum);
			vertMedian1.Add(xMedian, line1.YValues.Maximum);
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Dec 14, 2006 12:57 pm

Hi ASM,

Sorry but I noticed my initial algorithm was wrong, should be like this:

Code: Select all

		private void Form1_Load(object sender, EventArgs e)
		{
			tChart1.Aspect.View3D = false;
			line1.FillSampleValues();

			Steema.TeeChart.Styles.HorizLine vertMedian1 = new Steema.TeeChart.Styles.HorizLine(tChart1.Chart);

			double xMedian;

			if (line1.Count % 2 == 0)
				xMedian = line1.XValues[(line1.Count / 2)];
			else
				xMedian = (line1.XValues[(line1.Count / 2)] + line1.XValues[(line1.Count / 2) + 1]) / 2;

			vertMedian1.Add(xMedian, line1.YValues.Minimum);
			vertMedian1.Add(xMedian, line1.YValues.Maximum);
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

scatter chart line1 object

Post by ASM » Fri Dec 15, 2006 8:55 pm

What sort of object is line1? Would you send the fully qualified objects to draw a line?

ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

Post by ASM » Fri Dec 15, 2006 9:57 pm

Also, can you post the VB.NET equivalent of the algorithm you gave? I am having trouble converting some of your declarations. For example, I can't do:

Dim vertMedian1 = As New Steema.TeeChart.Styles.HorizLine

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 18, 2006 8:39 am

Hi ASM,

I have converted C# code to VB.NET code using Kamal Patel's conversor. You may also be interested in knowing of Carlos Aguilar's conversor.

Code: Select all

      Private  Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
         tChart1.Aspect.View3D = False
         line1.FillSampleValues()
 
         Dim vertMedian1 As Steema.TeeChart.Styles.HorizLine =  New Steema.TeeChart.Styles.HorizLine(tChart1.Chart) 
 
         Dim xMedian As Double
 
         If line1.Count % 2 = 0 Then
            xMedian = line1.XValues((line1.Count / 2))
         Else 
            xMedian = (line1.XValues((line1.Count / 2)) + line1.XValues((line1.Count / 2) + 1)) / 2
         End If
 
         vertMedian1.Add(xMedian, line1.YValues.Minimum)
         vertMedian1.Add(xMedian, line1.YValues.Maximum)
      End Sub
If the VB.NET code I posted doesn't work for you please let me know.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply