Automatic Minimum/Maximum for Axes

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
amjonas
Newbie
Newbie
Posts: 6
Joined: Mon Aug 26, 2013 12:00 am

Automatic Minimum/Maximum for Axes

Post by amjonas » Tue Jun 10, 2014 11:51 am

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Automatic Minimum/Maximum for Axes

Post by Yeray » Wed Jun 11, 2014 8:31 am

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();
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

amjonas
Newbie
Newbie
Posts: 6
Joined: Mon Aug 26, 2013 12:00 am

Re: Automatic Minimum/Maximum for Axes

Post by amjonas » Wed Jun 11, 2014 9:31 am

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Automatic Minimum/Maximum for Axes

Post by Yeray » Wed Jun 11, 2014 10:14 am

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);
    }
  }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply