need custom labels on depth axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
dave
Newbie
Newbie
Posts: 4
Joined: Thu Oct 31, 2002 5:00 am

need custom labels on depth axis

Post by dave » Mon Aug 02, 2004 8:02 pm

While the numeric labels are visible, I need to replace them with custom text labels on the depth axis. Is there a way to do this?

version 1.0.1189.31308

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Aug 03, 2004 12:38 am

Hi Dave,

yes, you can use the OnGetAxisLabel event :

Code: Select all

private void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
{
if ((Steema.TeeChart.Axis)sender == tChart1.Axes.Depth)
{
	e.LabelText = "Hello";
	//..
}
}

dave
Newbie
Newbie
Posts: 4
Joined: Thu Oct 31, 2002 5:00 am

Post by dave » Wed Aug 04, 2004 2:10 pm

I got it working, but noticed that e.LabelText sometimes contained strings that did not make sense. My data is from 0-16 but string values of -1.88 or 20 would sometimes be found in e.LabelText during this event. I've filtered these out, but is there any way to make this less "hacky"?

Thanks,

if((Steema.TeeChart.Axis)sender == tChart1.Axes.Depth)
{
// Get the index value for the label
int index = 0;
try
{
index = Convert.ToInt32(e.LabelText);
}
catch(FormatException)
{
// Bomb out if string did not represent an int
return;
}

// Populate the labels for the depth axis
// Ignore index values outside the allowed range
if(index < masterCal.CalibrationData.X_AxisSize)
e.LabelText = masterCal.CalibrationData.X_Axis.RowValue[index];
}

Post Reply