client/js/podium.js
changeset 10 dd7d86fbee70
parent 3 82b4715202d1
child 13 e42d9f11f6e2
--- a/client/js/podium.js	Mon Feb 20 14:36:59 2012 +0100
+++ b/client/js/podium.js	Mon Feb 20 17:44:20 2012 +0100
@@ -20,6 +20,7 @@
     }
     this.options.width = this.options.width || this._$.width();
     this.options.height = this.options.height || this._$.height();
+    this.options.minHeight = this.options.minHeight || 0;
     this.update(data, true);
 }
 
@@ -49,12 +50,12 @@
         var _max = _data.reduce(function(_memo, _val) {
                 return Math.max(_memo, _val);
             }, 1),
-            _scale = this.options.height / _max,
+            _scale = (this.options.height - this.options.minHeight) / _max,
             _spacing = Math.min(this.options.spacing, Math.floor(.5*this.options.width/_data.length)),
             _width = Math.floor(( this.options.width - (_data.length - 1) * _spacing) / _data.length),
             _this = this;
         this._$.children().each(function(_i, _e) {
-            var _height = _scale * _data[_i],
+            var _height = _scale * _data[_i] + _this.options.minHeight,
                 _css = {
                     "margin-top": _this.options.height - _height,
                     "height": _height,