Custom labels on Z Axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Custom labels on Z Axis

Post by westacotta » Mon Jul 07, 2008 11:40 am

Hi,

How can I supply custom labels on the Z axis when using a 3D surface series?

Thanks
Andy

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 Jul 07, 2008 1:26 pm

Hi Andy,

You can use custom labels like this:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Surface surface1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);

			surface1.FillSampleValues();

			tChart1.Axes.Depth.Visible = true;
			tChart1.Axes.Depth.Labels.Items.Clear();

			for (double i = surface1.MinZValue(); i < surface1.MaxZValue(); i++)
			{
				tChart1.Axes.Depth.Labels.Items.Add(i, i.ToString());
			}
		}
Or use GetAxisLabel event:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Surface surface1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);

			surface1.FillSampleValues();

			tChart1.Axes.Depth.Visible = true;
			tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
		}

		void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
		{
			if (sender == tChart1.Axes.Depth)
			{
				e.LabelText = "hi!";
			}
		}
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Mon Jul 07, 2008 3:18 pm

Hi,

Thanks for that. That solves part of my problem.

I've noticed though that the GetAxisDrawLabel event doesn't seem to be fired for this axis?

I'm subscribing like so:
m_teeChart.Axes.Depth.GetAxisDrawLabel += new GetAxisDrawLabelEventHandler(Handle_GetAxisDrawLabel);

Thanks
Andy

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

Post by Narcís » Tue Jul 08, 2008 7:31 am

Hi Andy,

Have you tried setting depth axis to visible like in the code snippet I used?

BTW: You can also generate the event at designtime.
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Tue Jul 08, 2008 8:16 am

Hi,

Yep I tried setting the depth axes to visible but it had no effect. The axes is showing fine but just not firing the event which I need. it works fine for the x and y axes but not the z (depth).

Can you confirm if this is a bug or not as soon as possible?

Thanks
Andy

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

Post by Narcís » Tue Jul 08, 2008 8:32 am

Hi Andy,

It worked fine for me here using latest TeeChart for .NET v3 release available at the client area and the code snippet above. Which TeeChart version are you using?

If the problem persists could you 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.
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Tue Jul 08, 2008 9:26 am

Hi,

Just downloaded the latest teechart (3.5.3105.20151) and the GetAxisDrawLable event is still not fired for the depth axes.

I have uploaded a sample (TeeChartBugTest.zip) to your uploads area that demonstrates this. The sample basically consists of the following code:

Code: Select all

	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();

			surface1.FillSampleValues();
			tChart1.Axes.Depth.Visible = true; 
			tChart1.Axes.Depth.GetAxisDrawLabel += new Steema.TeeChart.GetAxisDrawLabelEventHandler(Depth_GetAxisDrawLabel);
			tChart1.Axes.Bottom.GetAxisDrawLabel += new Steema.TeeChart.GetAxisDrawLabelEventHandler(Bottom_GetAxisDrawLabel);
			tChart1.Axes.Left.GetAxisDrawLabel += new Steema.TeeChart.GetAxisDrawLabelEventHandler(Left_GetAxisDrawLabel);

		}

		void Left_GetAxisDrawLabel(object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
		{
			e.Text = "left";
		}

		void Bottom_GetAxisDrawLabel(object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
		{
			e.Text = "bottom";
		}

		void Depth_GetAxisDrawLabel(object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
		{
			e.Text = "depth";
		}
the left and bottom axes area set correct but the depth one is not.

Thanks
Andy

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

Post by Narcís » Tue Jul 08, 2008 10:29 am

Hi Andy,

Thanks for the information. I could reproduce the issue here and added it (TF02013195) to the bug list to be fixed for future releases.

In the meantime you can use GetAxisLabel event instead, for example:

Code: Select all

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

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Surface surface1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);
			surface1.FillSampleValues();
			tChart1.Axes.Depth.Visible = true;
			tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
		}

		void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
		{
			if (sender == tChart1.Axes.Left)
			{
				e.LabelText = "Left";
			}
			else
			{
				if (sender == tChart1.Axes.Bottom)
				{
					e.LabelText = "Bottom";
				}
				else
				{
					if (sender == tChart1.Axes.Depth)
					{
						e.LabelText = "Depth";
					}
				}
			}
		}
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Tue Jul 08, 2008 10:37 am

But GetAxisLabel isn't called for custom labels!

The reason I was using GetAxisDrawLabel was to provide my own logic for stopping custom labels overwrite each other when drawn close together. This works pretty well for x and y in both 2D and 3D but obviously now I can't do z when in 3D.

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

Post by Narcís » Tue Jul 08, 2008 10:45 am

Hi Andy,

In that case I recommend you to read this thread. Please notice this is quite a long thread (has several pages) and what you are looking for may not appear in the first posts. However, several possibilities were discussed there.
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Tue Jul 08, 2008 10:53 am

I read that thread originally.

Most of the methods weren't suitable or gave slightly dubious results. The only method that was close was the the GetAxisDrawLabel although that needed some tweaking to give some decent results.

Can you explain why this isn't supported natively in the chart. The algorithm is quite simple and I can't imagine many occasions you would want labels to overlap at all.

1. Always draw the first label
2. If the next label will overlap the last drawn label then don't draw it
3. repeat 2 until complete.

Thats basically what I do and it works fine.

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 Jul 09, 2008 9:45 am

Hi Andy,

TeeChart's default labels already support anti-overlapping. Not everybody expects the same of custom labels and we have been asked for the possibility to overlap so custom labels positioning decision is left to the user.
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Wed Jul 09, 2008 9:56 am

But don't you think it makes sense you have the option of using teeCharts built in overlapping logic on custom labels?

Seems a crazy waste of effort for any developer using teechart to basically duplicate the same code as you have especially.

Can I raise this as an official feature request please.

Also do you have an estimate of when the bug with depths getaxisdrawlabel will be fixed.

thanks
Andy

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

Post by Narcís » Fri Jul 11, 2008 11:33 am

Hi westacotta,

There are no short term plans to add overlap checks on Custom Labels though it has been added as a feature request for review. GetAxisDrawLabel event support has been added to the DepthAxis to be included with the next maintenance release.
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

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Fri Jul 11, 2008 12:35 pm

ok thanks.

any idea when the next maintenance release will be?

Post Reply