- else if (this.options.yNumberOfTicks) {
- // We use the optionally defined number of ticks as a guide
- this.yticks = new Array();
-
- // if we get this separation right, we'll have good looking graphs
- var roundInt = PlotKit.Base.roundInterval;
- var prec = this.options.yTickPrecision;
- var roughSeparation = roundInt(this.yrange,
- this.options.yNumberOfTicks, prec);
-
- // round off each value of the y-axis to the precision
- // eg. 1.3333 at precision 1 -> 1.3
- for (var i = 0; i <= this.options.yNumberOfTicks; i++) {
- var yval = this.minyval + (i * roughSeparation);
- var pos = 1.0 - ((yval - this.minyval) * this.yscale);
- if ((pos > 1.0) || (pos < 0.0))
- continue;
- this.yticks.push([pos, MochiKit.Format.roundToFixed(yval, prec)]);
- }
- }