Page 1 of 1

Automatic Minimum/Maximum for Axes

Posted: Tue Jun 10, 2014 11:51 am
by 15966868
Other TeeChart implementations have a method to set the automaticMinimum / automaticMaximum for axis objects independently.

Is there a way to do this in the Javascript/HTML5 version?

Otherwise I'll try and do it from the data!

Kind regards

Mark

Re: Automatic Minimum/Maximum for Axes

Posted: Wed Jun 11, 2014 8:31 am
by yeray
Hello Mark,

There's the automatic property for the axes, and the checkMinMax function to force recalculate the axis range. Ie:

Code: Select all

  Chart1.axes.bottom.automatic=true;
  Chart1.axes.bottom.checkMinMax();

Re: Automatic Minimum/Maximum for Axes

Posted: Wed Jun 11, 2014 9:31 am
by 15966868
But can one have an automatic maximum, and a fixed minimum, ie:

chart1.axes.left.automaticMaximum=True;
chart1.axes.left.automaticMinimum=False;
chart1.axes.left.minimum=0;

This way (as with Teechart VCL and PHP) the minimum is always zero, whereas the maximum will scale with the data.

Mark

Re: Automatic Minimum/Maximum for Axes

Posted: Wed Jun 11, 2014 10:14 am
by yeray
Hi Mark,

Excuse me, I didn't understand that point.
I'll add it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=795
Feel free to add your mail to the CC list to be automatically notified when an update arrives.

At the moment, checkMinMax function does this:

Code: Select all

  this.checkMinMax=function() {
    var s=this.chart.series, h=this.horizontal;

    if (this.automatic) {
      this.minimum= h ? s.minXValue(this) : s.minYValue(this);
      this.maximum= h ? s.maxXValue(this) : s.maxYValue(this);
    }
  }
You can override it to have a fix minimum=0. Ie:

Code: Select all

  Chart1.axes.left.checkMinMax=function() {
    var s=this.chart.series, h=this.horizontal;

    if (this.automatic) {
      this.minimum=0;
      this.maximum= h ? s.maxXValue(this) : s.maxYValue(this);
    }
  }