dojox/charting/action2d/MoveSlice.js

  • Provides:

    • dojox.charting.action2d.MoveSlice
  • Requires:

    • dojox.charting.action2d.Base in common
    • dojox.gfx.matrix in common
    • dojox.lang.functional in common
    • dojox.lang.functional.scan in common
    • dojox.lang.functional.fold in common
  • dojox.charting.action2d.__MoveSliceCtorArgs

    • type
      Function
    • chains:
      • dojox.charting.action2d.__BaseCtorArgs: (prototype)
      • dojox.charting.action2d.__BaseCtorArgs: (call)
    • summary
      Additional arguments for highlighting actions.
  • dojox.charting.action2d.__MoveSliceCtorArgs.scale

    • type
      Number
    • summary
      The amount to scale the pie slice.  Default is 1.05.
  • dojox.charting.action2d.__MoveSliceCtorArgs.shift

    • type
      Number
    • summary
      The amount in pixels to shift the pie slice.  Default is 7.
  • dojox.charting.action2d.MoveSlice

    • type
      Function
    • chains:
      • dojox.charting.action2d.Base: (prototype)
      • dojox.charting.action2d.Base: (call)
    • parameters:
      • chart: (typeof dojox.charting.Chart2D)
        The chart this action belongs to.
      • plot: (typeof String)
        The plot this action is attached to.  If not passed, "default" is assumed.
      • kwArgs: (typeof dojox.charting.action2d.__MoveSliceCtorArgs)
        Optional keyword arguments object for setting parameters.
    • source: [view]
         if(!kwArgs){ kwArgs = {}; }
         this.scale = typeof kwArgs.scale == "number" ? kwArgs.scale : DEFAULT_SCALE;
         this.shift = typeof kwArgs.shift == "number" ? kwArgs.shift : DEFAULT_SHIFT;


         this.connect();
    • summary
      Create the slice moving action and connect it to the plot.
  • dojox.charting.action2d.MoveSlice.defaultParams

    • type
      Object
    • summary
  • dojox.charting.action2d.MoveSlice.optionalParams

    • type
      Object
    • summary
  • dojox.charting.action2d.MoveSlice.process

    • type
      Function
    • parameters:
      • o: (typeof dojox.gfx.Shape)
        The object on which to process the slice moving action.
    • source: [view]
         if(!o.shape || o.element != "slice" || !(o.type in this.overOutEvents)){ return; }


         if(!this.angles){
          // calculate the running total of slice angles
          var startAngle = m._degToRad(o.plot.opt.startAngle);
          if(typeof o.run.data[0] == "number"){
           this.angles = df.map(df.scanl(o.run.data, "+", startAngle),
            "* 2 * Math.PI / this", df.foldl(o.run.data, "+", 0));
          }else{
           this.angles = df.map(df.scanl(o.run.data, "a + b.y", startAngle),
            "* 2 * Math.PI / this", df.foldl(o.run.data, "a + b.y", 0));
          }
         }


         var index = o.index, anim, startScale, endScale, startOffset, endOffset,
          angle = (this.angles[index] + this.angles[index + 1]) / 2,
          rotateTo0 = m.rotateAt(-angle, o.cx, o.cy),
          rotateBack = m.rotateAt( angle, o.cx, o.cy);


         anim = this.anim[index];


         if(anim){
          anim.action.stop(true);
         }else{
          this.anim[index] = anim = {};
         }


         if(o.type == "onmouseover"){
          startOffset = 0;
          endOffset = this.shift;
          startScale = 1;
          endScale = this.scale;
         }else{
          startOffset = this.shift;
          endOffset = 0;
          startScale = this.scale;
          endScale = 1;
         }


         anim.action = dojox.gfx.fx.animateTransform({
          shape: o.shape,
          duration: this.duration,
          easing: this.easing,
          transform: [
           rotateBack,
           {name: "translate", start: [startOffset, 0], end: [endOffset, 0]},
           {name: "scaleAt", start: [startScale, o.cx, o.cy], end: [endScale, o.cx, o.cy]},
           rotateTo0
          ]
         });


         if(o.type == "onmouseout"){
          dojo.connect(anim.action, "onEnd", this, function(){
           delete this.anim[index];
          });
         }
         anim.action.play();
    • summary
      Process the action on the given object.
  • dojox.charting.action2d.MoveSlice.reset

    • type
      Function
    • source: [view]
         delete this.angles;
    • summary
  • dojox.charting.action2d.MoveSlice.defaultParams.duration

    • summary
  • dojox.charting.action2d.MoveSlice.defaultParams.easing

    • summary
  • dojox.charting.action2d.MoveSlice.defaultParams.scale

    • summary
  • dojox.charting.action2d.MoveSlice.defaultParams.shift

    • summary
  • dojox.charting.action2d.MoveSlice.angles

    • summary
  • dojox.charting.action2d.MoveSlice.scale

    • summary
  • dojox.charting.action2d.MoveSlice.shift

    • summary
  • DEFAULT_SHIFT

    • summary
  • m

    • summary
  • gf

    • summary
  • df

    • summary
  • kwArgs

    • type
      Object
    • summary
  • dojox.charting.action2d

    • type
      Object
    • summary
  • dojox.charting

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary