Page 1 of 1
Min-max labels of custom vertical axis
Posted: Sun Nov 20, 2011 4:47 pm
by 13051032
I need to always display min-max values of custom Y-axis to a nearest rounded value. How can I do it?
Any help will be appreciated.
Re: Min-max labels of custom vertical axis
Posted: Mon Nov 21, 2011 3:01 pm
by 10050769
Hello asupriya,
You can use a methods of Math class to around the min and max values. You can do something as next code:
Code: Select all
Steema.TeeChart.Styles.Line line1 = new Line(tChart1.Chart);
Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis(tChart1.Chart);
tChart1.Axes.Custom.Add(axis1);
line1.FillSampleValues(100);
line1.CustomVertAxis = axis1;
tChart1.Panel.MarginLeft = 10;
double max, min, max1,min1;
max= 100.5559;
min = 0.55559;
max1 = Math.Round(max);
min1 = Math.Round(min);
axis1.SetMinMax(min1, max1);
Can you tell us, if this solution allow you do as you want?
I hope will helps.
Thanks,
Re: Min-max labels of custom vertical axis
Posted: Mon Nov 21, 2011 5:45 pm
by 13051032
Sandra,
Thanks for the reply. However, what I needed to know was about the labels of custom vertical axis. I successfully set the SetMinMax, but the labels on the min and max values of custom-axis are not being displayed. I need to have labels displayed on the min, max values.
Re: Min-max labels of custom vertical axis
Posted: Tue Nov 22, 2011 11:11 am
by 10050769
Hello asupriya,
Ok. I think can help you use Minimum and Maximum offset as do in next simple example:
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Line(tChart1.Chart);
tChart1.Aspect.View3D = false;
tChart1.Panel.MarginLeft = 10;
Random rnd = new Random();
for (int i = 0; i < 10; i++)
{
line1.Add(i, rnd.Next(20));
}
Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis(tChart1.Chart);
tChart1.Axes.Custom.Add(axis1);
line1.CustomVertAxis = axis1;
axis1.SetMinMax(1, 15);
axis1.MaximumOffset = 15;
axis1.MinimumOffset= 1;
axis1.AxisPen.Color = Color.Red;
}
Can you tell us if previous serve you to achieves as you want?
I hope will helps.
Thanks,