dojox/charting/axis2d/Invisible.js

  • Provides:

    • dojox.charting.axis2d.Invisible
  • Requires:

    • dojox.charting.scaler.linear in common
    • dojox.charting.axis2d.common in common
    • dojox.charting.axis2d.Base in common
    • dojo.string in common in project dojo
    • dojox.gfx in common
    • dojox.lang.functional in common
    • dojox.lang.utils in common
  • dojox.charting.axis2d.Invisible

    • type
      Function
    • chains:
      • dojox.charting.axis2d.Base: (prototype)
      • dojox.charting.axis2d.Base: (call)
    • summary
      The constructor for an axis.
    • parameters:
      • chart: (typeof dojox.charting.Chart2D)
        The chart the axis belongs to.
      • kwArgs: (typeof dojox.charting.axis2d.__AxisCtorArgs)
        Any optional keyword arguments to be used to define this axis.
    • source: [view]
         this.opt = dojo.clone(this.defaultParams);
      du.updateWithObject(this.opt, kwArgs);
         du.updateWithPattern(this.opt, kwArgs, this.optionalParams);
  • dojox.charting.axis2d.Invisible.defaultParams

    • type
      Object
    • summary
  • dojox.charting.axis2d.Invisible.optionalParams

    • type
      Object
    • summary
  • dojox.charting.axis2d.Invisible.dependOnData

    • type
      Function
    • source: [view]
         return !("min" in this.opt) || !("max" in this.opt); // Boolean
    • summary
      Find out whether or not the axis options depend on the data in the axis.
    • returns
      Boolean
  • dojox.charting.axis2d.Invisible.clear

    • type
      Function
    • source: [view]
         delete this.scaler;
         delete this.ticks;
         this.dirty = true;
         return this; // dojox.charting.axis2d.Default
    • summary
      Clear out all calculated properties on this axis;
    • return_summary
      dojox.charting.axis2d.Default
      The reference to the axis for functional chaining.
    • returns
      dojox.charting.axis2d.Default
  • dojox.charting.axis2d.Invisible.initialized

    • type
      Function
    • source: [view]
         return "scaler" in this && !(this.dirty && this.dependOnData());
    • summary
      Finds out if this axis has been initialized or not.
    • return_summary
      Boolean
      Whether a scaler has been calculated and if the axis is not dirty.
  • dojox.charting.axis2d.Invisible.setWindow

    • type
      Function
    • parameters:
      • scale: (typeof Number)
        The new scale for the axis.
      • offset: (typeof Number)
        The new offset for the axis.
    • source: [view]
         this.scale = scale;
         this.offset = offset;
         return this.clear(); // dojox.charting.axis2d.Default
    • summary
      Set the drawing "window" for the axis.
    • return_summary
      dojox.charting.axis2d.Default
      The reference to the axis for functional chaining.
    • returns
      dojox.charting.axis2d.Default
  • dojox.charting.axis2d.Invisible.getWindowScale

    • type
      Function
    • source: [view]
         return "scale" in this ? this.scale : 1; // Number
    • summary
      Get the current windowing scale of the axis.
    • returns
      Number
  • dojox.charting.axis2d.Invisible.getWindowOffset

    • type
      Function
    • source: [view]
         return "offset" in this ? this.offset : 0; // Number
    • summary
      Get the current windowing offset for the axis.
    • returns
      Number
  • dojox.charting.axis2d.Invisible._groupLabelWidth

    • type
      Function
    • parameters:
      • labels: (typeof )
      • font: (typeof )
      • wcLimit: (typeof )
    • source: [view]
         if(!labels.length){
          return 0;
         }
         if(dojo.isObject(labels[0])){
          labels = df.map(labels, function(label){ return label.text; });
         }
         if (wcLimit) {
          labels = df.map(labels, function(label){
           return dojo.trim(label).length == 0 ? "" : label.substring(0, wcLimit) + this.trailingSymbol;
          }, this);
         }
         var s = labels.join("
      ");
         return dojox.gfx._base._getTextBox(s, {font: font}).w || 0;
    • summary
  • dojox.charting.axis2d.Invisible.calculate

    • type
      Function
    • parameters:
      • min: (typeof Number)
        The smallest value represented on this axis.
      • max: (typeof Number)
        The largest value represented on this axis.
      • span: (typeof Number)
        The span in pixels over which axis calculations are made.
      • labels: (typeof String[)
        Optional list of labels.
    • source: [view]
         if(this.initialized()){
          return this;
         }
         var o = this.opt;
         this.labels = "labels" in o ? o.labels : labels;
         this.scaler = lin.buildScaler(min, max, span, o);
         var tsb = this.scaler.bounds;
         if("scale" in this){
          // calculate new range
          o.from = tsb.lower + this.offset;
          o.to = (tsb.upper - tsb.lower) / this.scale + o.from;
          // make sure that bounds are correct
          if( !isFinite(o.from) ||
           isNaN(o.from) ||
           !isFinite(o.to) ||
           isNaN(o.to) ||
           o.to - o.from >= tsb.upper - tsb.lower
          ){
           // any error --- remove from/to bounds
           delete o.from;
           delete o.to;
           delete this.scale;
           delete this.offset;
          }else{
           // shift the window, if we are out of bounds
           if(o.from < tsb.lower){
            o.to += tsb.lower - o.from;
            o.from = tsb.lower;
           }else if(o.to > tsb.upper){
            o.from += tsb.upper - o.to;
            o.to = tsb.upper;
           }
           // update the offset
           this.offset = o.from - tsb.lower;
          }
          // re-calculate the scaler
          this.scaler = lin.buildScaler(min, max, span, o);
          tsb = this.scaler.bounds;
          // cleanup
          if(this.scale == 1 && this.offset == 0){
           delete this.scale;
           delete this.offset;
          }
         }


         var ta = this.chart.theme.axis, labelWidth = 0, rotation = o.rotation % 360,
          // TODO: we use one font --- of major tick, we need to use major and minor fonts
          taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
          size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
          cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
          sinr = Math.abs(Math.sin(rotation * Math.PI / 180));


         if(rotation < 0){
          rotation += 360;
         }


         if(size){
          if(this.vertical ? rotation != 0 && rotation != 180 : rotation != 90 && rotation != 270){
           // we need width of all labels
           if(this.labels){
            labelWidth = this._groupLabelWidth(this.labels, taFont, o.maxLabelCharCount);
           }else{
            var labelLength = Math.ceil(
              Math.log(
               Math.max(
                Math.abs(tsb.from),
                Math.abs(tsb.to)
               )
              ) / Math.LN10
             ),
             t = [];
            if(tsb.from < 0 || tsb.to < 0){
             t.push("-");
            }
            t.push(dojo.string.rep("9", labelLength));
            var precision = Math.floor(
             Math.log( tsb.to - tsb.from ) / Math.LN10
            );
            if(precision > 0){
             t.push(".");
             t.push(dojo.string.rep("9", precision));
            }
            labelWidth = dojox.gfx._base._getTextBox(
             t.join(""),
             { font: taFont }
            ).w;
           }
           labelWidth = o.maxLabelSize ? Math.min(o.maxLabelSize, labelWidth) : labelWidth;
          }else{
           labelWidth = size;
          }
          switch(rotation){
           case 0:
           case 90:
           case 180:
           case 270:
            // trivial cases: use labelWidth
            break;
           default:
            // rotated labels
            var gap1 = Math.sqrt(labelWidth * labelWidth + size * size),         // short labels
             gap2 = this.vertical ? size * cosr + labelWidth * sinr : labelWidth * cosr + size * sinr; // slanted labels
            labelWidth = Math.min(gap1, gap2);
            break;
          }
         }


         this.scaler.minMinorStep = labelWidth + labelGap;
         this.ticks = lin.buildTicks(this.scaler, o);
         return this; // dojox.charting.axis2d.Default
    • summary
      Perform all calculations needed to render this axis.
    • return_summary
      dojox.charting.axis2d.Default
      The reference to the axis for functional chaining.
    • returns
      dojox.charting.axis2d.Default
  • dojox.charting.axis2d.Invisible.getScaler

    • type
      Function
    • source: [view]
         return this.scaler; // Object
    • summary
      Get the pre-calculated scaler object.
    • returns
      Object
  • dojox.charting.axis2d.Invisible.getTicks

    • type
      Function
    • source: [view]
         return this.ticks; // Object
    • summary
      Get the pre-calculated ticks object.
    • returns
      Object
  • dojox.charting.axis2d.Invisible.defaultParams.vertical

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.fixUpper

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.fixLower

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.natural

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.leftBottom

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.includeZero

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.fixed

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.majorLabels

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.minorTicks

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.minorLabels

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.microTicks

    • summary
  • dojox.charting.axis2d.Invisible.defaultParams.rotation

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.min

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.max

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.from

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.to

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.majorTickStep

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.minorTickStep

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.microTickStep

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.labels

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.labelFunc

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.maxLabelSize

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.maxLabelCharCount

    • summary
  • dojox.charting.axis2d.Invisible.optionalParams.trailingSymbol

    • summary
  • dojox.charting.axis2d.Invisible.dirty

    • summary
  • dojox.charting.axis2d.Invisible.scale

    • summary
  • dojox.charting.axis2d.Invisible.offset

    • summary
  • dojox.charting.axis2d.Invisible.setWindow.scale

    • type
      Number
    • summary
      The new scale for the axis.
  • dojox.charting.axis2d.Invisible.setWindow.offset

    • type
      Number
    • summary
      The new offset for the axis.
  • dojox.charting.axis2d.Invisible.labels

    • summary
  • dojox.charting.axis2d.Invisible.scaler

    • summary
  • dojox.charting.axis2d.Invisible.scaler.minMinorStep

    • summary
  • dojox.charting.axis2d.Invisible.ticks

    • summary
  • dojox.charting.axis2d.Invisible.calculate.labels

    • type
      String[
    • summary
      Optional list of labels.
  • dojox.charting.axis2d.Invisible.opt

    • summary
  • df

    • summary
  • du

    • summary
  • g

    • summary
  • lin

    • summary
  • merge

    • summary
  • labelGap

    • summary
  • centerAnchorLimit

    • summary
  • dojox.charting.axis2d

    • type
      Object
    • summary
  • dojox.charting

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary