src/ScaleSlider.js
/**
   * Sorts and then returns a string that can be fed into the HTML linear-gradient style
   */
Sorts and then returns a string that can be fed into the HTML linear-gradient style
Sorts and then returns a string that can be fed into the HTML linear - gradient style
makeGradient () {
    const min = this.props.abs ? 0 : Math.abs(this.props.stats.min)
    const scale = this.sortScale()
    let gradientArray = []
    for (let i = 0; i < scale.length; i++) {
      if (scale[i].type === 'value') {
        gradientArray.push(
          ` ${scale[i].color} ${(scale[i].value + min) / (this.props.stats.max + min) * 100}%`
        )
      } else {
        let value = this.props.stats[scale[i].type]
        gradientArray.push(
          ` ${scale[i].color} ${(value + min) / (this.props.stats.max + min) * 100}%`
        )
      }
    }
    return gradientArray.toString()
  }
makeGradient ( ) { const min = this . props . abs ? 0 : Math . abs ( this . props . stats . min ) const scale = this . sortScale ( ) let gradientArray = [ ] for ( let i = 0 ; i < scale . length ; i ++ ) { if ( scale [ i ] . type === 'value' ) { gradientArray . push ( ` ${ scale [ i ] . color } ${ ( scale [ i ] . value + min ) / ( this . props . stats . max + min ) * 100 } ` ) } else { let value = this . props . stats [ scale [ i ] . type ] gradientArray . push ( ` ${ scale [ i ] . color } ${ ( value + min ) / ( this . props . stats . max + min ) * 100 } ` ) } } return gradientArray . toString ( ) }
Sorts and then returns a string that can be fed into the HTML linear-gradient style
Sorts and then returns a string that can be fed into the HTML linear - gradient style