Issue #486 new

jqplot-yaxis div width is not being set correctly when replot() is called

olliewalsh
created an issue

Using version 1.0.0b2_r792.

I have a line graph with custom yaxis ticks. Both the series data and the yaxis ticks are updated when an external event occurs and replot() is called.

If the width of the yaxis tick labels increase (e.g if they all were 0-99 and now one or more is > 100) the grid does not shift right to make additional space for the wider labels and the width of the yaxis div does not increase. I expect this is also the case with automatic yaxis ticks.

After picking through this in a debugger I've tracked it down to the following snipped of code in draw(): {{{

!javascript

            if (ax.yaxis.show) {
                gridPadding.left += ax.yaxis.getWidth();
            }

... ... ... // end of gridPadding adjustments. var arr = ['top', 'bottom', 'left', 'right']; for (var n in arr) { if (this._gridPadding[arr[n]] == null && gridPadding[arr[n]] > 0) { this._gridPadding[arr[n]] = gridPadding[arr[n]]; } else if (this._gridPadding[arr[n]] == null) { this._gridPadding[arr[n]] = this._defaultGridPadding[arr[n]]; } } }}}

I guess there must be a reason for the padding values only ever being set once but it's not obvious to me. I'm resetting _gridPadding to {top:null, right:null, bottom:null, left:null} before calling replot() to work around the issue and I have not seen any obvious side-effects yet.

Comments (0)

  1. Log in to comment