Page 1 of 1

Increment issue.

Posted: Tue Apr 19, 2011 6:31 am
by 13051494
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!

Re: Increment issue.

Posted: Tue Apr 19, 2011 11:19 am
by 10050769
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?

Re: Increment issue.

Posted: Wed Apr 20, 2011 12:30 am
by 13051494
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

Re: Increment issue.

Posted: Wed Apr 20, 2011 5:57 am
by 15659034
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

Re: Increment issue.

Posted: Wed Apr 20, 2011 11:30 am
by 13051494
Hi Anton,
I have solved this problem by custom labels.
Thank you very much!

Re: Increment issue.

Posted: Wed Apr 20, 2011 12:41 pm
by 13049497
This should also work ;)

Code: Select all

this.tChart2.Axes.Left.Increment = 200