Increment issue.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
tomking
Newbie
Newbie
Posts: 20
Joined: Thu Jan 15, 2009 12:00 am
Contact:

Increment issue.

Post by tomking » Tue Apr 19, 2011 6:31 am

Dear Support team,
I have a question about Teechart Increment. I just want to display 2 labels at Min and Max. So I code as below:

//Line 1
for (int i = 0; i < 300; i++ )
{
this.line1.Add(i % 100);
}

this.tChart1.Axes.Bottom.Visible = true;
this.tChart1.Axes.Left.Visible = true;
this.tChart1.Axes.Left.Automatic = false;
this.tChart1.Axes.Left.Minimum = 0;
this.tChart1.Axes.Left.Maximum = 100;
this.tChart1.Axes.Left.Increment = this.tChart1.Axes.Left.Maximum - this.tChart1.Axes.Left.Minimum;



//Line 2
for (int i = 0; i < 300; i++)
{
if(i>100)
this.line2.Add(-i % 100);
else
this.line2.Add(i % 100);
}

this.tChart2.Axes.Bottom.Visible = true;
this.tChart2.Axes.Left.Visible = true;
this.tChart2.Axes.Left.Automatic = false;
this.tChart2.Axes.Left.Minimum = -100;
this.tChart2.Axes.Left.Maximum = 100;
this.tChart2.Axes.Left.Increment = this.tChart2.Axes.Left.Maximum - this.tChart2.Axes.Left.Minimum;

And the result is
Image

Could you please let me know where where are lables of Min and Max in second chart?
Why does not it display Min label and Max label like chart1?

Thank you very much!

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Increment issue.

Post by Sandra » Tue Apr 19, 2011 11:19 am

Hello tomking,

Testing your code I can see that when you assign increment in second chart, this is zero because Maximum is 100 and Minimum is -100 and difference is zero and the value of label in this case only would be zero. I recommend, if you want of Left axis increments well do next:

Code: Select all

      

            this.tChart2.Axes.Left.Increment = 100;
Could you confirm us if this change solve your problem?
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

tomking
Newbie
Newbie
Posts: 20
Joined: Thu Jan 15, 2009 12:00 am
Contact:

Re: Increment issue.

Post by tomking » Wed Apr 20, 2011 12:30 am

Hi Sandra,
Thanks for your reply!
I just want to display only 2 labels at MIN and MAX position. That 's why I set:
this.tChart2.Axes.Left.Increment = this.tChart2.Axes.Left.Maximum - this.tChart2.Axes.Left.Minimum;
If I set
this.tChart2.Axes.Left.Increment = 100; It will display 3 labels that don't want.

Could you please hepl me to figure out this?
Thanks

Anton
Newbie
Newbie
Posts: 5
Joined: Mon Apr 11, 2011 12:00 am

Re: Increment issue.

Post by Anton » Wed Apr 20, 2011 5:57 am

What about custom labels. Will that solve your problem?

Code: Select all

TChart1.Axes.Left.Labels.Items.Clear()
TChart1.Axes.Left.Labels.Items.Add(MIN, MIN.ToString())'or Format(
TChart1.Axes.Left.Labels.Items.Add(MIN, MAX.ToString())
*I have not checked that piece of code myself. I use it to place logarithmic labels on a linear axis like this:

Code: Select all

TChart2.Axes.Left.Labels.Items.Clear()
Chart2.Axes.Left.CalcMinMax(min, max)
imin = Math.Truncate(min)
imax = Math.Ceiling(max)
For i As Double = imin To imax Step 1
      TChart2.Axes.Left.Labels.Items.Add(i, Math.Pow(10, i).ToString())
Next

tomking
Newbie
Newbie
Posts: 20
Joined: Thu Jan 15, 2009 12:00 am
Contact:

Re: Increment issue.

Post by tomking » Wed Apr 20, 2011 11:30 am

Hi Anton,
I have solved this problem by custom labels.
Thank you very much!

AIS
Newbie
Newbie
Posts: 70
Joined: Wed Jun 25, 2008 12:00 am

Re: Increment issue.

Post by AIS » Wed Apr 20, 2011 12:41 pm

This should also work ;)

Code: Select all

this.tChart2.Axes.Left.Increment = 200

Post Reply