[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/amd/src/ -> chart_line.js (source)

   1  // This file is part of Moodle - http://moodle.org/
   2  //
   3  // Moodle is free software: you can redistribute it and/or modify
   4  // it under the terms of the GNU General Public License as published by
   5  // the Free Software Foundation, either version 3 of the License, or
   6  // (at your option) any later version.
   7  //
   8  // Moodle is distributed in the hope that it will be useful,
   9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11  // GNU General Public License for more details.
  12  //
  13  // You should have received a copy of the GNU General Public License
  14  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  15  
  16  /**
  17   * Chart line.
  18   *
  19   * @package    core
  20   * @copyright  2016 Frédéric Massart - FMCorz.net
  21   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22   * @module     core/chart_line
  23   */
  24  define(['core/chart_base'], function(Base) {
  25  
  26      /**
  27       * Line chart.
  28       *
  29       * @alias module:core/chart_line
  30       * @extends {module:core/chart_base}
  31       * @class
  32       */
  33      function Line() {
  34          Base.prototype.constructor.apply(this, arguments);
  35      }
  36      Line.prototype = Object.create(Base.prototype);
  37  
  38      /** @override */
  39      Line.prototype.TYPE = 'line';
  40  
  41      /**
  42       * Whether the line should be smooth or not.
  43       *
  44       * By default the chart lines are not smooth.
  45       *
  46       * @type {Bool}
  47       * @protected
  48       */
  49      Line.prototype._smooth = false;
  50  
  51      /** @override */
  52      Line.prototype.create = function(Klass, data) {
  53          var chart = Base.prototype.create.apply(this, arguments);
  54          chart.setSmooth(data.smooth);
  55          return chart;
  56      };
  57  
  58      /**
  59       * Get whether the line should be smooth or not.
  60       *
  61       * @method getSmooth
  62       * @returns {Bool}
  63       */
  64      Line.prototype.getSmooth = function() {
  65          return this._smooth;
  66      };
  67  
  68      /**
  69       * Set whether the line should be smooth or not.
  70       *
  71       * @method setSmooth
  72       * @param {Bool} smooth True if the line chart should be smooth, false otherwise.
  73       */
  74      Line.prototype.setSmooth = function(smooth) {
  75          this._smooth = Boolean(smooth);
  76      };
  77  
  78      return Line;
  79  
  80  });


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1