dojox.charting.axis2d.Default.calculate
dojo.require("dojox.charting.axis2d.Default");
defined in dojox/charting/axis2d/Default.js
Usage
function (min, max, span, labels) (view source)
if(this.initialized()){ return this; } this.labels = "labels" in this.opt ? this.opt.labels : labels; if("min" in this.opt){ min = this.opt.min; } if("max" in this.opt){ max = this.opt.max; } if(this.opt.includeZero){ if(min > 0){ min = 0; } if(max < 0){ max = 0; } } var minMinorStep = 0, ta = this.chart.theme.axis, taFont = "font" in this.opt ? this.opt.font : ta.font, size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0; if(this.vertical){ if(size){ minMinorStep = size + labelGap; } }else{ if(size){ var labelWidth, i; if(this.labels){ labelWidth = df.foldl(df.map(this.labels, function(label){ return dojox.gfx._base._getTextBox(label.text, {font: taFont}).w; }), "Math.max(a, b)", 0); }else{ var labelLength = Math.ceil(Math.log(Math.max(Math.abs(min), Math.abs(max))) / Math.LN10), t = []; if(min < 0 || max < 0){ t.push("-"); } for(i = 0; i < labelLength; ++i){ t.push("9"); } var precision = Math.floor(Math.log(max - min) / Math.LN10); if(precision > 0){ t.push("."); for(i = 0; i < precision; ++i){ t.push("9"); } } labelWidth = dojox.gfx._base._getTextBox(t.join(""), {font: taFont}).w; } minMinorStep = labelWidth + labelGap; } } var kwArgs = { fixUpper: this.opt.fixUpper, fixLower: this.opt.fixLower, natural: this.opt.natural }; if("majorTickStep" in this.opt){ kwArgs.majorTick = this.opt.majorTickStep; } if("minorTickStep" in this.opt){ kwArgs.minorTick = this.opt.minorTickStep; } if("microTickStep" in this.opt){ kwArgs.microTick = this.opt.microTickStep; } this.scaler = dojox.charting.scaler(min, max, span, kwArgs); this.scaler.minMinorStep = minMinorStep; return this;
parameter | type | description |
---|---|---|
min | ||
max | ||
span | ||
labels |