<commit_before>/**
 * Copyright <NAME>
 *
 * This file is part of VisuGps3
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 */

/**
 * @fileoverview Charts for elevation, speed, vario.
 * @author <NAME> <<EMAIL>>
 */

goog.provide('vgps3.chart.Chart');

goog.require('goog.async.Deferred');
goog.require('goog.async.Throttle');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Trace');
goog.require('goog.dom');
goog.require('goog.dom.ViewportSizeMonitor');
goog.require('goog.events');
goog.require('goog.events.BrowserEvent');
goog.require('goog.events.MouseWheelHandler');
goog.require('goog.events.MouseWheelHandler.EventType');
goog.require('goog.string.format');
goog.require('goog.style');
goog.require('goog.ui.Slider');
goog.require('vgps3.Map');
goog.require('vgps3.PluginBase');
goog.require('vgps3.chart.AboutEvent');
goog.require('vgps3.chart.ClickEvent');
goog.require('vgps3.chart.MoveEvent');
goog.require('vgps3.chart.Overlays');
goog.require('vgps3.chart.Sliders');
goog.require('vgps3.chart.WheelEvent');
goog.require('vgps3.loader');



/**
 * @param {!Element} container
 *
 * @constructor
 * @extends {vgps3.PluginBase}
 */
vgps3.chart.Chart = function(container) {
  /**
  * @type {goog.events.MouseWheelHandler} The mouse wheel event handler
  * @private
  */
  this.mouseWheelHandler_;

  /**
  * @type {vgps3.chart.Overlays} Chart overlays
  * @private
  */
  this.overlays_;

  /**
  * @type {vgps3.chart.Sliders} Set of sliders to adjust opacity
  * @private
  */
  this.sliders_;

  /**
   * @typedef {Array.<{
   *   fixes: vgps3.track.GpsFixes,
   *   dataView: google.visualization.DataView
   * }>}
   * @private
   */
  this.chartData_ = [];

  /**
   * @typedef {{
   *     elevation: Node,
   *     speed: Node,
   *     vario: Node
   *   }}
   * @private
   */
  this.chartContainers_;

  /**
   * @type {Object.<string, *>}
   * @private
   */
  this.charts_;

  /**
   * @type {number} The index of the current track.
   * @private
   */
  this.currentTrackIndex_;

  /**
   * @type {goog.async.Throttle} Throttle window resize events
   * @private
   */
  this.resizeThrottler_;

  /**
   * @type {goog.dom.ViewportSizeMonitor} Monitor view port size change
   * @private
   */
  this.vpMonitor_;

  /**
   * @type {goog.async.Deferred} Fired when the first track has been loaded
   * @private
   */
  this.trackLoaded_ = new goog.async.Deferred(null, this);

  /**
   * @type {goog.debug.Logger}
   * @private
   */
  this.logger_ = goog.debug.Logger.getLogger('vgps3.chart.Chart');

  /**
   * @type {!Element}
   * @private
   */
  this.container_ = container;

  goog.base(this);

  vgps3.loader.load('visualization', '1', vgps3.chart.chartApiLoaded_, {'packages': ['corechart']});
};
goog.inherits(vgps3.chart.Chart, vgps3.PluginBase);


/**
 * @override
 */
vgps3.chart.Chart.prototype.init = function(vgps) {
  goog.base(this, 'init', vgps);
  this.resizeCharts_();
  this.getHandler()
    .listen(vgps, vgps3.track.EventType.LOAD, this.trackLoadHandler_)
    .listen(vgps, vgps3.track.EventType.LOAD, this.trackUpdateHandler_)
    .listen(vgps, vgps3.track.EventType.SELECT, this.trackSelectHandler_);
};<commit_msg>fix a bug with the charts<commit_after>/**
 * Copyright <NAME>
 *
 * This file is part of VisuGps3
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 */

/**
 * @fileoverview Charts for elevation, speed, vario.
 * @author <NAME> <<EMAIL>>
 */

goog.provide('vgps3.chart.Chart');

goog.require('goog.async.Deferred');
goog.require('goog.async.Throttle');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Trace');
goog.require('goog.dom');
goog.require('goog.dom.ViewportSizeMonitor');
goog.require('goog.events');
goog.require('goog.events.BrowserEvent');
goog.require('goog.events.MouseWheelHandler');
goog.require('goog.events.MouseWheelHandler.EventType');
goog.require('goog.string.format');
goog.require('goog.style');
goog.require('goog.ui.Slider');
goog.require('vgps3.Map');
goog.require('vgps3.PluginBase');
goog.require('vgps3.chart.AboutEvent');
goog.require('vgps3.chart.ClickEvent');
goog.require('vgps3.chart.MoveEvent');
goog.require('vgps3.chart.Overlays');
goog.require('vgps3.chart.Sliders');
goog.require('vgps3.chart.WheelEvent');
goog.require('vgps3.loader');



/**
 * @param {!Element} container
 *
 * @constructor
 * @extends {vgps3.PluginBase}
 */
vgps3.chart.Chart = function(container) {
  /**
  * @type {goog.events.MouseWheelHandler} The mouse wheel event handler
  * @private
  */
  this.mouseWheelHandler_;

  /**
  * @type {vgps3.chart.Overlays} Chart overlays
  * @private
  */
  this.overlays_;

  /**
  * @type {vgps3.chart.Sliders} Set of sliders to adjust opacity
  * @private
  */
  this.sliders_;

  /**
   * @typedef {Array.<{
   *   fixes: vgps3.track.GpsFixes,
   *   dataView: google.visualization.DataView
   * }>}
   * @private
   */
  this.chartData_ = [];

  /**
   * @typedef {{
   *     elevation: Node,
   *     speed: Node,
   *     vario: Node
   *   }}
   * @private
   */
  this.chartContainers_;

  /**
   * @type {Object.<string, *>}
   * @private
   */
  this.charts_;

  /**
   * @type {number} The index of the current track.
   * @private
   */
  this.currentTrackIndex_;

  /**
   * @type {goog.async.Throttle} Throttle window resize events
   * @private
   */
  this.resizeThrottler_;

  /**
   * @type {goog.dom.ViewportSizeMonitor} Monitor view port size change
   * @private
   */
  this.vpMonitor_;

  /**
   * @type {goog.async.Deferred} Fired when the first track has been loaded
   * @private
   */
  this.trackLoaded_ = new goog.async.Deferred(null, this);

  /**
   * @type {goog.debug.Logger}
   * @private
   */
  this.logger_ = goog.debug.Logger.getLogger('vgps3.chart.Chart');

  /**
   * @type {!Element}
   * @private
   */
  this.container_ = container;

  goog.base(this);

  vgps3.loader.load('visualization', '1.x', vgps3.chart.chartApiLoaded_, {'packages': ['corechart']});
};
goog.inherits(vgps3.chart.Chart, vgps3.PluginBase);


/**
 * @override
 */
vgps3.chart.Chart.prototype.init = function(vgps) {
  goog.base(this, 'init', vgps);
  this.resizeCharts_();
  this.getHandler()
    .listen(vgps, vgps3.track.EventType.LOAD, this.trackLoadHandler_)
    .listen(vgps, vgps3.track.EventType.LOAD, this.trackUpdateHandler_)
    .listen(vgps, vgps3.track.EventType.SELECT, this.trackSelectHandler_);
};
{'fraction_non_alphanumeric': 0.17151162790697674, 'fraction_numerical': 0.00795593635250918, 'mean_word_length': 3.6460554371002134, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1861632', 'n_tokens_mistral': 2478, 'n_tokens_neox': 2305, 'n_words': 387}