Page 1 of 1

need custom labels on depth axis

Posted: Mon Aug 02, 2004 8:02 pm
by 6925458
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

Posted: Tue Aug 03, 2004 12:38 am
by Pep
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";
	//..
}
}

Posted: Wed Aug 04, 2004 2:10 pm
by 6925458
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];
}