diff --git a/js/curve-fitting/view/BarometerR2Node.js b/js/curve-fitting/view/BarometerR2Node.js index b7515da..883773c 100644 --- a/js/curve-fitting/view/BarometerR2Node.js +++ b/js/curve-fitting/view/BarometerR2Node.js @@ -55,7 +55,11 @@ define( function( require ) { } return inherit( Node, BarometerR2Node, { - // add single tick + /** + * Add single tick. + * + * @param {number} value for which necessary draw tick. + */ addTick: function( value ) { // expression "0.5 + ( CurveFittingConstants.BAROMETER_HEIGHT - 1 )" need to prevent bad graph view in corners var y = 0.5 + ( CurveFittingConstants.BAROMETER_HEIGHT - 1 ) * ( value - RANGE.min ) / ( RANGE.max - RANGE.min ); @@ -69,7 +73,11 @@ define( function( require ) { this.addChild( new Line( -0.5, -y, CurveFittingConstants.BAROMETER_TICK_WIDTH, -y, LINE_OPTIONS ) ); }, - // add array of tick + /** + * Add array of ticks. + * + * @param {Array.} arrayOfTicks - Array of number for which necessary draw tick. + */ addTicks: function( arrayOfTicks ) { var self = this; arrayOfTicks.forEach( function( tickValue ) { diff --git a/js/curve-fitting/view/BarometerX2Node.js b/js/curve-fitting/view/BarometerX2Node.js index eccc1ec..832ba5e 100644 --- a/js/curve-fitting/view/BarometerX2Node.js +++ b/js/curve-fitting/view/BarometerX2Node.js @@ -42,8 +42,13 @@ define( function( require ) { var lowerLimitArray = [ 0.004, 0.052, 0.118, 0.178, 0.23, 0.273, 0.31, 0.342, 0.369, 0.394, 0.545, 0.695, 0.779, 0.927 ]; var upperLimitArr = [ 3.8, 3, 2.6, 2.37, 2.21, 2.1, 2.01, 1.94, 1.88, 1.83, 1.57, 1.35, 1.24, 1.07 ]; - // Convert chi values into barometer color depend on number of points. - // This algorithm was copied directly from flash simulation. + /** + * Convert chi values into barometer color depend on number of points. + * This algorithm was copied directly from flash simulation. + * + * @param {number} chiValue - Chi value. + * @param {number} numberOfPoints - Number of points that have been taken to plot curve. + */ function getChiFillFromChiValue( chiValue, numberOfPoints ) { var red; var green; @@ -116,7 +121,12 @@ define( function( require ) { return 'rgb(' + Math.round( red ) + ', ' + Math.round( green ) + ', ' + Math.round( blue ) + ')'; } - + /** + * Convert X^2 value to corresponded y position. + * + * @param {number} value - Barometer's X^2 value. + * @returns {number} + */ function valueToYPosition( value ) { if ( value <= 1 ) { // expression "0.5 + ( HEIGHT - 1 )" need to prevent bad graph view in corners @@ -170,7 +180,11 @@ define( function( require ) { } return inherit( VBox, BarometerX2Node, { - // add single tick + /** + * Add single tick. + * + * @param {number} value for which necessary draw tick. + */ addTick: function( value ) { var y = valueToYPosition( value ); var tickWidth; @@ -190,7 +204,11 @@ define( function( require ) { this._content.addChild( new Line( -0.5, -y, tickWidth, -y, LINE_OPTIONS ) ); }, - // add array of tick + /** + * Add array of ticks. + * + * @param {Array.} arrayOfTicks - Array of number for which necessary draw tick. + */ addTicks: function( arrayOfTicks ) { var self = this; arrayOfTicks.forEach( function( tickValue ) { diff --git a/js/curve-fitting/view/BucketAndGraphAreaNode.js b/js/curve-fitting/view/BucketAndGraphAreaNode.js index 62cdab7..132539b 100644 --- a/js/curve-fitting/view/BucketAndGraphAreaNode.js +++ b/js/curve-fitting/view/BucketAndGraphAreaNode.js @@ -26,8 +26,6 @@ define( function( require ) { * @constructor */ function BucketAndGraphAreaNode( curveFittingModel, modelViewTransform, options ) { - var self = this; - // create bucket node var bucketNode = new BucketNode( curveFittingModel.bucket, modelViewTransform ); diff --git a/js/curve-fitting/view/GraphAreaNode.js b/js/curve-fitting/view/GraphAreaNode.js index 5b2d1c0..c284b80 100644 --- a/js/curve-fitting/view/GraphAreaNode.js +++ b/js/curve-fitting/view/GraphAreaNode.js @@ -157,7 +157,12 @@ define( function( require ) { } return inherit( Node, GraphAreaNode, { - // convert graph values to global coordinates + /** + * Convert global coordinates to graph values. + * + * @param {Vector2} globalPosition - Global point position. + * @returns {Object} + */ getGraphValuesFromPosition: function( globalPosition ) { var locPosition = this.globalToParentPoint( globalPosition ); @@ -167,6 +172,13 @@ define( function( require ) { }; }, + /** + * Convert graph values to global coordinates. + * + * @param {number} x graph value. + * @param {number} y graph value. + * @returns {Vector2} + */ // convert global coordinates to graph values getPositionFromGraphValues: function( x, y ) { return new Vector2( @@ -175,7 +187,12 @@ define( function( require ) { ); }, - // whether the point is inside the GraphAreaNode (or on the boundary) + /** + * Check is point inside the GraphAreaNode (or on the boundary). + * + * @param {Vector2} pointPosition - Position of point that need to check. + * @returns {boolean} + */ isPointInsideGraph: function( pointPosition ) { return this.localBounds.containsPoint( this.globalToLocalPoint( pointPosition ) ); }