I have a teechart with datetime on x-axis and Price on y-axis.
x and y axes are set automatically depending on the data to the chart.
Now, my question is what if I want my y-axis to have a much wider range of values, i.e for ex if the range of value to the y-axis varies from 10 to 20 then I want the y-axis value to vary from 0 to 30.
Is there a way to set the y-axis range? Please let me know
Thanks.
Setting the range for y-axis
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi TeeUser,
Yes, this is possible using axis SetMinMax method or Minimum and Maximum properties:
or
Yes, this is possible using axis SetMinMax method or Minimum and Maximum properties:
Code: Select all
tChart1.Axes.Left.SetMinMax(0,30);
Code: Select all
tChart1.Axes.Left.Minimum=0;
tChart1.Axes.Left.Maximum=30;
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 |
Hi,
Thanks a lot for the reply.
The data for my teechart is dynamic, meaning I cannot hard code the min and max value. Dpending on the data from the database max value has to be (max val from the database+ 10) and the min val has to be (min val from the database-10).
Is there a way to set it dynamically.
Thanks.
Thanks a lot for the reply.
The data for my teechart is dynamic, meaning I cannot hard code the min and max value. Dpending on the data from the database max value has to be (max val from the database+ 10) and the min val has to be (min val from the database-10).
Is there a way to set it dynamically.
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi TeeUser,
Yes, you can do something like the code below every time you add values to your series:
Another option is using axis MinimumOffset and MaximumOffset:
Please the unit for the offset units are pixels.
Yes, you can do something like the code below every time you add values to your series:
Code: Select all
private void LeftAxisUpdate()
{
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.Minimum=tChart1[0].YValues.Minimum-10;
tChart1.Axes.Left.Maximum=tChart1[0].YValues.Maximum+10;
}
private void Form1_Load(object sender, System.EventArgs e)
{
line1.FillSampleValues();
LeftAxisUpdate();
}
Code: Select all
private void Form1_Load(object sender, System.EventArgs e)
{
line1.FillSampleValues();
tChart1.Axes.Left.MinimumOffset=10;
tChart1.Axes.Left.MaximumOffset=10;
}
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi TeeUser,
Yes, you can use something like:
Please notice that a date is necessary and you'll have to consider that.
Yes, you can use something like:
Code: Select all
tChart1.Axes.Bottom.Labels.DateTimeFormat = "hh:mm";
tChart1.Axes.Bottom.SetMinMax(new DateTime(2006,1,23,9,00,00).ToOADate(),
new DateTime(2006,1,23,16,00,00).ToOADate());
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 |