SmoothieChart.prototype.resize = function()

in groups/master/ggd/flask/static/smoothie.js [439:461]


  SmoothieChart.prototype.resize = function() {
    // TODO this function doesn't handle the value of enableDpiScaling changing during execution
    if (!this.options.enableDpiScaling || !window || window.devicePixelRatio === 1)
      return;

    var dpr = window.devicePixelRatio;
    var width = parseInt(this.canvas.getAttribute('width'));
    var height = parseInt(this.canvas.getAttribute('height'));

    if (!this.originalWidth || (Math.floor(this.originalWidth * dpr) !== width)) {
      this.originalWidth = width;
      this.canvas.setAttribute('width', (Math.floor(width * dpr)).toString());
      this.canvas.style.width = width + 'px';
      this.canvas.getContext('2d').scale(dpr, dpr);
    }

    if (!this.originalHeight || (Math.floor(this.originalHeight * dpr) !== height)) {
      this.originalHeight = height;
      this.canvas.setAttribute('height', (Math.floor(height * dpr)).toString());
      this.canvas.style.height = height + 'px';
      this.canvas.getContext('2d').scale(dpr, dpr);
    }
  };