3
3
/**
4
4
* Internal dependencies
5
5
*/
6
- var colorUtils = require ( '../utils/color-utils' ) ,
6
+ let colorUtils = require ( '../utils/color-utils' ) ,
7
7
GraphRenderer = require ( './graph-renderer' ) ,
8
8
NormalDifferenceDistribution = require ( '../stats/normal-difference-distribution' ) ,
9
9
NumberRange = require ( '../stats/number-range' ) ,
@@ -42,7 +42,7 @@ ImprovementGraphRenderer.prototype.renderCenter = function() {
42
42
} ;
43
43
44
44
ImprovementGraphRenderer . prototype . getCenterLineColor = function ( ) {
45
- var color = this . distribution . mean > 0 ? this . POSITIVE_COLOR : this . NEGATIVE_COLOR ;
45
+ let color = this . distribution . mean > 0 ? this . POSITIVE_COLOR : this . NEGATIVE_COLOR ;
46
46
47
47
return colorUtils . hexToTransparentRGB ( color , 0.5 ) ;
48
48
} ;
@@ -53,15 +53,15 @@ ImprovementGraphRenderer.prototype.prepareForRender = function() {
53
53
} ;
54
54
55
55
ImprovementGraphRenderer . prototype . renderNegativeCurvePart = function ( ) {
56
- var range = new NumberRange ( - Infinity , 0 ) ;
56
+ let range = new NumberRange ( - Infinity , 0 ) ;
57
57
58
58
this . xNegativeValues = this . distribution . getXBetween ( range . min , range . max ) ;
59
59
this . yNegativeValues = this . distribution . getYForXBetween ( range . min , range . max ) ;
60
60
this . renderCurvePart ( this . xNegativeValues , this . yNegativeValues , this . NEGATIVE_COLOR ) ;
61
61
} ;
62
62
63
63
ImprovementGraphRenderer . prototype . renderPositiveCurvePart = function ( ) {
64
- var range = new NumberRange ( 0 , Infinity ) ,
64
+ let range = new NumberRange ( 0 , Infinity ) ,
65
65
xValues = this . distribution . getXBetween ( range . min , range . max ) ,
66
66
yValues = this . distribution . getYForXBetween ( range . min , range . max ) ;
67
67
@@ -79,7 +79,7 @@ ImprovementGraphRenderer.prototype.renderCurvePart = function( xValues, yValues,
79
79
} ;
80
80
81
81
ImprovementGraphRenderer . prototype . renderCurveFilled = function ( xValues , yValues , color ) {
82
- var maxX = Math . max . apply ( Math , xValues ) ,
82
+ let maxX = Math . max . apply ( Math , xValues ) ,
83
83
minX = Math . min . apply ( Math , xValues ) ;
84
84
85
85
this . ctx . beginPath ( ) ;
@@ -104,11 +104,11 @@ ImprovementGraphRenderer.prototype.renderCurveOutline = function( xValues, yValu
104
104
} ;
105
105
106
106
ImprovementGraphRenderer . prototype . renderAxisValues = function ( ) {
107
- var numTicks , canvasY , points , value , canvasX ;
107
+ let numTicks , canvasY , points , value , canvasX ;
108
108
109
109
numTicks = this . xAxisRange . getWidth ( ) / this . calculateXAxisInterval ( ) + 1 ;
110
110
canvasY = this . rect . bottom + this . X_AXIS_TICK_FONT_SIZE + this . X_AXIS_TICK_MARGIN_TOP ;
111
- for ( var i = 0 , l = numTicks ; i < l ; i ++ ) {
111
+ for ( let i = 0 , l = numTicks ; i < l ; i ++ ) {
112
112
points = this . xAxisRange . min + i * this . calculateXAxisInterval ( ) ;
113
113
value = utils . formatPercentageImprovement ( this . convertPointsToPercentage ( points ) ) ;
114
114
canvasX = this . rect . x + ( i / ( numTicks - 1 ) ) * this . rect . width ;
@@ -117,7 +117,7 @@ ImprovementGraphRenderer.prototype.renderAxisValues = function() {
117
117
} ;
118
118
119
119
ImprovementGraphRenderer . prototype . convertPointsToPercentage = function ( points ) {
120
- var mean = this . getControl ( ) . proportion . mean ,
120
+ let mean = this . getControl ( ) . proportion . mean ,
121
121
ratio = ( points + mean ) / mean - 1 ;
122
122
123
123
return Math . round ( ratio * 100 ) ;
@@ -135,7 +135,7 @@ ImprovementGraphRenderer.prototype.calculateXAxisInterval = function() {
135
135
} ;
136
136
137
137
ImprovementGraphRenderer . prototype . calculateXAxisRange = function ( ) {
138
- var interval = this . calculateXAxisInterval ( ) ;
138
+ let interval = this . calculateXAxisInterval ( ) ;
139
139
this . xAxisRange = new NumberRange ( Math . floor ( this . distribution . xRange . min / interval ) * interval , Math . ceil ( this . distribution . xRange . max / interval ) * interval ) ;
140
140
} ;
141
141
0 commit comments