Commits

Chris Leonello committed b6861f3

Added support for label above yMidAxis

Comments (0)

Files changed (2)

src/jquery.jqplot.css

     position: absolute;
 }
 
+.jqplot-yMidAxis-label {
+    font-size: 11pt;
+    position: absolute;
+}
+
 .jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label {
 /*    text-align: center;*/
     font-size: 11pt;

src/plugins/jqplot.pyramidAxisRenderer.js

                 }
             }
             else if (this.name === 'yMidAxis') {
-                dim = dim + w;
+                // don't include width of label at all in width of axis?
+                // dim = (dim > w) ? dim : w;
+                var temp = dim/2.0 - w/2.0;
                 this._elem.css({'width':dim+'px', top:'0px'});
                 if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
-                    this._label._elem.css('width', w+'px');
+                    this._label._elem.css({width: w, left: temp, top: 0});
                 }
             }
             else {
                 }
                 if (lshow) {
                     var h = this._label._elem.outerHeight(true);
-                    this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
+                    if (this.name !== 'yMidAxis') {
+                        this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
+                    }
                     if (this.name == 'yaxis') {
                         this._label._elem.css('left', '0px');
                     }
-                    else {
+                    else if (this.name !== 'yMidAxis') {
                         this._label._elem.css('right', '0px');
                     }   
                     this._label.pack();