integ/js/vs/_vs.chart.js
author Anthony Ly <anthonyly.com@gmail.com>
Fri, 12 Apr 2013 15:08:00 +0200
changeset 28 84719280c84d
child 53 88666afffe6b
permissions -rwxr-xr-x
import VS lib
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     1
(function ($) {
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     2
$.fn.vs.chart = {
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     3
	/* 
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     4
		actually empty everything is in 
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     5
	   _vs.AxisLabelLayout.js,
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     6
       _vs.AxisLayout.js,
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     7
       _vs.CircleLayout.js,
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     8
       _vs.CollapsedStackLayout.js,
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
     9
       _vs.GridLayout.js,
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    10
       _vs.StackedAreaChart.js
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    11
   
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    12
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    13
  this.update = function(_this,options){
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    14
    var defaultOptions = {cat:0,y:0}
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    15
    if(_this.chartPhySetup.grounds[options.cat]!=null) {
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    16
      var myBody = _this.chartPhySetup.grounds[options.cat].GetBody();
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    17
      var myPos = myBody.GetWorldCenter();
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    18
      myPos.y-=options.y/ _this.settings.options.scale;
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    19
      myBody.SetPosition(myPos);
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    20
      //console.log(myBody)
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    21
    }
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    22
  }
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    23
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    24
  this.getPosition = function(_this){
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    25
    var result =[]
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    26
    for (var i = 0; i < _this.chartPhySetup.grounds.length; i++) {
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    27
      myBody = _this.chartPhySetup.grounds[i].GetBody();
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    28
     
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    29
      console.log(myBody.GetWorldCenter())
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    30
     
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    31
      result.push({
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    32
        x:(myBody.GetWorldCenter().x* _this.settings.options.scale),
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    33
        y:(myBody.GetWorldCenter().y* _this.settings.options.scale),
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    34
        a:myBody.GetAngle()
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    35
      })
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    36
    
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    37
    };  
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    38
   return result 
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    39
  }
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    40
 */
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    41
}
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    42
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    43
84719280c84d import VS lib
Anthony Ly <anthonyly.com@gmail.com>
parents:
diff changeset
    44
})(jQuery);