Custom labels on Z Axis
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 am
Custom labels on Z Axis
Hi,
How can I supply custom labels on the Z axis when using a 3D surface series?
Thanks
Andy
How can I supply custom labels on the Z axis when using a 3D surface series?
Thanks
Andy
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Andy,
You can use custom labels like this:
Or use GetAxisLabel event:
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());
}
}
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 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:
the left and bottom axes area set correct but the depth one is not.
Thanks
Andy
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";
}
Thanks
Andy
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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:
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 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.
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.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 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
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
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 10
- Joined: Mon Nov 05, 2007 12:00 am