Page 1 of 1
Hiding Axis Labels
Posted: Sun Mar 30, 2014 9:21 pm
by 15666968
Hi,
I need to hide/remove parts of the axes labels for a Points Chart. For example, I do not want to display any labels that less than zero:
Y Axis: -50 to 150
Aim: To display labels on the chart only between 0 and 150
How can I achieve this?
Thanks,
Re: Hiding Axis Labels
Posted: Mon Mar 31, 2014 10:51 am
by Christopher
Hello,
lilo wrote:Y Axis: -50 to 150
Aim: To display labels on the chart only between 0 and 150
You can use the GetNextAxisLabel event, e.g.
Code: Select all
private Steema.TeeChart.Styles.Points series1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
series1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
Random rnd = new Random();
for (int i = 0; i < 20; i++)
{
series1.Add(i, rnd.Next(-50, 150));
}
tChart1.GetNextAxisLabel += tChart1_GetNextAxisLabel;
}
void tChart1_GetNextAxisLabel(object sender, GetNextAxisLabelEventArgs e)
{
if(tChart1.Axes.Left.Equals(sender))
{
e.Stop = false;
switch (e.LabelIndex)
{
case 0: e.LabelValue = 0; break;
case 1: e.LabelValue = 50; break;
case 2: e.LabelValue = 100; break;
case 3: e.LabelValue = 150; break;
default: e.Stop = true; break;
}
}
}