<commit_before>define([
  'marionette',
  '#qt_core/controllers/all',
  './track_waveform',
  'd3'
],

/**
  Inherits from track_waveform, just implements new way of handling data
**/

function (Marionette,A,TrackWaveformView,d3) {
  'use strict';

  /**
    Ruler track
      Simple track for displaying a ruler following the navigator actions
  **/
  return TrackWaveformView.extend({


    createGraphicBase:function() {
      TrackWaveformView.prototype.createGraphicBase.call(this);
      var self=this;
      this.d3area = d3.svg.area()
        .x(function(d) { 
          
          return self.xScale(d.time); 
        })
        .y0(function(d) {return self.yScale(d.min); })
        .y1(function(d) { return self.yScale(d.max); });

      this.d3AreaSuite = this.d3chart.append('path').datum([]).attr("class","area").attr('d',this.d3area );
    },

    setVisibleData:function(data) {
      this.hadFirstData = true;
      this.lastReceivedData = data;

      var showDebug=false;//hop

      A.log.log('track_waveform2','setVisibleData----------------- on '+data.length);

      this.MAX_VALUE = A._i.getOnCfg('trackInfoController').getMaxValue();

      var height = this.height;
      var width = this.width;
      var barHeight = this.height-this.size.axisHeight;
      var axisHeight = this.size.axisHeight;

      //update scales<commit_msg>(player/fix) waveform v2 is now properly centered & normalized<commit_after>define([
  'marionette',
  '#qt_core/controllers/all',
  './track_waveform',
  'd3'
],

/**
  Inherits from track_waveform, just implements new way of handling data
**/

function (Marionette,A,TrackWaveformView,d3) {
  'use strict';

  var debug = {};
  /**
    Ruler track
      Simple track for displaying a ruler following the navigator actions
  **/
  return TrackWaveformView.extend({


    createGraphicBase:function() {
      TrackWaveformView.prototype.createGraphicBase.call(this);
      var self=this;


      //tests fix height delta
      var barHeight = this.height-this.size.axisHeight;
      var testScaleFunc = function(yValue) {
        return barHeight - self.yScale(yValue)/2 - barHeight/2 + 2;
        //return barHeight - Math.abs(self.yScale(yValue)/2) - barHeight/2 + 2;
      };

      window.debval = debug;


      this.d3area = d3.svg.area()
        .x(function(d) { 
          return self.xScale(d.time); 
        })
        .y0(function(d) {
          if ( (! debug.min) || debug.min > d.min)
            debug.min = d.min;
          return testScaleFunc(d.min/*d.min*/);
          return self.yScale(d.min); 
        })
        .y1(
          function(d) { 
          if ( (! debug.max) || debug.max < d.max)
            debug.max = d.max;
          return testScaleFunc(d.max);
        return self.yScale(d.max); 
        });

      this.d3AreaSuite = this.d3chart.append('path').datum([]).attr("class","area").attr('d',this.d3area );
    },

    setVisibleData:function(data) {
      this.hadFirstData = true;
      this.lastReceivedData = data;

      var showDebug=false;//hop

      A.log.log('track_waveform2','setVisibleData----------------- on '+data.length);

      this.MAX_VALUE = A._i.getOnCfg('trackInfoController').getMaxValue();

      var height = this.height;
      var width = this.width;
      var barHeight = this.height-this.size.axisHeight;
      var axisHeight = this.size.axisHeight;

      //update scales
{'fraction_non_alphanumeric': 0.1488358384910109, 'fraction_numerical': 0.007957559681697613, 'mean_word_length': 2.4597349643221205, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4674548', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1080, 'n_words': 199}